treskilion
Posts: 2
Joined: Thu Sep 23, 2021 10:01 am

Why is system clock not syncing?

Thu Sep 23, 2021 11:30 am

I have three pi 4 model b boards. Of these three boards, there are two boards which are not syncing their systems clocks.

All boards have a static IP address and are connected via ethernet.
I read that this should work out of the box and this was definitely the case for one of the boards but the other two simply won't

For the boards that aren't syncing I have set the ntp server to our DNS server, because according to our sysadmin this is where they are supposed to get their NTP sync if they don't get it via DHCP (which they don't since they have static IP)

running timedatectl:

Code: Select all

               Local time: Fri 2021-05-07 22:23:11 CEST
           Universal time: Fri 2021-05-07 20:23:11 UTC
                 RTC time: n/a
                Time zone: Europe/Amsterdam (CEST, +0200)
System clock synchronized: no
              NTP service: active
          RTC in local TZ: no
It says the NTP service is active

I can also see that with timedatectl show-timesync it it looking at the (supposedly) correct server with the debian ntp servers as a fallback.

Code: Select all

SystemNTPServers=192.168.42.250
FallbackNTPServers=0.debian.pool.ntp.org 1.debian.pool.ntp.org 2.debian.pool.ntp.org 3.debian.pool.ntp.org
ServerName=192.168.42.250
ServerAddress=192.168.42.250
RootDistanceMaxUSec=5s
PollIntervalMinUSec=32s
PollIntervalMaxUSec=34min 8s
PollIntervalUSec=34min 8s
Frequency=0
and when I check out the systemctl status systemd-timesyncd

Code: Select all

systemd-timesyncd.service - Network Time Synchronization
   Loaded: loaded (/lib/systemd/system/systemd-timesyncd.service; enabled; vendor preset: enabled)
  Drop-In: /usr/lib/systemd/system/systemd-timesyncd.service.d
           └─disable-with-time-daemon.conf
   Active: active (running) since Fri 2021-05-07 20:57:57 CEST; 1h 31min ago
     Docs: man:systemd-timesyncd.service(8)
 Main PID: 996 (systemd-timesyn)
   Status: "Idle."
    Tasks: 2 (limit: 4915)
   CGroup: /system.slice/systemd-timesyncd.service
           └─996 /lib/systemd/systemd-timesyncd

May 07 20:57:57 raspberrypi systemd[1]: Starting Network Time Synchronization...
May 07 20:57:57 raspberrypi systemd[1]: Started Network Time Synchronization.
I can see that it has started the network time synchronization. It just doesn't actually synchronize and it seems to be running in idle.

I also read that it is sometimes waiting for a network change so I tried restarting the systemd-networkd service but alas...

it has detected the network change

Code: Select all

May 07 20:59:48 raspberrypi systemd-timesyncd[996]: Network configuration changed, trying to establish connection.
May 07 20:59:48 raspberrypi systemd-timesyncd[996]: Network configuration changed, trying to establish connection.
but didn't sync the clock.

One more piece of info, when running timedatectl timesync-status it gives me the following info:

Code: Select all

 Server: 192.168.42.250 (192.168.42.250)
Poll interval: 34min 8s (min: 32s; max 34min 8s)
 Packet count: 0
I think the packet count being 0 tells me that it is not coming through, except if I nc -z -v -u 192.168.42.250 123 or nc -z -v -u 0.debian.pool.ntp.org it gives me

Code: Select all

Connection to 0.debian.pool.ntp.org 123 port [udp/ntp] succeeded!
This has been driving me nuts for two days now. Does anyone know how to solve this problem

treskilion
Posts: 2
Joined: Thu Sep 23, 2021 10:01 am

Re: Why is system clock not syncing?

Fri Sep 24, 2021 7:37 am

One of the other places I asked this question panned out. It told me to look further into the network as there didn't appear to be anything wrong with how to pi was configured. When I looked into this with a colleague we found somebody else who also had his systemd-timesyncd service running idly while still being to connect to a time server with netcat. The solution turned out to be that the network is slowing down the packets to a certain point where systemd-timesyncd drops them. By increasing the RootDistanceMaxSec we were able to get it to synchronize.


bls
Posts: 1748
Joined: Mon Oct 22, 2018 11:25 pm
Location: Seattle, WA

Re: Why is system clock not syncing?

Fri Sep 24, 2021 7:45 pm

OP, do you actually have a timeserver running on IP 192.168.42.250?
Pi tools:
Quickly and easily build customized-just-for-you SSDs/SD Cards: https://github.com/gitbls/sdm
Easily run and manage your network's DHCP/DNS servers on a Pi: https://github.com/gitbls/ndm
Easy and secure strongSwan VPN installer/manager: https://github.com/gitbls/pistrong
Lightweight Virtual VNC Config: https://github.com/gitbls/RPiVNCHowTo

Return to “Beginners”