Ubuntu – waiting for a start job
On bootup, my new Ubuntu server was stalling for ~2 minutes, while bringing up the network.
The message I saw was ". . . a start job is running for wait for network", which turns out was due to waiting for the 2nd (unused) interface to come up.
Of the 2 interfaces on the box, only one was connected:
ifconfig -s
Iface MTU RX-OK RX-ERR RX-DRP RX-OVR TX-OK TX-ERR TX-DRP TX-OVR Flg
eno1 1500 3127 0 33 0 611 0 0 0 BMRU
enp7s0 1500 0 0 0 0 0 0 0 0 BMU
lo 65536 87 0 0 0 87 0 0 0 LRU
The enp7s0 interface wasn't plugged in, so the networkd process was hanging waiting for an IP address.
Solution was to add optional: true to the enp7s0 netplan configuration.
From the netplan documentation:
optional (bool)
An optional device is not required for booting. Normally, networkd will wait some time for device to become configured before proceeding with booting. However, if a device is marked as optional, networkd will not wait for it. This is only supported by networkd, and the default is false.
Example:
ethernets: eth7: # this is plugged into a test network that is often # down - don't wait for it to come up during boot. dhcp4: true optional: true
As this is only supported by networkd, need to verify that I am in fact, using networkd:
sudo systemctl status systemd-networkd
[sudo] password for tom:
● systemd-networkd.service - Network Service
Loaded: loaded (/lib/systemd/system/systemd-networkd.service; enabled; vendor preset: enabled)
Active: active (running) since Thu 2021-05-03 17:46:16 UTC; 43min ago
TriggeredBy: ● systemd-networkd.socket
Docs: man:systemd-networkd.service(8)
Main PID: 1157 (systemd-network)
Status: "Processing requests…"
Tasks: 1 (limit: 309316)
Memory: 4.3M
CGroup: /system.slice/systemd-networkd.service
└─1157 /lib/systemd/systemd-networkd
May 03 17:46:16 ubuntu-kvm systemd[1]: Starting Network Service...
May 03 17:46:16 ubuntu-kvm systemd-networkd[1157]: Enumeration completed
May 03 17:46:16 ubuntu-kvm systemd[1]: Started Network Service.
May 03 17:46:16 ubuntu-kvm systemd-networkd[1157]: enp7s0: Link UP
May 03 17:46:16 ubuntu-kvm systemd-networkd[1157]: eno1: Link UP
May 03 17:46:21 ubuntu-kvm systemd-networkd[1157]: eno1: Gained carrier
May 03 17:46:21 ubuntu-kvm systemd-networkd[1157]: eno1: DHCPv4 address 192.168.1.15/24 via 192.168.1.1
May 03 17:46:23 ubuntu-kvm systemd-networkd[1157]: eno1: Gained IPv6LL
Modified netplan configuration file /etc/netplan/00-installer-config.yaml:
# This is the network config written by 'subiquity'
network:
ethernets:
eno1:
dhcp4: true
enp7s0:
optional: true
dhcp4: true
version: 2
Once this change was made, boot time was less than 30 seconds.
Reference:
Ubuntu Man Page - netplan http://manpages.ubuntu.com/manpages/cosmic/man5/netplan.5.html