Talk:Systemd-timesyncd

From ArchWiki
Latest comment: Wednesday at 20:57 by Lahwaacz in topic Troubleshooting

/var/lib/systemd/timesync/clock is used even though it is of zero (0) length

Quoting Systemd-timesyncd#Configuration:

Note: The service writes to a local file /var/lib/systemd/timesync/clock with every synchronization.

For me, it is a zero (0) length file. Seems reasonable, but I haven't verified, it is using touch(1), or an equivalent. My point is the file is actually used, even though it is of zero (0) length. No real data is actually stored within it, as someone may naively expect. Not sure it is trivial, or worth pointing out. Is it acceptable to change to:

Note: The service uses the times (touch(1)) of the zero (0) length local file /var/lib/systemd/timesync/clock with every synchronization.

Regid (talk) 02:34, 5 January 2024 (UTC)Reply[reply]

The file is actually used. And yes, systemd-timesyncd service relies on the modified time metadata.
Hanabishi (talk) 04:05, 5 January 2024 (UTC)Reply[reply]
It is properly described in the man systemd-timesyncd.service(8) § FILES though.
Hanabishi (talk) 09:04, 6 January 2024 (UTC)Reply[reply]

Troubleshooting

When a static conf is present (e.g. /etc/systemd/network/eth0.conf) but not connected, systemd-timesyncd will output "No network connectivity, watching for changes." when "systemctl restart systemd-networkd" is executed although some other interface might be online.

Adding the following block to the network conf fixes the issue:

[Link]

RequiredForOnline=false

Source: https://www.reddit.com/r/archlinux/comments/q14yl2/systemdtimesyncd_no_network_connectivity/

Should I add a "Troublehshooting" section to the wiki page? Oliverpool (talk) 09:23, 8 April 2024 (UTC)Reply[reply]

Ideally, we'd handle the expansion template in Systemd-networkd#systemd-networkd-wait-online first. Then a troubleshooting item from this can point to it. I write this, because the waiting of systemd-timesyncd was discussed in this issue. Also, keep in mind setting it to "false" can have various side effects for other network services (maybe not on your system, but others). You don't want to fix ntp and break something else more important. --Indigo (talk) 19:48, 9 April 2024 (UTC)Reply[reply]
This sounds like the issue that is already described in systemd-networkd#systemd-networkd-wait-online. Use a drop-in with --any so that the network is considered online when any, instead of all, of the network connections reach the desired state. nl6720 (talk) 12:12, 10 April 2024 (UTC)Reply[reply]
Thanks for the reply!
Note that the systemd-timesyncd service does not depend on systemd-networkd-wait-online:
$ systemctl list-dependencies systemd-timesyncd -all
systemd-timesyncd.service
::● ├─-.mount
::● │ └─-.slice
::● ├─system.slice
::● │ └─-.slice
::● ├─tmp.mount
::● │ ├─-.mount
::● │ │ └─-.slice
::● │ └─system.slice
::● │   └─-.slice
::● └─time-set.target
I even have systemd-networkd-wait-online.service in a failed state and systemd-timesyncd properly running (with RequiredForOnline=false). Oliverpool (talk) 13:04, 10 April 2024 (UTC)Reply[reply]
I have a drop-in with --any according to systemd-networkd#systemd-networkd-wait-online and did not observe any problem with systemd-timesyncd either... — Lahwaacz (talk) 15:03, 14 April 2024 (UTC)Reply[reply]
In my case (dropping RequiredForOnline=false and adding --any) does not work:
$ systemctl status systemd-networkd-wait-online
● systemd-networkd-wait-online.service - Wait for Network to be Configured
::::     Loaded: loaded (/usr/lib/systemd/system/systemd-networkd-wait-online.service; enabled; preset: enabled)
::::    Drop-In: /etc/systemd/system/systemd-networkd-wait-online.service.d
::::             └─wait-for-only-one-interface.conf
::::     Active: activating (start) since Mon 2024-04-15 10:47:10 CEST; 1min 14s ago
::::       Docs: man:systemd-networkd-wait-online.service(8)
::::   Main PID: 27408 (systemd-network)
::::      Tasks: 1 (limit: 38352)
::::     Memory: 1.0M (peak: 1.3M)
::::        CPU: 5ms
::::     CGroup: /system.slice/systemd-networkd-wait-online.service
::::             └─27408 /usr/lib/systemd/systemd-networkd-wait-online --any
::::Apr 15 10:47:10 computer systemd[1]: Starting Wait for Network to be Configured...
::::
And timesyncd indicates No network connectivity, watching for changes Oliverpool (talk) 08:52, 15 April 2024 (UTC)Reply[reply]
Well the service is still waiting for online, it should report something like
Apr 15 10:47:10 computer systemd[1]: Starting Wait for Network to be Configured...
Apr 15 10:47:10 computer systemd[1]: Finished Wait for Network to be Configured.
How did you add --any in wait-for-only-one-interface.conf? What does networkctl status show? — Lahwaacz (talk) 20:57, 17 April 2024 (UTC)Reply[reply]