Is there a way different from restart the systemd-timesyncd service to know the synchronization status between the client and the NTP server?
0
votes
1
answer
75
views
On my Linux distribution I'm using the NTP client
systemd-timesyncd
.
### Test case ###
The test case is:
1. Boot while the system is able to reach the NTP server (that is time1.google.com
) by a connection to a Wi-Fi network.
2. systemd-timesyncd
is able to synchronize to the server as we can see by this log on journald:
Jun 03 10:38:24 systemd-timesyncd: Initial synchronization to time server 216.239.35.0:123 (time1.google.com).
3. Disconnection of the system from the Wi-Fi network: the NTP server is no longer reachable.
4. systemd-timesyncd
does not give any warning that the server is unreachable.
### Workaround: restart the service ###
To know that the server is not reachable I need to restart the systemd-timesyncd
service. After the restart of the service, the file /run/systemd/timesync/synchronized
is not present so I can programmatically know that the NTP server is not reachable.
Without the restart the file /run/systemd/timesync/synchronized
is still present so it seems that client and server are synchronized.
**NOTE**: also after the restart in the journald of the service systemd-timesyncd
does not appear any log about the fact that the NTP server time1.google.com
is not reachable.
### Question ###
There is an other way than restart the systemd-timesyncd
service to know the synchronization status between the client and the server NTP?
---
**EDIT**
After the step number 4 described in the post, it is not possible to see by timedatectl status
that systemd-timesyncd
is not synchronized to the server. Below there is the output of the timedatectl
command:
> timedatectl status
Local time: Tue 2025-06-03 12:02:30 CEST
Universal time: Tue 2025-06-03 10:02:30 UTC
RTC time: Tue 2025-06-03 10:02:29
Time zone: Europe/Rome (CEST, +0200)
System clock synchronized: yes
NTP service: active
RTC in local TZ: no
Asked by User051209
(498 rep)
Jun 3, 2025, 09:07 AM
Last activity: Jun 3, 2025, 12:21 PM
Last activity: Jun 3, 2025, 12:21 PM