174

i just installed ubuntu server on my laptop and everything works fine except for the fact that at boot if the laptop is not connected to ethernet or in range of my wi-fi i get this message "A start job is running for wait for network to be configured" that stays for about 2 minutes. I looked up online for solutions and i tried to:

  • Disable network manager
  • Edit timeout settings in /etc/systemd/system.conf
  • Disable systemd.networkd-wait-online.service

None of these solutions worked for me. Any possible fixes?

vlad27
  • 1,841

9 Answers9

185

Don't mask or disable the systemd service.

Edit /etc/netplan/01-netcfg.yaml and add optional: true to any devices that may not always be available.

sudo netplan apply

NOTE: setting all interfaces as optional: true will not work. It will still default to waiting for 120 seconds. Do not mark the ones required for boot (e.g. the one connected to your Wifi or Ethernet network).

William
  • 103
  • 3
user914826
  • 1,867
98

Use

systemctl disable systemd-networkd-wait-online.service

to disable the wait-online service to prevent the system from waiting on a network connection, and use

systemctl mask systemd-networkd-wait-online.service

to prevent the service from starting if requested by another service (the service is symlinked to /dev/null).

fosslinux
  • 3,881
Mr.Ecco
  • 1,013
26

This means systemd-networkd-wait-online.service is hanging. There's a few known bugs with it. Check what services want network-online.target with:

systemctl show -p WantedBy network-online.target

You can disable those services if you want. Otherwise, you may have to mask the service as Mr.Ecco indicated.

24

Masking systemd-networkd-wait-online.service, as suggested in other answers, may help in simple setups but it does not fix the problem. If you mask the service then all other services depending on it will also fail. That means, all services needed to wait until the network is online will fail.

I run into this problem because I use a dynamic fail-over setup for my devices with bonding the wired (e.g. enp9s0) and wireless (e.g. wlp12s0) interface that are used as slaves for the main interface bond0. Exactly the same situation do you have if you use a bridge (br0 with slave interfaces). Only the main interfaces bond0 or br0 will get online but not the slaves so systemd-networkd-wait-online.service will fail on the slaves.

The solution to this problem is to modify the service and ignore the interfaces that are slaves and does not signal to be online. You will find with:

~$ sudo systemctl cat systemd-networkd-wait-online.service | grep --after-context=3 '\[Service\]'
[Service]
Type=oneshot
ExecStart=/lib/systemd/systemd-networkd-wait-online
RemainAfterExit=yes

The program systemd-networkd-wait-online has a parameter to ignore specific interfaces. Check with /lib/systemd/systemd-networkd-wait-online --help. So I make a drop in file to modify the service and ignore the slave interfaces:

~$ sudo systemctl edit systemd-networkd-wait-online.service

In the empty editor insert these statements, of course with your interface names, save them an quit the editor:

[Service]
ExecStart=
ExecStart=/lib/systemd/systemd-networkd-wait-online --ignore=enp9s0 --ignore=wlp12s0 --quiet

The empty ExecStart= is important because it disables the "old" command. You can check for more than one interface (look at the help).

Ingo
  • 341
4

This may not work for everyone, but it worked for me in Ubuntu 18.04 and Ubuntu 20.04.

I use SLAAC for IPv6 IP addresses, but I had dhcp6: yes in my /etc/netplan/01.netplan.yaml file and experienced the 2-minute delay on boot. I changed it to dhcp6: no and the 2-minute wait disappeared, but I still get my SLAAC IP address.

I don't completely understand why. Someone in the future may edit this answer to explain (or confirm?). I believe Netplan is trying to use DHCPv6 to get the IPv6 address and it takes a long time (2 minutes?) to fail before giving up.

Elyrith
  • 53
4

This is an oldie that appears to be resurfacing in 20.10.

Along the same lines as the previous answer, what worked here is adding link-local: [ ] to every interface in /etc/netplan/*.yaml. This overrides the default value of [ ipv6 ] (see man 5 netplan).

Then apply the change (sudo netplan apply), and networkctl -a should show the state of the interfaces as configured rather than configuring. Also, systemctl start systemd-networkd-wait-online returns immediately with success.

This is on a system with disabled IPv6 stack (ipv6.disable_ipv6=1 on the kernel commandline), so the bug appears to be that systemd-networkd-wait-online is waiting in vain for a link-local IPv6 interface to be configured.

zwets
  • 12,770
  • 2
  • 37
  • 46
3

I have a machine with 5 Ethernet ports and besides the first one I used the other four sporadically.

Assigned static IPs to the ones I used more often and added "optional: true" on all others. The boot up does not hang and wait only 2~3 seconds for configuring network services.

Pankaj
  • 303
3

If netplan optional: true doesn't work and you don't want to disable or mask the service, you can change the timeout value.:

in this file:

/lib/systemd/system/systemd-networkd-wait-online.service

add TimeoutStartSec=5sec under the [Service] section, e.g.:

[Service]
Type=oneshot
ExecStart=/lib/systemd/systemd-networkd-wait-online
RemainAfterExit=yes
TimeoutStartSec=5sec
iman
  • 973
2

in my case the offending service were related to ISCSI, and I solved it masking the services as follows:

systemctl mask open-iscsi.service iscsid.service iscsid.socket

This solution works if you don't need to use the services, otherwise you need a working configuration for your ISCSI

maxadamo
  • 162