systemd icon indicating copy to clipboard operation
systemd copied to clipboard

timesyncd silent and nonfunctional when /run/systemd/netif/state isn't updated

Open half-duplex opened this issue 1 month ago • 0 comments

systemd version the issue has been seen with

systemd-257.10, systemd-258.2

Used distribution

NixOS 25.05, 25.11

Linux kernel version used

6.12.56-hardened1

CPU architectures issue was seen on

aarch64

Component

systemd-timesync

Expected behaviour you didn't see

  1. systemd-timesyncd.service should start and sync the system time, even when the network wasn't configured with systemd-networkd/etc
  2. Failing that, timedatectl should report why the time isn't being synced. Failing that, timesyncd logs should have information about why it isn't syncing. Failing that, timesyncd logs with SYSTEMD_LOG_LEVEL=debug should have information about why it isn't syncing.

Unexpected behaviour you saw

systemd-timesyncd.service starts, but the system time remains incorrect. timedatectl timesync-status reports "Server: n/a (n/a)", and the systemd-timesyncd.service logs have nothing useful even with SYSTEMD_LOG_LEVEL=debug.

I had to resort to strace to eventually find /run/systemd/netif/state. Replacing its original contents:

# This is private data. Do not parse.
OPER_STATE=off
CARRIER_STATE=off
ADDRESS_STATE=off
IPV4_ADDRESS_STATE=off
IPV6_ADDRESS_STATE=off

with:

# This is private data. Do not parse.
OPER_STATE=routable
CARRIER_STATE=carrier
ADDRESS_STATE=routable
IPV4_ADDRESS_STATE=routable
IPV6_ADDRESS_STATE=routable
ONLINE_STATE=online
DNS=10.0.0.1 fe80::redacted

allowed me to restart systemd-timesyncd.service and have it work.

Steps to reproduce the problem

  • Have a Linux install with no network management daemon (no systemd-networkd, NetworkManager, etc). For me, this is NixOS 25.11 with no gui and no particular network configuration, which causes it to use dhcpcd.service
  • Optional: Have an incorrect RTC or no RTC, to make the problem obvious
  • Boot the system
  • Run date, see that it's wrong if your RTC was
  • Run timedatectl timesync-status, see "Server: n/a (n/a)" and no information about why it's not working
  • Check journalctl for systemd-timesyncd.service logs, find no information

Additional program output to the terminal or log subsystem illustrating the issue

$ timedatectl timesync-status
       Server: n/a (n/a)
Poll interval: 0 (min: 32s; max 34min 8s)
 Packet count: 0

$ timedatectl show-timesync
SystemNTPServers=0.nixos.pool.ntp.org 1.nixos.pool.ntp.org 2.nixos.pool.ntp.org 3.nixos.pool.ntp.org
FallbackNTPServers=0.nixos.pool.ntp.org 1.nixos.pool.ntp.org 2.nixos.pool.ntp.org 3.nixos.pool.ntp.org
RootDistanceMaxUSec=5s
PollIntervalMinUSec=32s
PollIntervalMaxUSec=34min 8s
PollIntervalUSec=0
Frequency=0

## Logs without debug
Dec 04 19:24:25 systemd[1]: Starting Network Time Synchronization...
Dec 04 19:24:26 systemd-timesyncd[19764]: Disabling NSCD because DNSSEC validation is turned off
Dec 04 19:24:26 systemd[1]: Started Network Time Synchronization.

## Logs with debug
Dec 04 19:26:21 systemd[1]: Starting Network Time Synchronization...
Dec 04 19:26:22 systemd-timesyncd[19889]: Successfully touched timestamp file.
Dec 04 19:26:22 systemd-timesyncd[19889]: Bus bus-api-timesync: changing state UNSET → OPENING
Dec 04 19:26:22 systemd-timesyncd[19889]: sd-bus: starting bus bus-api-timesync by connecting to /run/dbus/system_bus_socket...
Dec 04 19:26:22 systemd-timesyncd[19889]: Bus bus-api-timesync: changing state OPENING → AUTHENTICATING
Dec 04 19:26:22 systemd-timesyncd[19889]: Registering bus object implementation for path=/org/freedesktop/timesync1 iface=org.freedesktop.timesync1.Manager
Dec 04 19:26:22 systemd-timesyncd[19889]: Registering bus object implementation for path=/org/freedesktop/LogControl1 iface=org.freedesktop.LogControl1
Dec 04 19:26:22 systemd-timesyncd[19889]: Added new system server 0.nixos.pool.ntp.org.
Dec 04 19:26:22 systemd-timesyncd[19889]: Added new system server 1.nixos.pool.ntp.org.
Dec 04 19:26:22 systemd-timesyncd[19889]: Added new system server 2.nixos.pool.ntp.org.
Dec 04 19:26:22 systemd-timesyncd[19889]: Added new system server 3.nixos.pool.ntp.org.
Dec 04 19:26:22 systemd-timesyncd[19889]: Added new fallback server 0.nixos.pool.ntp.org.
Dec 04 19:26:22 systemd-timesyncd[19889]: Added new fallback server 1.nixos.pool.ntp.org.
Dec 04 19:26:22 systemd-timesyncd[19889]: Added new fallback server 2.nixos.pool.ntp.org.
Dec 04 19:26:22 systemd-timesyncd[19889]: Added new fallback server 3.nixos.pool.ntp.org.
Dec 04 19:26:22 systemd-timesyncd[19889]: Disabling NSCD because DNSSEC validation is turned off
Dec 04 19:26:22 systemd-timesyncd[19889]: systemd-timesyncd running as pid 19889
Dec 04 19:26:22 systemd-timesyncd[19889]: Bus bus-api-timesync: changing state AUTHENTICATING → HELLO
Dec 04 19:26:22 systemd-timesyncd[19889]: Sent message type=method_call sender=n/a destination=org.freedesktop.DBus path=/org/freedesktop/DBus interface=org.freedesktop.DBus member=Hello cookie=1 reply_cookie=0 signature=n/a error-name=n/a error-message=n/a
Dec 04 19:26:22 systemd[1]: Started Network Time Synchronization.
Dec 04 19:26:22 systemd-timesyncd[19889]: Sent message type=method_call sender=n/a destination=org.freedesktop.DBus path=/org/freedesktop/DBus interface=org.freedesktop.DBus member=RequestName cookie=2 reply_cookie=0 signature=su error-name=n/a error-message=n/a
Dec 04 19:26:22 systemd-timesyncd[19889]: Got message type=method_return sender=org.freedesktop.DBus destination=:1.121 path=n/a interface=n/a member=n/a  cookie=1 reply_cookie=1 signature=s error-name=n/a error-message=n/a
Dec 04 19:26:22 systemd-timesyncd[19889]: Bus bus-api-timesync: changing state HELLO → RUNNING
Dec 04 19:26:22 systemd-timesyncd[19889]: Got message type=signal sender=org.freedesktop.DBus.Local destination=n/a path=/org/freedesktop/DBus/Local interface=org.freedesktop.DBus.Local member=Connected  cookie=4294967295 reply_cookie=0 signature=n/a error-name=n/a error-message=n/a
Dec 04 19:26:22 systemd-timesyncd[19889]: Got message type=signal sender=org.freedesktop.DBus destination=:1.121 path=/org/freedesktop/DBus interface=org.freedesktop.DBus member=NameAcquired  cookie=2 reply_cookie=0 signature=s error-name=n/a error-message=n/a
Dec 04 19:26:22 systemd-timesyncd[19889]: Got message type=signal sender=org.freedesktop.DBus destination=:1.121 path=/org/freedesktop/DBus interface=org.freedesktop.DBus member=NameAcquired  cookie=3 reply_cookie=0 signature=s error-name=n/a error-message=n/a
Dec 04 19:26:22 systemd-timesyncd[19889]: Got message type=method_return sender=org.freedesktop.DBus destination=:1.121 path=n/a interface=n/a member=n/a  cookie=4 reply_cookie=2 signature=u error-name=n/a error-message=n/a
Dec 04 19:26:22 systemd-timesyncd[19889]: Successfully acquired requested service name.

half-duplex avatar Dec 04 '25 20:12 half-duplex