2

I am running Ubuntu 20.04 on my laptop. Ever since the installation I have never had any problems with the date/time going out of sync.

But today when I started the laptop the system time was completely wrong. I can disable NTP and set the correct time manually but the moment I re-enable NTP the time jumps back to being wrong:

david@david-XPS-15-9570  ~  timedatectl 
               Local time: Mo 2021-10-04 08:20:36 CEST
           Universal time: Mo 2021-10-04 06:20:36 UTC 
                 RTC time: Mo 2021-10-04 06:20:37     
                Time zone: Europe/Vienna (CEST, +0200)
System clock synchronized: no                         
              NTP service: inactive                   
          RTC in local TZ: no                         
 david@david-XPS-15-9570  ~  sudo timedatectl set-ntp on
 david@david-XPS-15-9570  ~  timedatectl                
               Local time: Mo 2038-10-04 07:52:04 CEST
           Universal time: Mo 2038-10-04 05:52:04 UTC 
                 RTC time: Mo 2021-10-04 06:21:14     
                Time zone: Europe/Vienna (CEST, +0200)
System clock synchronized: no                         
              NTP service: active                     
          RTC in local TZ: no                         
  • I have rebooted the laptop multiple times, just to be sure
  • I checked the date and time in the BIOS - they are correct

Any idea what's going on here?

ADDITIONAL INFO:

AFAICT, NTP should be querying ntp.ubuntu.com

david@david-XPS-15-9570  ~  cat /etc/systemd/timesyncd.conf 
#  This file is part of systemd.
#
#  systemd is free software; you can redistribute it and/or modify it
#  under the terms of the GNU Lesser General Public License as published by
#  the Free Software Foundation; either version 2.1 of the License, or
#  (at your option) any later version.
#
# Entries in this file show the compile time defaults.
# You can change settings by editing this file.
# Defaults can be restored by simply deleting this file.
#
# See timesyncd.conf(5) for details.

[Time]
#NTP=
#FallbackNTP=ntp.ubuntu.com
#RootDistanceMaxSec=5
#PollIntervalMinSec=32
#PollIntervalMaxSec=2048

... which, according to https://servertest.online/ntp should be fine...

MORE ADDITIONAL INFO:

david@david-XPS-15-9570  ~  service chronyd status              
Unit chronyd.service could not be found.
david@david-XPS-15-9570  ~  service systemd-timedated status
● systemd-timedated.service - Time & Date Service
     Loaded: loaded (/lib/systemd/system/systemd-timedated.service; static; vendor preset: enabled)
     Active: active (running) since Mon 2021-10-04 14:47:02 CEST; 14s ago
       Docs: man:systemd-timedated.service(8)
             man:localtime(5)
             https://www.freedesktop.org/wiki/Software/systemd/timedated
   Main PID: 9393 (systemd-timedat)
      Tasks: 1 (limit: 38042)
     Memory: 1.3M
     CGroup: /system.slice/systemd-timedated.service
             └─9393 /lib/systemd/systemd-timedated

Okt 04 14:47:02 david-XPS-15-9570 systemd[1]: Starting Time & Date Service...
Okt 04 14:47:02 david-XPS-15-9570 systemd[1]: Started Time & Date Service.
 david@david-XPS-15-9570  ~  sudo timedatectl set-ntp on         
 david@david-XPS-15-9570  ~  service systemd-timedated status
● systemd-timedated.service - Time & Date Service
     Loaded: loaded (/lib/systemd/system/systemd-timedated.service; static; vendor preset: enabled)
     Active: active (running) since Mon 2021-10-04 14:47:02 CEST; 16 years 11 months ago
       Docs: man:systemd-timedated.service(8)
             man:localtime(5)
             https://www.freedesktop.org/wiki/Software/systemd/timedated
   Main PID: 9393 (systemd-timedat)
      Tasks: 1 (limit: 38042)
     Memory: 1.4M
     CGroup: /system.slice/systemd-timedated.service
             └─9393 /lib/systemd/systemd-timedated

Okt 04 14:47:02 david-XPS-15-9570 systemd[1]: Starting Time & Date Service...
Okt 04 14:47:02 david-XPS-15-9570 systemd[1]: Started Time & Date Service.
Okt 04 14:47:25 david-XPS-15-9570 systemd-timedated[9393]: systemd-timesyncd.service: Enabling unit.
Okt 04 14:47:25 david-XPS-15-9570 systemd-timedated[9393]: Set NTP to enabled (systemd-timesyncd.service).
Okt 04 07:52:02 david-XPS-15-9570 systemd-timedated[9393]: Set NTP to enabled (systemd-timesyncd.service).
 david@david-XPS-15-9570  ~  timedatectl                         
               Local time: Mo 2038-10-04 07:52:18 CEST
           Universal time: Mo 2038-10-04 05:52:18 UTC 
                 RTC time: Mo 2021-10-04 12:47:42     
                Time zone: Europe/Vienna (CEST, +0200)
System clock synchronized: no                         
              NTP service: active                     
          RTC in local TZ: no  

I changed the line in the config file to these values

NTP=pool.ntp.org
NTP=pool.ntp.org
NTP=ntp.ubuntu.com

but none made any difference...

david.mihola
  • 121
  • 3
  • 1
    Well, for starters your `NTP` and `FallbackNTP` lines are commented out (`#`), so it's not really clear which NTP servers are used? Also, `ntp.ubuntu.com` is under `FallbackNTP`. So try setting your preferred server under `NTP` and uncomment (remove the `#`). Also, try other NTP servers, just to test. – Artur Meinild Oct 04 '21 at 07:14
  • 1
    Also check `service systemd-timedated status` and `service chronyd status` – Wayne Vosberg Oct 04 '21 at 08:05
  • Thank you both for your comments! @ArturMeinild - How embarrassing! I did indeed overlook the `#`s. I noticed that only the `FallbackNTP` is configured, but since I've never touched that file I thought it should work anyway... @WayneVosberg - I'll check the status and then update my question! – david.mihola Oct 04 '21 at 12:32
  • @ArturMeinild - is there a way to actively check which NTP URL is being used? – david.mihola Oct 04 '21 at 12:53
  • Sorry - I use chronyd on a 21.04 system. 20.04 used systemd-timesyncd by default, so can you add the output of `service systemd-timesyncd status` ? You should see a line like: `systemd-timesyncd[1015]: Initial synchronization to time server 91.189.94.4:123 (ntp.ubuntu.com).` – Wayne Vosberg Oct 04 '21 at 13:54
  • 1
    Check this answer and see if it works for you: [How to sync the time to network with timedatectl on Ubuntu 18.04?](https://askubuntu.com/questions/1058593/how-to-sync-the-time-to-network-with-timedatectl-on-ubuntu-18-04) – Artur Meinild Oct 04 '21 at 15:11

0 Answers0