创建总线连接失败;运行命令“timedatectl”的状态为 1

Ano*_*non 5 linux ubuntu r windows-subsystem-for-linux

我正在使用 WSL2。\n在 R 中,我尝试安装软件包。例如:

\n
> install.packages("tidyverse")\n
Run Code Online (Sandbox Code Playgroud)\n

但我收到Failed to create bus connection错误。

\n

追溯:

\n
Failed to create bus connection: No such file or directory\nWarning in system("timedatectl", intern = TRUE) :\n  running command 'timedatectl' had status 1\n** help\n*** installing help indices\n*** copying figures\n** building package indices\n** installing vignettes\n** testing if installed package can be loaded from temporary location\nFailed to create bus connection: No such file or directory\nWarning in system("timedatectl", intern = TRUE) :\n  running command 'timedatectl' had status 1\n** testing if installed package can be loaded from final location\nFailed to create bus connection: No such file or directory\nWarning in system("timedatectl", intern = TRUE) :\n  running command 'timedatectl' had status 1\n** testing if installed package keeps a record of temporary installation path\n* DONE (tidyverse)\n\nThe downloaded source packages are in\n        \xe2\x80\x98/tmp/RtmpD1g9KP/downloaded_packages\xe2\x80\x99\n
Run Code Online (Sandbox Code Playgroud)\n

我尝试安装 dbus 软件包:

\n
sudo apt-get update\nsudo apt-get install dbus\n
Run Code Online (Sandbox Code Playgroud)\n

并且重启后仍然出现错误。

\n

我也尝试过:

\n
sudo systemctl status\n
Run Code Online (Sandbox Code Playgroud)\n

但它返回:

\n
System has not been booted with systemd as init system (PID 1). Can't operate.\n
Run Code Online (Sandbox Code Playgroud)\n

小智 2

在 .bashrc 或其他别名文件中,添加 TZ 变量。对我来说,我做到了

export TZ="America/New_York"
Run Code Online (Sandbox Code Playgroud)

然后重新加载 bash,它应该能够识别时区。您可以在此处查看有关时区名称的更多信息:https ://en.wikipedia.org/wiki/List_of_tz_database_time_zones