Debian 13 template v13.1-2 and systemd-networkd-wait-online timeouts

vmguy

Member
Feb 13, 2024
18
1
8
I have systemd-networkd-wait-online disabled but I still having those timeout messages.

Code:
Oct 02 06:27:30 deb systemd[1]: Starting apt-daily-upgrade.service - Daily apt upgrade and clean activities...
Oct 02 06:28:00 deb systemd-networkd-wait-online[1563]: Timeout occurred while waiting for network connectivity.
Oct 02 06:28:00 deb apt-helper[1561]: E: Sub-process /lib/systemd/systemd-networkd-wait-online returned an error code (1)
Oct 02 06:28:01 deb systemd[1]: apt-daily-upgrade.service: Deactivated successfully.
Oct 02 06:28:01 deb systemd[1]: Finished apt-daily-upgrade.service - Daily apt upgrade and clean activities.

Code:
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; disabled; preset: disabled)
     Active: inactive (dead)
       Docs: man:systemd-networkd-wait-online.service(8)
 
 
I think the problem is that the apt-daily-upgrade.service does this:
Code:
ExecStartPre=-/usr/lib/apt/apt-helper wait-online
ExecStart=/usr/lib/apt/apt.systemd.daily install

The apt-helper wait-online probably calls systemd-networkd-wait-online, which returns an error.
No idea (at least right now) how to fix that.
 
Ran into the same thing on Debian 13 containers and tracked it down. Picking up from the apt-helper finding above:

The container has two network stacks. ifupdown actually brings up eth0 (from /etc/network/interfaces), but systemd-networkd is also running and manages nothing. networkctl list shows every link as unmanaged. apt's timers run apt-helper wait-online, and when networkd is active that hands off to systemd-networkd-wait-online. That waits for networkd to report a managed link as online, which never happens, so it times out every run.

That's also why disabling the service alone doesn't stick: systemd-networkd.socket can start networkd again. Masking all three fixes it, but only if networkctl list shows every link as unmanaged:

Bash:
systemctl mask --now systemd-networkd.service systemd-networkd.socket systemd-networkd-wait-online.service

Afterwards eth0's address and default route are unchanged, and /usr/lib/apt/apt-helper wait-online returns immediately with exit 0. To undo: systemctl unmask the same three units, then systemctl start systemd-networkd.

I wrote it up in more detail, including a guarded script for doing it across many containers (it rolls back if a container's address or route changes):
https://blinkinglightsclub.hashnode.dev/proxmox-lxc-apt-wait-online-timeout