如何在 Ubuntu 19.10 上启用自动日期和时间?

Aks*_*tel 7 ntp gnome-control-center 19.10

我正在尝试打开自动日期和时间,但它会立即自行关闭。

在此处输入图片说明 这似乎只有在安装最新更新后才会发生。

如何启用自动日期和时间?

fel*_*425 5

简短回答:

\n\n
$ sudo apt remove ntp\n
Run Code Online (Sandbox Code Playgroud)\n\n

并尝试再次启用自动时间和日期。

\n\n
\n\n

长答案:

\n\n

如果您尝试使用以下命令手动启动“systemd-timesyncd”服务:

\n\n
systemctl start systemd-timesyncd.service\n
Run Code Online (Sandbox Code Playgroud)\n\n

并使用以下命令检查状态:

\n\n
systemctl status systemd-timesyncd.service\n
Run Code Online (Sandbox Code Playgroud)\n\n

你可以看到它说:

\n\n
Condition: start condition failed at <some time>; 1s ago\n       \xe2\x94\x94\xe2\x94\x80 ConditionFileIsExecutable=!/usr/sbin/ntpd was not met\n
Run Code Online (Sandbox Code Playgroud)\n\n

因此,“ntpd”必须不可用才能正常工作。如果您检查文件“/lib/systemd/system/systemd-timesyncd.service.d/disable-with-time-daemon.conf”,您可以看到更多阻止启动的条件:

\n\n
 ConditionFileIsExecutable=!/usr/sbin/ntpd\n ConditionFileIsExecutable=!/usr/sbin/openntpd\n ConditionFileIsExecutable=!/usr/sbin/chronyd\n ConditionFileIsExecutable=!/usr/sbin/VBoxService \n
Run Code Online (Sandbox Code Playgroud)\n\n

因此,根据您的安装情况,如果安装了“ntp”、“openntpd”、“chrony”和/或 VirtualBox 服务,它也会停止工作。

\n