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.
timedatectl status
. You're doing some strange things, like setting your system time from the hardware clock (sudo hwclock --systohc
). – Artur Meinild Oct 17 '22 at 10:20sudo timedatectl set-ntp yes
, you can see the settingNTP service: active
. – mahmood Oct 17 '22 at 10:58ntpd
orchrony
? If you did so, you should explicitly state so, since Ubuntu usestimesyncd
by default. – Artur Meinild Oct 18 '22 at 13:13chrony
isn't syncing correctly or 2) Remove bothntp
andchrony
, and revert tosystemd-timesyncd
. I can help you with 2 but not with 1. – Artur Meinild Oct 18 '22 at 14:03