三周前升级到 19.10,从那时起,我无法让系统与时间服务器同步。
我做了什么:
xxxx@asgard:~$ cat /etc/timezone
America/Los_Angeles
marc@asgard:~$ timedatectl
Local time: Tue 2020-01-14 15:18:24 PST
Universal time: Tue 2020-01-14 23:18:24 UTC
RTC time: Tue 2020-01-14 23:18:27
Time zone: America/Los_Angeles (PST, -0800)
System clock synchronized: no
NTP service: inactive
RTC in local TZ: no
xxxx@asgard:~$ sudo systemctl restart systemd-timesyncd.service
[sudo] password for xxxx:
xxxx@asgard:~$ timedatectl
Local time: Tue 2020-01-14 15:19:13 PST
Universal time: Tue 2020-01-14 23:19:13 UTC
RTC time: Tue 2020-01-14 23:19:16
Time zone: America/Los_Angeles (PST, -0800)
System clock synchronized: no
NTP service: inactive
RTC in local TZ: no
xxxx@asgard:~$ sudo timedatectl set-ntp true
xxxx@asgard:~$ timedatectl
Local time: Tue 2020-01-14 15:19:44 PST
Universal time: Tue 2020-01-14 23:19:44 UTC
RTC time: Tue 2020-01-14 23:19:47
Time zone: America/Los_Angeles (PST, -0800)
System clock synchronized: no
NTP service: inactive
RTC in local TZ: no
有什么提示吗?
答案1
ntp.service
该问题是由于和之间存在冲突而导致的systemd-timesyncd.service
。这是一个已知错误。
为什么会发生这种情况?它发生在已升级到 19.10 的系统上。ntp.service
在升级过程中会被延续,并且 19.10systemd-timesyncd.server
不会在其存在的情况下启动。
more /lib/systemd/system/systemd-timesyncd.service.d/disable-with-time-daemon.conf
[Unit]
# don't run timesyncd if we have another NTP daemon installed
ConditionFileIsExecutable=!/usr/sbin/ntpd
ConditionFileIsExecutable=!/usr/sbin/openntpd
ConditionFileIsExecutable=!/usr/sbin/chronyd
ConditionFileIsExecutable=!/usr/sbin/VBoxService
请参阅以下内容:
systemctl status ntp.service
● ntp.service - Network Time Service
Loaded: loaded (/lib/systemd/system/ntp.service; enabled; vendor preset: enab
Active: active (running) since Wed 2020-01-15 11:05:12 PST; 1h 21min ago
Docs: man:ntpd(8)
Main PID: 28740 (ntpd)
Tasks: 2 (limit: 4915)
Memory: 2.0M
CGroup: /system.slice/ntp.service
└─28740 /usr/sbin/ntpd -p /var/run/ntpd.pid -g -u 120:131
Jan 15 11:15:30 Satellite-E55 ntpd[28740]: 184.105.182.7 local addr 192.168.0.10
Jan 15 11:16:28 Satellite-E55 ntpd[28740]: 198.58.105.63 local addr 192.168.0.10
Jan 15 11:17:38 Satellite-E55 ntpd[28740]: 69.10.161.7 local addr 192.168.0.100
Jan 15 11:17:39 Satellite-E55 ntpd[28740]: 66.172.17.62 local addr 192.168.0.100
Jan 15 11:28:55 Satellite-E55 ntpd[28740]: 172.98.193.44 local addr 192.168.0.10
Jan 15 11:28:57 Satellite-E55 ntpd[28740]: 45.33.2.219 local addr 192.168.0.100
Jan 15 11:29:20 Satellite-E55 ntpd[28740]: 91.189.94.4 local addr 192.168.0.100
Jan 15 11:29:55 Satellite-E55 ntpd[28740]: 216.229.0.49 local addr 192.168.0.100
Jan 15 11:31:07 Satellite-E55 ntpd[28740]: 74.6.168.73 local addr 192.168.0.100
Jan 15 11:31:08 Satellite-E55 ntpd[28740]: 69.195.142.11 local addr 192.168.0.10
systemctl status systemd-timesyncd.service
● systemd-timesyncd.service - Network Time Synchronization
Loaded: loaded (/lib/systemd/system/systemd-timesyncd.service; disabled; vend
Drop-In: /lib/systemd/system/systemd-timesyncd.service.d
└─disable-with-time-daemon.conf
Active: inactive (dead)
Docs: man:systemd-timesyncd.service(8)
Jan 15 07:52:09 Satellite-E55 systemd[1]: Condition check resulted in Network Ti
Jan 15 07:52:11 Satellite-E55 systemd[1]: Condition check resulted in Network Ti
Jan 15 07:52:13 Satellite-E55 systemd[1]: Condition check resulted in Network Ti
Jan 15 07:52:23 Satellite-E55 systemd[1]: Condition check resulted in Network Ti
Jan 15 07:52:24 Satellite-E55 systemd[1]: Condition check resulted in Network Ti
Jan 15 07:52:57 Satellite-E55 systemd[1]: Condition check resulted in Network Ti
Jan 15 07:52:58 Satellite-E55 systemd[1]: Condition check resulted in Network Ti
Jan 15 07:53:00 Satellite-E55 systemd[1]: Condition check resulted in Network Ti
Jan 15 07:54:00 Satellite-E55 systemd[1]: Condition check resulted in Network Ti
Jan 15 07:59:57 Satellite-E55 systemd[1]: Condition check resulted in Network Ti
这个问题的一个视觉副作用可以在Date & Time
设置面板中看到。您无法启用“自动日期和时间”。开关切换回禁用状态。
但是,ntp
仍然与各个 ntp 服务器进行时间同步。
这能ntp
可以通过卸载、ntpdate
和sntp
并执行systemd-timesyncd.service
时间同步来修复。
资料来源:
https://bugs.launchpad.net/ubuntu/+source/gnome-control-center/+bug/1858095
https://bugs.launchpad.net/ubuntu/+source/gnome-control-center/+bug/1848309
https://bugs.launchpad.net/ubuntu/+source/systemd/+bug/1849156