Public bug reported:

On the Ubuntu 26.04 LTS Raspberry Pi 5 desktop image, systemd-timesyncd
never syncs the clock: `timedatectl timesync-status` shows `Server:
n/a`, `Packet count: 0` indefinitely, and `timedatectl` reports `System
clock synchronized: no` for days. Since the Pi 5 RTC starts at epoch
after power loss (no backup battery by default), the wall clock ends up
minutes wrong within days of uptime and drifts freely. Observed impact:
Prometheus flagged a 5-minute skew between server and browser after ~4
days.

Root cause — the initramfs and the rootfs use different network
managers, and the handoff leaves stale state behind:

1. The Pi initramfs is built with dracut, and ubuntu-raspi-settings ships 
/etc/dracut.conf.d/10-raspi-net.conf, which installs .link files into the 
initrd; dracut's network stack brings systemd-networkd along.
2. systemd-networkd starts inside the initrd, begins configuring eth0 (via 
/run/systemd/network/zzzz-dracut-default.network), and is stopped at 
switch-root — before eth0 gains carrier. Its final write to 
/run/systemd/netif/state is:

   OPER_STATE=no-carrier
   CARRIER_STATE=no-carrier
   ADDRESS_STATE=off
   IPV4_ADDRESS_STATE=off
   IPV6_ADDRESS_STATE=off
   ONLINE_STATE=offline

3. /run survives switch-root. In the real root, NetworkManager manages the 
network and systemd-networkd is disabled, so nothing ever updates or removes 
that file.
4. systemd-timesyncd's online check trusts the stale file, concludes the 
machine is permanently offline, and never sends a single NTP packet. No error 
is logged; the service looks healthy.

Deleting /run/systemd/netif/state and restarting systemd-timesyncd makes
it sync immediately (it stepped the clock +5min 4.5s). The file is
recreated by the initrd on every boot, so the failure is persistent
across reboots.

This was first reported upstream and closed as a downstream integration issue:
https://github.com/systemd/systemd/issues/43016
Upstream maintainer response, in short: the distro should not switch networking 
solutions halfway through boot — use one, the other, or both in parallel, but 
not a partial transition that strands state.

Workaround (confirmed working): a tmpfiles.d entry removing the stale file at 
boot:
  # /etc/tmpfiles.d/remove-stale-netif-state.conf
  r! /run/systemd/netif/state

Possible proper fixes downstream:
- Don't start systemd-networkd in the initrd on images whose rootfs uses 
NetworkManager (the .link files are applied by udev and shouldn't need the full 
networkd service), or
- Clear /run/systemd/netif/ during the initrd-to-rootfs transition when 
systemd-networkd is not enabled on the host, or
- Align the initrd and rootfs on the same network manager, per upstream's 
recommendation.

Affected versions:
- Ubuntu 26.04 LTS (Raspberry Pi 5 Model B Rev 1.0, desktop image)
- ubuntu-raspi-settings 26.04.2
- dracut 110-11
- systemd 259.5-0ubuntu3
- network-manager 1.54.3-2ubuntu3
- kernel 7.0.0-1014-raspi

Reproduce:
1. Boot the Pi 5 desktop image (NetworkManager-managed rootfs, dracut initrd 
with networkd).
2. cat /run/systemd/netif/state  → ONLINE_STATE=offline despite the network 
being fully up.
3. timedatectl timesync-status   → Packet count: 0, forever.

** Affects: ubuntu-raspi-settings (Ubuntu)
     Importance: Undecided
         Status: New

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/2160661

Title:
  systemd-timesyncd never syncs on Pi images: stale
  /run/systemd/netif/state (ONLINE_STATE=offline) left by initrd-only
  systemd-networkd

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/ubuntu-raspi-settings/+bug/2160661/+subscriptions


-- 
ubuntu-bugs mailing list
[email protected]
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to