5

In my lubuntu 22.04 is active the service systemd-timesyncd.service which starts the daemon systemd-timesyncd (see here the documentation). This is the status of this service:

> systemctl status systemd-timesyncd

this is the output of the previous command:

● systemd-timesyncd.service - Network Time Synchronization Loaded: loaded (/lib/systemd/system/systemd-timesyncd.service; enabled; vendor preset: enabled) Active: active (running) since Thu 2023-07-06 12:21:43 CEST; 2min 54s ago Docs: man:systemd-timesyncd.service(8) Main PID: 1917 (systemd-timesyn) Status: "Idle." Tasks: 2 (limit: 2030) Memory: 1.3M CPU: 201ms CGroup: /system.slice/systemd-timesyncd.service └─1917 /lib/systemd/systemd-timesyncd

lug 06 12:21:55 ceia-te systemd-timesyncd[1917]: Timed out waiting for reply from 185.125.190.57:123 (ntp.ubuntu.com). lug 06 12:22:05 ceia-te systemd-timesyncd[1917]: Timed out waiting for reply from 185.125.190.58:123 (ntp.ubuntu.com). lug 06 12:22:15 ceia-te systemd-timesyncd[1917]: Timed out waiting for reply from 185.125.190.56:123 (ntp.ubuntu.com). lug 06 12:22:25 ceia-te systemd-timesyncd[1917]: Timed out waiting for reply from 91.189.94.4:123 (ntp.ubuntu.com).

The output shows that the service is running and tries to connect to the NTP server ntp.ubuntu.com but it does not receive any reply (see messages Timed out waiting for reply from ntp.ubuntu.com); this server is reachable by ping as we can see by the output of the following command:

> ping ntp.ubuntu.com
PING ntp.ubuntu.com (91.189.94.4) 56(84) bytes of data.
64 bytes from pugot.canonical.com (91.189.94.4): icmp_seq=1 ttl=53 time=30.0 ms
64 bytes from pugot.canonical.com (91.189.94.4): icmp_seq=2 ttl=53 time=29.8 ms
64 bytes from pugot.canonical.com (91.189.94.4): icmp_seq=3 ttl=53 time=29.8 ms

The firewall iptables is not active:

> sudo iptables --list
Chain INPUT (policy ACCEPT)
target     prot opt source               destination

Chain FORWARD (policy ACCEPT) target prot opt source destination

Chain OUTPUT (policy ACCEPT) target prot opt source destination

Can someone tell me why the timesyncd client does not receive any reply from the NTP server ntp.ubuntu.com?

Thanks

User051209
  • 539
  • 1
  • 7
  • 24

2 Answers2

5

The problem was in the Internet service provider

Thank for your comments. I have tried to connect to another network which is able to connect to Internet by an other way respect of the network which I used when I have written the post.
By this other network and without any modification to the configuration file /etc/systemd/timesyncd.conf which is:

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

the NTP client systemd timesyncd can synchronize the system date to the NTP server ntp.ubuntu.com.

In fact the status of the service systemd-timesyncd.service is the following:

systemctl status systemd-timesyncd
● systemd-timesyncd.service - Network Time Synchronization
     Loaded: loaded (/lib/systemd/system/systemd-timesyncd.service; enabled; vendor preset: enabled)
     Active: active (running) since Thu 2023-07-06 14:12:48 CEST; 46min ago
       Docs: man:systemd-timesyncd.service(8)
   Main PID: 2065 (systemd-timesyn)
     Status: "Initial synchronization to time server 185.125.190.56:123 (ntp.ubuntu.com)."
      Tasks: 2 (limit: 2030)
     Memory: 1.3M
        CPU: 203ms
     CGroup: /system.slice/systemd-timesyncd.service
             └─2065 /lib/systemd/systemd-timesyncd

lug 06 14:12:48 ceia-te systemd[1]: Starting Network Time Synchronization... lug 06 14:12:48 ceia-te systemd[1]: Started Network Time Synchronization. lug 06 14:12:13 ceia-te systemd-timesyncd[2065]: Initial synchronization to time server 185.125.190.56:123 (ntp.ubuntu.com).

So without any modification to the lubuntu configuration and without installing any other package the system works correctly.

User051209
  • 539
  • 1
  • 7
  • 24
0

For me on Ubuntu 24.04 it seems my ISP block ntp protocol queries(port: 123).

Here is the systemc-timesyncd.service output

Sep 28 05:53:56 ubuntu systemd-timesyncd[1704]: Timed out waiting for reply from 176.9.157.155:123 (2.ubuntu.pool.ntp.org).
Sep 28 05:54:06 ubuntu systemd-timesyncd[1704]: Timed out waiting for reply from 128.140.109.119:123 (2.ubuntu.pool.ntp.org).
Sep 28 05:56:24 ubuntu systemd-timesyncd[1704]: Timed out waiting for reply from 159.69.245.253:123 (2.ubuntu.pool.ntp.org).
Sep 28 05:56:35 ubuntu systemd-timesyncd[1704]: Timed out waiting for reply from 195.201.20.16:123 (2.ubuntu.pool.ntp.org).
Sep 28 05:56:45 ubuntu systemd-timesyncd[1704]: Timed out waiting for reply from 80.153.195.191:123 (2.ubuntu.pool.ntp.org).
Sep 28 05:56:55 ubuntu systemd-timesyncd[1704]: Timed out waiting for reply from 49.13.14.46:123 (2.ubuntu.pool.ntp.org).
Sep 28 06:04:58 ubuntu systemd-timesyncd[1704]: Timed out waiting for reply from 88.218.226.91:123 (2.ubuntu.pool.ntp.org).
Sep 28 06:05:08 ubuntu systemd-timesyncd[1704]: Timed out waiting for reply from 144.76.76.107:123 (2.ubuntu.pool.ntp.org).
Sep 28 06:05:18 ubuntu systemd-timesyncd[1704]: Timed out waiting for reply from 45.9.61.155:123 (2.ubuntu.pool.ntp.org).
Sep 28 06:05:28 ubuntu systemd-timesyncd[1704]: Timed out waiting for reply from 23.88.7.139:123 (2.ubuntu.pool.ntp.org).

The issue appeared when I install Prometheus monitoring software in access dashboard on http://IP:9090 address

Server time is out of sync Detected a time difference of 3m 36.102s between your browser and the server. You may see unexpected time-shifted query results due to the time drift.

Error on web dashborad


So do more investigation of root of error.

$ sudo apt install ntpdate
$ ntpdate -q ntp.ubuntu.com
ntpdig: no eligible servers

$ ntpdate -q time.nist.gov ntpdig: no eligible servers

To liberalize this restriction I use htpdate package

Install

$ sudo apt install htpdate

Sync and Set time on machine

sudo htpdate -a google.com

But non of these solutions works except below Ask Ubuntu answer.

Force setting time

sudo date -s "$(curl http://s3.amazonaws.com -v 2>&1 | \
  grep "Date: " | awk '{ print $3 " " $5 " " $4 " " $7 " " $6 " GMT"}')"

And remove ntpsec and systemd-timesyncd

$ sudo apt purge ntpsec systemd-timesyncd

At last Prometheus works without error messages.


Solution

As my VPS server hosted on VMWARE ESXI OS, and find a similar topics about time conflict I try to disable this feature.

Finally after many tries I find error source and resolve it.

Disable sync time on startup

EsmaeelE
  • 425
  • 7
  • 16