Score:0

Time mismatch (local and universal)

cn flag

I don't know why the displayed time in my Ubuntu 20.04 is different from real clock. As you can see below, I have synchronized the clock and then date command shows it is 02:54:49 PM CEST, but the query time from internet shows 10:55:18 UTC. Since CEST is +2 hours ahead, the correct CEST time should be 10+2=12 AM and my watch shows this time, too.

$ sudo hwclock --systohc
$ timedatectl status
               Local time: Mon 2022-10-17 14:54:41 CEST 
           Universal time: Mon 2022-10-17 12:54:41 UTC  
                 RTC time: Mon 2022-10-17 12:54:41      
                Time zone: Europe/Brussels (CEST, +0200)
System clock synchronized: no                           
              NTP service: active                       
          RTC in local TZ: no        

$ date
Mon 17 Oct 2022 02:54:49 PM CEST

$ cat </dev/tcp/time.nist.gov/13

59869 22-10-17 10:55:18 21 0 0 543.3 UTC(NIST) * 

$ 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

Any idea on how to fix that?

UPDATE:

On the system, chrony is running while ntp is masked.

$ dpkg -l | grep ntp
rc  ntp                                                         1:4.2.8p12+dfsg-3ubuntu4.20.04.1       amd64        Network Time Protocol daemon and utility programs
ii  ntpdate                                                     1:4.2.8p12+dfsg-3ubuntu4.20.04.1       amd64        client for setting system time from NTP servers (deprecated)
ii  sntp                                                        1:4.2.8p12+dfsg-3ubuntu4.20.04.1       amd64        Network Time Protocol - sntp client
$ dpkg -l | grep chrony
ii  chrony                                                      3.5-6ubuntu6.2                         amd64        Versatile implementation of the Network Time Protocol
$ systemctl status ntp.service
● ntp.service
     Loaded: masked (Reason: Unit ntp.service is masked.)
     Active: inactive (dead) since Mon 2022-10-17 13:04:47 CEST; 1 day 4h ago
   Main PID: 1773 (code=exited, status=0/SUCCESS)
$ systemctl status chronyd.service
● chrony.service - chrony, an NTP client/server
     Loaded: loaded (/lib/systemd/system/chrony.service; enabled; vendor preset: enabled)
     Active: active (running) since Mon 2022-10-17 13:09:20 CEST; 1 day 4h ago

So, it seems that ntp is replaced by chrony on the system (Don't remember about that). But I don't know how to sync the chrony.

Artur Meinild avatar
vn flag
Please show the output of `timedatectl status`. You're doing some strange things, like setting your system time from the hardware clock (`sudo hwclock --systohc`).
Artur Meinild avatar
vn flag
Also, did you follow the advice from [your own previous question](https://askubuntu.com/questions/1314479/ntp-not-supported), to get timesync to work this time?
cn flag
Please see the updated post with current times.
cn flag
@ArturMeinild: Using `sudo timedatectl set-ntp yes`, you can see the setting `NTP service: active`.
Artur Meinild avatar
vn flag
Did you install `ntpd` or `chrony`? If you did so, you should explicitly state so, since Ubuntu uses `timesyncd` by default.
cn flag
Please see the updated post.
Artur Meinild avatar
vn flag
Ok this clears up some things. You have a few options: 1) Find out why `chrony` isn't syncing correctly or 2) Remove both `ntp` and `chrony`, and revert to `systemd-timesyncd`. I can help you with 2 but not with 1.
Score:1
vn flag

Use these commands to get more information about current timesync status:

  • timedatectl status (compare times, sync status etc.)
  • timedatectl timesync-status (timeserver, interval, delays, stratum etc.)

Your output of timedatectl status explicitly states that the system clock is not synchronized.

Restart your timesyncd.service to force a synchronization:

sudo systemctl restart systemd-timesyncd.service

If this doesn't work, your timeserver configuration isn't valid.

If this is the case, please include the contents of /etc/systemd/timesyncd.conf to find out why it isn't working.

cn flag
The output of service restart is `Failed to restart systemd-timesyncd.service: Unit systemd-timesyncd.service is masked`. Also please see the updated post.
Artur Meinild avatar
vn flag
Did you follow the advice from [your own previous question](https://askubuntu.com/a/1317803/1066942) to unmask the service?
cn flag
chronyd is running while ntp is masked and inactive.
I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.