NTP service allways changes to inactive

Hello,

I got following issue. My openhab loses the NTP synchronization. I have NTP binding installed and configured.

On commandline I active NTP via:
sudo timedatectl set-ntp true

Afterwards via timedatectl the clock is synchronized, but after a few hours the clocked is unsynchronized and the status changes to inactive.

In /etc/system/timesyncd.conf the same NTP server is configured as in the NTP binding in OH.

Do have a idea what I can change that the my PI stays synchronized?

HW: Rasp Pi 3B+
OH Version: OH 3.2.0 Release Build

What is the output of

sudo systemctl status systemd-timesyncd

when the time is not synchronized any longer ?

Hi Wolfgang,

the service seems to stopped at somepoint. Here is the output:

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: failed (Result: start-limit-hit) since Tue 2022-06-21 03:05:57 CEST; 4h 17min ago
     Docs: man:systemd-timesyncd.service(8)
  Process: 1658 ExecStart=/lib/systemd/systemd-timesyncd (code=exited, status=0/SUCCESS)
 Main PID: 1658 (code=exited, status=0/SUCCESS)
   Status: "Shutting down..."

Jun 21 03:05:56 openhab3 systemd[1]: Starting Network Time Synchronization...
Jun 21 03:05:56 openhab3 systemd[1]: Started Network Time Synchronization.
Jun 21 03:05:56 openhab3 systemd-timesyncd[1658]: Synchronized to time server for the first time Jun 21 03:05:57 openhab3 systemd[1]: Stopping Network Time Synchronization...
Jun 21 03:05:57 openhab3 systemd[1]: systemd-timesyncd.service: Succeeded.
Jun 21 03:05:57 openhab3 systemd[1]: Stopped Network Time Synchronization.
Jun 21 03:05:57 openhab3 systemd[1]: systemd-timesyncd.service: Start request repeated too quickly.
Jun 21 03:05:57 openhab3 systemd[1]: systemd-timesyncd.service: Failed with result 'start-limit-hit'.
Jun 21 03:05:57 openhab3 systemd[1]: Failed to start Network Time Synchronization.

Service stopped with this message

What is the output of

sudo journalctl -u systemd-timesyncd

The output points to the same issue:

Jun 21 03:05:52 openhab3 systemd-timesyncd[1621]: Synchronized to time server for the first time [xx.xx.xx.xx]:123 (fritz.box).
Jun 21 03:05:53 openhab3 systemd[1]: Stopping Network Time Synchronization...
Jun 21 03:05:53 openhab3 systemd[1]: systemd-timesyncd.service: Succeeded.
Jun 21 03:05:53 openhab3 systemd[1]: Stopped Network Time Synchronization.
Jun 21 03:05:53 openhab3 systemd[1]: Starting Network Time Synchronization...
Jun 21 03:05:53 openhab3 systemd[1]: Started Network Time Synchronization.
Jun 21 03:05:53 openhab3 systemd-timesyncd[1641]: Synchronized to time server for the first time [xx.xx.xx.xx]:123 (fritz.box).
Jun 21 03:05:56 openhab3 systemd[1]: Stopping Network Time Synchronization...
Jun 21 03:05:56 openhab3 systemd[1]: systemd-timesyncd.service: Succeeded.
Jun 21 03:05:56 openhab3 systemd[1]: Stopped Network Time Synchronization.
Jun 21 03:05:56 openhab3 systemd[1]: Starting Network Time Synchronization...
Jun 21 03:05:56 openhab3 systemd[1]: Started Network Time Synchronization.
Jun 21 03:05:56 openhab3 systemd-timesyncd[1658]: Synchronized to time server for the first time [xx.xx.xx.xx]:123 (fritz.box).
Jun 21 03:05:57 openhab3 systemd[1]: Stopping Network Time Synchronization...
Jun 21 03:05:57 openhab3 systemd[1]: systemd-timesyncd.service: Succeeded.
Jun 21 03:05:57 openhab3 systemd[1]: Stopped Network Time Synchronization.
Jun 21 03:05:57 openhab3 systemd[1]: systemd-timesyncd.service: Start request repeated too quickly.
Jun 21 03:05:57 openhab3 systemd[1]: systemd-timesyncd.service: Failed with result 'start-limit-hit'.
Jun 21 03:05:57 openhab3 systemd[1]: Failed to start Network Time Synchronization.
Jun 21 07:26:21 openhab3 systemd[1]: Starting Network Time Synchronization...
Jun 21 07:26:21 openhab3 systemd[1]: Started Network Time Synchronization.
Jun 21 07:26:21 openhab3 systemd-timesyncd[12984]: Synchronized to time server for the first time [xx.xx.xx.xx]:123 (fritz.box).
Jun 21 07:32:55 openhab3 systemd[1]: Stopping Network Time Synchronization...
Jun 21 07:32:55 openhab3 systemd[1]: systemd-timesyncd.service: Succeeded.
Jun 21 07:32:55 openhab3 systemd[1]: Stopped Network Time Synchronization.
Jun 21 07:32:55 openhab3 systemd[1]: Starting Network Time Synchronization...
Jun 21 07:32:55 openhab3 systemd[1]: Started Network Time Synchronization.
Jun 21 07:32:55 openhab3 systemd-timesyncd[13245]: Synchronized to time server for the first time [xx.xx.xx.xx]:123 (fritz.box).
Jun 21 07:32:55 openhab3 systemd[1]: Stopping Network Time Synchronization...
Jun 21 07:32:55 openhab3 systemd[1]: systemd-timesyncd.service: Succeeded.
Jun 21 07:32:55 openhab3 systemd[1]: Stopped Network Time Synchronization.
Jun 21 07:32:55 openhab3 systemd[1]: Starting Network Time Synchronization...
Jun 21 07:32:55 openhab3 systemd[1]: Started Network Time Synchronization.
Jun 21 07:32:56 openhab3 systemd-timesyncd[13264]: Synchronized to time server for the first time [xx.xx.xx.xx]:123 (fritz.box).
Jun 21 07:37:58 openhab3 systemd[1]: Stopping Network Time Synchronization...
Jun 21 07:37:58 openhab3 systemd[1]: systemd-timesyncd.service: Succeeded.
Jun 21 07:37:58 openhab3 systemd[1]: Stopped Network Time Synchronization.
Jun 21 07:37:58 openhab3 systemd[1]: Starting Network Time Synchronization...
Jun 21 07:37:58 openhab3 systemd[1]: Started Network Time Synchronization.
Jun 21 07:37:58 openhab3 systemd-timesyncd[13463]: Synchronized to time server for the first time [xx.xx.xx.xx]:123 (fritz.box).
Jun 21 07:37:58 openhab3 systemd[1]: Stopping Network Time Synchronization...
Jun 21 07:37:58 openhab3 systemd[1]: systemd-timesyncd.service: Succeeded.
Jun 21 07:37:58 openhab3 systemd[1]: Stopped Network Time Synchronization.
Jun 21 07:37:58 openhab3 systemd[1]: Starting Network Time Synchronization...
Jun 21 07:37:59 openhab3 systemd[1]: Started Network Time Synchronization.
Jun 21 07:37:59 openhab3 systemd-timesyncd[13482]: Synchronized to time server for the first time [xx.xx.xx.xx]:123 (fritz.box).
Jun 21 07:46:37 openhab3 systemd[1]: Stopping Network Time Synchronization...
Jun 21 07:46:37 openhab3 systemd[1]: systemd-timesyncd.service: Succeeded.
Jun 21 07:46:37 openhab3 systemd[1]: Stopped Network Time Synchronization.
Jun 21 07:46:37 openhab3 systemd[1]: Starting Network Time Synchronization...
Jun 21 07:46:37 openhab3 systemd[1]: Started Network Time Synchronization.
Jun 21 07:46:37 openhab3 systemd-timesyncd[13808]: Synchronized to time server for the first time [xx.xx.xx.xx]:123 (fritz.box).
Jun 21 07:46:37 openhab3 systemd[1]: Stopping Network Time Synchronization...
Jun 21 07:46:37 openhab3 systemd[1]: systemd-timesyncd.service: Succeeded.
Jun 21 07:46:37 openhab3 systemd[1]: Stopped Network Time Synchronization.
Jun 21 07:46:38 openhab3 systemd[1]: Starting Network Time Synchronization...
Jun 21 07:46:38 openhab3 systemd[1]: Started Network Time Synchronization.
Jun 21 07:46:38 openhab3 systemd-timesyncd[13828]: Synchronized to time server for the first time [xx.xx.xx.xx]:123 (fritz.box).
Jun 21 07:52:58 openhab3 systemd[1]: Stopping Network Time Synchronization...
Jun 21 07:52:58 openhab3 systemd[1]: systemd-timesyncd.service: Succeeded.
Jun 21 07:52:58 openhab3 systemd[1]: Stopped Network Time Synchronization.
Jun 21 07:52:58 openhab3 systemd[1]: Starting Network Time Synchronization...
Jun 21 07:52:58 openhab3 systemd[1]: Started Network Time Synchronization.
Jun 21 07:52:58 openhab3 systemd-timesyncd[14070]: Synchronized to time server for the first time [xx.xx.xx.xx]:123 (fritz.box).
Jun 21 07:52:59 openhab3 systemd[1]: Stopping Network Time Synchronization...
Jun 21 07:52:59 openhab3 systemd[1]: systemd-timesyncd.service: Succeeded.
Jun 21 07:52:59 openhab3 systemd[1]: Stopped Network Time Synchronization.
Jun 21 07:52:59 openhab3 systemd[1]: Starting Network Time Synchronization...
Jun 21 07:52:59 openhab3 systemd[1]: Started Network Time Synchronization.
Jun 21 07:52:59 openhab3 systemd-timesyncd[14089]: Synchronized to time server for the first time [xx.xx.xx.xx]:123 (fritz.box).
Jun 21 08:01:21 openhab3 systemd[1]: Stopping Network Time Synchronization...
Jun 21 08:01:21 openhab3 systemd[1]: systemd-timesyncd.service: Succeeded.
Jun 21 08:01:21 openhab3 systemd[1]: Stopped Network Time Synchronization.
Jun 21 08:01:21 openhab3 systemd[1]: Starting Network Time Synchronization...
Jun 21 08:01:21 openhab3 systemd[1]: Started Network Time Synchronization.
Jun 21 08:01:21 openhab3 systemd-timesyncd[14404]: Synchronized to time server for the first time [xx.xx.xx.xx]:123 (fritz.box).
Jun 21 08:01:21 openhab3 systemd[1]: Stopping Network Time Synchronization...
Jun 21 08:01:21 openhab3 systemd[1]: systemd-timesyncd.service: Succeeded.
Jun 21 08:01:21 openhab3 systemd[1]: Stopped Network Time Synchronization.
Jun 21 08:01:21 openhab3 systemd[1]: Starting Network Time Synchronization...
Jun 21 08:01:22 openhab3 systemd[1]: Started Network Time Synchronization.
Jun 21 08:01:22 openhab3 systemd-timesyncd[14425]: Synchronized to time server for the first time [xx.xx.xx.xx]:123 (fritz.box).
Jun 21 08:05:59 openhab3 systemd[1]: Stopping Network Time Synchronization...
Jun 21 08:05:59 openhab3 systemd[1]: systemd-timesyncd.service: Succeeded.
Jun 21 08:05:59 openhab3 systemd[1]: Stopped Network Time Synchronization.
Jun 21 08:05:59 openhab3 systemd[1]: Starting Network Time Synchronization...
Jun 21 08:06:00 openhab3 systemd[1]: Started Network Time Synchronization.
Jun 21 08:06:00 openhab3 systemd-timesyncd[14603]: Synchronized to time server for the first time [xx.xx.xx.xx]:123 (fritz.box).
Jun 21 08:06:00 openhab3 systemd[1]: Stopping Network Time Synchronization...
Jun 21 08:06:00 openhab3 systemd[1]: systemd-timesyncd.service: Succeeded.
Jun 21 08:06:00 openhab3 systemd[1]: Stopped Network Time Synchronization.
Jun 21 08:06:01 openhab3 systemd[1]: Starting Network Time Synchronization...
Jun 21 08:06:01 openhab3 systemd[1]: Started Network Time Synchronization.
Jun 21 08:06:01 openhab3 systemd-timesyncd[14623]: Synchronized to time server for the first time [xx.xx.xx.xx]:123 (fritz.box).
Jun 21 08:06:03 openhab3 systemd[1]: Stopping Network Time Synchronization...
Jun 21 08:06:03 openhab3 systemd[1]: systemd-timesyncd.service: Succeeded.
Jun 21 08:06:03 openhab3 systemd[1]: Stopped Network Time Synchronization.
Jun 21 08:06:03 openhab3 systemd[1]: Starting Network Time Synchronization...
Jun 21 08:06:04 openhab3 systemd[1]: Started Network Time Synchronization.
Jun 21 08:06:04 openhab3 systemd-timesyncd[14639]: Synchronized to time server for the first time [xx.xx.xx.xx]:123 (fritz.box).
Jun 21 08:06:04 openhab3 systemd[1]: Stopping Network Time Synchronization...
Jun 21 08:06:04 openhab3 systemd[1]: systemd-timesyncd.service: Succeeded.
Jun 21 08:06:04 openhab3 systemd[1]: Stopped Network Time Synchronization.
Jun 21 08:06:04 openhab3 systemd[1]: Starting Network Time Synchronization...
Jun 21 08:06:04 openhab3 systemd[1]: Started Network Time Synchronization.
Jun 21 08:06:04 openhab3 systemd-timesyncd[14658]: Synchronized to time server for the first time [xx.xx.xx.xx]:123 (fritz.box).
Jun 21 08:06:07 openhab3 systemd[1]: Stopping Network Time Synchronization...
Jun 21 08:06:07 openhab3 systemd[1]: systemd-timesyncd.service: Succeeded.
Jun 21 08:06:07 openhab3 systemd[1]: Stopped Network Time Synchronization.
Jun 21 08:06:07 openhab3 systemd[1]: Starting Network Time Synchronization...
Jun 21 08:06:08 openhab3 systemd[1]: Started Network Time Synchronization.
Jun 21 08:06:08 openhab3 systemd-timesyncd[14678]: Synchronized to time server for the first time [xx.xx.xx.xx]:123 (fritz.box).
Jun 21 08:06:08 openhab3 systemd[1]: Stopping Network Time Synchronization...
Jun 21 08:06:08 openhab3 systemd[1]: systemd-timesyncd.service: Succeeded.
Jun 21 08:06:08 openhab3 systemd[1]: Stopped Network Time Synchronization.
Jun 21 08:06:08 openhab3 systemd[1]: systemd-timesyncd.service: Start request repeated too quickly.
Jun 21 08:06:08 openhab3 systemd[1]: systemd-timesyncd.service: Failed with result 'start-limit-hit'.
Jun 21 08:06:08 openhab3 systemd[1]: Failed to start Network Time Synchronization.

Any idea why it failed?

Is there a directory that is called /var/lib/systemd/timesync ?

Yes the directory exist with an empty clock file

ok.
One last ( for the moment ) idea:

ls -ld /var/*/systemd/timesync/* /var/*/systemd/timesync

Here results in

drwxr-xr-x 2 systemd-timesync systemd-timesync 4096 Mar  5  2021 /var/lib/systemd/timesync
-rw-r--r-- 1 systemd-timesync systemd-timesync    0 Jun 21 21:32 /var/lib/systemd/timesync/clock
drwxr-xr-x 2 systemd-timesync systemd-timesync   60 Jun 21 17:00 /var/run/systemd/timesync
-rw-r--r-- 1 systemd-timesync systemd-timesync    0 Jun 21 21:32 /var/run/systemd/timesync/synchronized

My output:

drwxr-xr-x 2 systemd-timesync systemd-timesync 4096 Jan 11  2021 /var/lib/system                         d/timesync
-rw-r--r-- 1 systemd-timesync systemd-timesync    0 Jun 23 15:54 /var/lib/system                         d/timesync/clock