Talk:Systemd-timesyncd
/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)
- The file is actually used. And yes, systemd-timesyncd service relies on the modified time metadata.
- Hanabishi (talk) 04:05, 5 January 2024 (UTC)
- It is properly described in the man systemd-timesyncd.service(8) § FILES though.
- Hanabishi (talk) 09:04, 6 January 2024 (UTC)
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)
- 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)
- 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)- 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 andsystemd-timesyncd
properly running (withRequiredForOnline=false
). Oliverpool (talk) 13:04, 10 April 2024 (UTC)
- I even have
- 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)- In my case (dropping
RequiredForOnline=false
and adding--any
) does not work: $ systemctl status systemd-networkd-wait-online
- In my case (dropping
- I have a drop-in with
● 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)
- And timesyncd indicates
- 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
inwait-for-only-one-interface.conf
? What doesnetworkctl status
show? — Lahwaacz (talk) 20:57, 17 April 2024 (UTC)- > How did you add
--any
inwait-for-only-one-interface.conf
? - As recommended by https://wiki.archlinux.org/title/Systemd-networkd#systemd-networkd-wait-online, with a
/etc/systemd/system/systemd-networkd-wait-online.service.d/wait-for-only-one-interface.conf
file - > What does
networkctl status
show? - ● Interfaces: 1, 2, 4, 5, 6, 7
- State: routable
- Online state: unknown
- Address: 100.126.227.60 on tailscale0
- 192.168.178.43 on wlan0
- 10.22.8.2 on wg0
- 172.17.0.1 on docker0
- fd7a:115c:a1e0:ab12:4843:cd96:627e:e33c on tailscale0
- 2003:f2:8700:2700:2c2:XXXX:XXX:XXX on wlan0
- fc00:22:8::2 on wg0
- fe80::b73c:741c:633d:e341 on tailscale0
- fe80::2c2:c6ff:fedd:94dd on wlan0
- Gateway: 192.168.178.1 on wlan0
- fe80::3ea6:2fff:fe9f:bf92 on wlan0
- The
Online state: unknown
part is likely due to my VPN config (tailscale + a manually wireguard setup). Oliverpool (talk) 10:30, 2 May 2024 (UTC)
- > How did you add
- Well the service is still waiting for online, it should report something like
Which should be the recommended invocation
The article says this under Configuration:
- Start/enable systemd-timesyncd.service which is available with systemd.
and this under Usage:
- timedatectl set-ntp true
As far as I know these are identical, except start/enable is two commands as opposed to one. So we should choose one or the other?
—This unsigned comment is by DanShearer (talk) 23:12, 30 April 2024. Please sign your posts with ~~~~!
systemctl enable --now
is also just one command. There does not have to be any recommended way. — Lahwaacz (talk) 07:47, 1 May 2024 (UTC)