首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >无法将时间同步到Ubuntu 19.10上的网络服务器

无法将时间同步到Ubuntu 19.10上的网络服务器
EN

Ask Ubuntu用户
提问于 2020-01-15 00:23:14
回答 1查看 5.4K关注 0票数 2

三周前升级到19.10,从那以后,我无法让系统与时间服务器同步。

我所做的:

代码语言:javascript
复制
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

有什么暗示吗?

EN

回答 1

Ask Ubuntu用户

发布于 2020-01-15 20:47:14

此问题的发生是由于ntp.servicesystemd-timesyncd.service之间的冲突。是已知的窃听器。

这一切为什么要发生?它发生在升级到19.10的系统上。ntp.service是在升级过程中结转的,而19.10's systemd-timesyncd.server不会在它出现的情况下启动。

more /lib/systemd/system/systemd-timesyncd.service.d/disable-with-time-daemon.conf

代码语言:javascript
复制
[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

代码语言:javascript
复制
● 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

代码语言:javascript
复制
● 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服务器进行时间同步。

可以通过卸载ntpntpdatesntp并让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

票数 3
EN
页面原文内容由Ask Ubuntu提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://askubuntu.com/questions/1203038

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档