systemd-networkd-wait-online / stalling and failing

systemd-networkd-wait-online / stalling and failing

  • Written by
    Walter Doekes
  • Published on

systemd-networkd-wait-online.service failing? Maybe it's IPv6.

Do you have a list of failed systemd units that looks like this?

# systemctl list-units --failed
  UNIT                                 LOAD   ACTIVE SUB    DESCRIPTION
● systemd-networkd-wait-online.service loaded failed failed Wait for Network to be Configured

Then that could be due to IPv6 networking not being set up properly.

Check the interfaces list:

# ip -br a
lo               UNKNOWN        127.0.0.1/8 ::1/128
ens18            UP             10.20.30.41/31 fe80::a124:092f:fa18:109e/64
ens19            UP             192.168.1.3/31 fe80::a124:092f:fa15:01d5/64

Proper IPv4 IPs, and only link-local IPs for IPv6? Likely you're not using IPv6 at all here.

The logs have this to say:

# journalctl -u systemd-networkd*service
14:25:58 systemd[1]: Starting Network Configuration...
14:25:58 systemd-networkd[1728946]: ens19: Link UP
14:25:58 systemd-networkd[1728946]: ens19: Gained carrier
14:25:58 systemd-networkd[1728946]: ens18: Link UP
14:25:58 systemd-networkd[1728946]: ens18: Gained carrier
14:25:58 systemd-networkd[1728946]: lo: Link UP
14:25:58 systemd-networkd[1728946]: lo: Gained carrier
14:25:58 systemd-networkd[1728946]: ens19: Gained IPv6LL
14:25:58 systemd-networkd[1728946]: ens18: Gained IPv6LL
14:25:58 systemd-networkd[1728946]: Enumeration completed
14:25:58 systemd[1]: Started Network Configuration.
14:25:58 systemd[1]: Starting Wait for Network to be Configured...
14:27:58 systemd-networkd-wait-online[1728947]: Timeout occurred while waiting for network connectivity.
14:27:58 systemd[1]: systemd-networkd-wait-online.service: Main process exited, code=exited, status=1/FAILURE
14:27:58 systemd[1]: systemd-networkd-wait-online.service: Failed with result 'exit-code'.
14:27:58 systemd[1]: Failed to start Wait for Network to be Configured.
14:41:05 systemd-networkd[1728946]: ens19: Re-configuring with /run/systemd/network/10-netplan-ens19.network
14:41:05 systemd-networkd[1728946]: ens19: DHCPv6 lease lost
14:41:05 systemd-networkd[1728946]: ens18: Re-configuring with /run/systemd/network/10-netplan-ens18.network
14:41:05 systemd-networkd[1728946]: ens18: DHCPv6 lease lost
14:41:05 systemd-networkd[1728946]: ens19: Re-configuring with /run/systemd/network/10-netplan-ens19.network
14:41:05 systemd-networkd[1728946]: ens19: DHCPv6 lease lost
14:41:05 systemd-networkd[1728946]: ens18: Re-configuring with /run/systemd/network/10-netplan-ens18.network
14:41:05 systemd-networkd[1728946]: ens18: DHCPv6 lease lost
14:41:12 systemd[1]: Starting Wait for Network to be Configured...
14:43:12 systemd-networkd-wait-online[1733339]: Timeout occurred while waiting for network connectivity.
14:43:12 systemd[1]: systemd-networkd-wait-online.service: Main process exited, code=exited, status=1/FAILURE
14:43:12 systemd[1]: systemd-networkd-wait-online.service: Failed with result 'exit-code'.
14:43:12 systemd[1]: Failed to start Wait for Network to be Configured.

What's in that 10-netplan-ens18.network?

# cat /run/systemd/network/10-netplan-ens18.network
[Match]
Name=ens18

[Network]
LinkLocalAddressing=ipv6
Address=10.20.30.41/31
DNS=1.1.1.1
DNS=8.8.8.8

[Route]
Destination=0.0.0.0/0
Gateway=10.20.30.40

Again, only IPv4 addresses.

Solution

Add link-local: [ipv4] to the interfaces in the Netplan configuration:

--- a/netplan/01-netcfg.yaml
+++ b/netplan/01-netcfg.yaml
@@ -11,9 +11,11 @@ network:
         addresses:
         - 1.1.1.1
         - 8.8.8.8
+      link-local: [ipv4]
     ens19:
       addresses:
       - 192.168.1.3/31
       routes:
       - to: 192.168.1.0/24
         via: 192.168.1.2
+      link-local: [ipv4]

Now run a netplan apply and observe:

# systemctl restart systemd-networkd-wait-online.service

That succeeds immediately, like it should.

In 10-netplan-ens18.network (and the others), LinkLocalAddressing=ipv6 is now LinkLocalAddressing=ipv4.

And the logs also appear happier:

# journalctl -u systemd-networkd*service
14:54:46 systemd-networkd[1728946]: ens19: Re-configuring with /run/systemd/network/10-netplan-ens19.network
14:54:46 systemd-networkd[1728946]: ens19: DHCPv6 lease lost
14:54:46 systemd-networkd[1728946]: ens18: Re-configuring with /run/systemd/network/10-netplan-ens18.network
14:54:46 systemd-networkd[1728946]: ens18: DHCPv6 lease lost
14:54:46 systemd-networkd[1728946]: ens19: Re-configuring with /run/systemd/network/10-netplan-ens19.network
14:54:46 systemd-networkd[1728946]: ens18: Re-configuring with /run/systemd/network/10-netplan-ens18.network
14:54:52 systemd[1]: Starting Wait for Network to be Configured...
14:54:53 systemd[1]: Finished Wait for Network to be Configured.

Back to overview Newer post: mariadb check table / galera locking Older post: nmap ssl-enum-ciphers / haproxy / tls / no results