Max R. P. Grossmann

Max R. P. Grossmann

Fixing a slow start-up of WireGuard in Debian 12

Posted: 2023-06-14 19:55, last updated: 2023-12-02 16:07.

I don't know exactly what changed, but after upgrading from Debian 11 "bullseye" to Debian 12 "bookworm", my WireGuard profiles started only very slowly. Usually, I use the wg-quick@profile.service units, which are enabled so that they start automatically once my system boots.

I debugged this issue by running systemd-analyze blame. This revealed a clear culprit: The unit systemd-networkd-wait-online.service took 2 minutes to start! Looking into the logs using journalctl -bu systemd-networkd-wait-online.service gave me the bad news:

Jun 10 17:12:48 grossmann systemd[1]: Starting systemd-networkd-wait-online.service - Wait for Network to be Configured...
Jun 10 17:14:48 grossmann systemd-networkd-wait-online[839]: Timeout occurred while waiting for network connectivity.
Jun 10 17:14:48 grossmann systemd[1]: systemd-networkd-wait-online.service: Main process exited, code=exited, status=1/FAILURE
Jun 10 17:14:48 grossmann systemd[1]: systemd-networkd-wait-online.service: Failed with result 'exit-code'.
Jun 10 17:14:48 grossmann systemd[1]: Failed to start systemd-networkd-wait-online.service - Wait for Network to be Configured.

Since I use NetworkManager, there is nothing for systemd-networkd-wait-online.service to wait for. It's a superfluous step in the network readiness target. Checking which packages depend on the service (systemctl list-dependencies --reverse systemd-networkd-wait-online.service) confirmed that it was this particular service holding me back.

I solved this issue by simply running systemctl disable systemd-networkd-wait-online.service and a reboot confirmed that this resolved my problems. Note that I did not need to change any units; by disabling this particular part of the target, the other network readiness checks continue to run, just not this one that is unnecessary given my setup.