2

Upgraded to 19.10 a three weeks ago, and since then, I can't get the system to sync with a time server.

What I've done:

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

Any hints?

4
  • 1
    " NTP service: inactive" suggests askubuntu.com/questions/1009729/unable-to-start-ntpd-service would be useful.
    – K7AAY
    Jan 15, 2020 at 0:54
  • 1
    I think the hint by @K7AAY is right, but for older systemd where ntpd was used. That would today be chrony, yet for just the client portion systemd-timesyncd should be enough. Enabling ought to be timedatectl set-ntp 1 maybe then followed by timedatectl timesync-status and systemctl status systemd-timesyncd. There are environments (e.g. in containers) where the service will just not start due to the condition of being in a container. That should be in that data, therefore reporting such info here by updating the question might also help Jan 15, 2020 at 6:57
  • Marc W. Please see my answer. If it's helpful, please remember to accept it by clicking the checkmark and up-arrow icons that appear just to the left of my answer. Thanks!
    – heynnema
    Jan 15, 2020 at 20:56
  • This type of issue could also be caused by restrictive firewall settings: make sure your firewall allows outbound UDP traffic on port 123
    – djvg
    Jun 15, 2021 at 7:56

1 Answer 1

4

This problem occurs because of a conflict between ntp.service and systemd-timesyncd.service. It's a known bug.

Why does this happen? It occurs on systems that have been upgraded to 19.10. ntp.service is carried over during an upgrade, and 19.10's systemd-timesyncd.server won't start in its presence.

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

See the following:

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

One visual side effect of this problem can be seen in the Date & Time settings panel. You can't enable "Automatic Date & Time". The switch flips back to disabled.

enter image description here

However, ntp still does the time synchronization with the various ntp servers.

This can be fixed by uninstalling ntp, ntpdate, and sntp, and letting systemd-timesyncd.service perform the time synchronization.

Sources:

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

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .