netplan dhcp interface with no default route causes systemd-networkd-wait-online to hang
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
systemd (Ubuntu) |
Fix Released
|
Medium
|
Unassigned | ||
Bionic |
Fix Released
|
Medium
|
Dan Streetman |
Bug Description
[impact]
systemd-networkd, when configured to use ipv4 dhcp for an interface can hang. This triggers in two known cases:
a) if configured to ignore the dhcp server's route
b) the server provides no route
Then systemd-networkd will hang waiting for the interface's configuration to complete (until it times out).
This delays boot as well as any restart to systemd-networkd.
The fix is backporting upstream commit [1]
[1]: https:/
[test case]
There are two ways to test this.
A) make the system ignore Routes (slightly less realistic but easier to test)
configure an interface using systemd-networkd:
$ cat /etc/systemd/
[Match]
Name=ens7
[Network]
DHCP=ipv4
[DHCP]
UseRoutes=false
then reboot, and check:
$ systemctl status systemd-
● systemd-
Loaded: loaded (/lib/systemd/
Active: failed (Result: exit-code) since Mon 2019-04-08 23:59:26 UTC; 2min 59s ago
[...]
Apr 08 23:57:27 lp1804478 systemd[1]: Starting Wait for Network to be Configured...
Apr 08 23:57:30 lp1804478 systemd-
Apr 08 23:57:30 lp1804478 systemd-
Apr 08 23:59:26 lp1804478 systemd-
Apr 08 23:59:26 lp1804478 systemd[1]: systemd-
Apr 08 23:59:26 lp1804478 systemd[1]: systemd-
Apr 08 23:59:26 lp1804478 systemd[1]: Failed to start Wait for Network to be Configured.
B) Make a dhcp server to not provide rules
Prepare a Ubuntu Bionic Guest under libvirt, e.g. using uvtool:
$ uvt-simplestrea
$ uvt-kvm create --password ubuntu bionic arch=amd64 release=bionic label=daily
Create a isolated network:
$ cat > isolate.xml << EOF
<network>
<name>
<!-- <bridge name='virbriso1' stp='on' delay='0'/> -->
<ip address=
<dhcp>
<range start='
</dhcp>
</ip>
</network>
EOF
$ virsh net-define isolate.xml
$ virsh net-start isolated
Edit the guest and add that network:
$ virsh shutdown bionic
$ virsh edit bionic
#add this:
<interface type='network'>
<source network=
<mac address=
<model type='virtio'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x07' function='0x0'/>
</interface>
In the guest make the device use DHCP:
Add this to /etc/netplan/
ens7:
dhcp4: true
match:
$ sudo netplan apply
When rebooting the guest again it will fail
● systemd-
Loaded: loaded (/lib/systemd/
Active: failed (Result: exit-code) since Tue 2019-04-09 07:07:48 UTC; 1min 41s ago
Docs: man:systemd-
Process: 563 ExecStart=
Main PID: 563 (code=exited, status=1/FAILURE)
Apr 09 07:05:48 bionic-dgx2 systemd[1]: Starting Wait for Network to be Configured...
Apr 09 07:05:50 bionic-dgx2 systemd-
Apr 09 07:07:48 bionic-dgx2 systemd-
Apr 09 07:07:48 bionic-dgx2 systemd[1]: systemd-
Apr 09 07:07:48 bionic-dgx2 systemd[1]: systemd-
Apr 09 07:07:48 bionic-dgx2 systemd[1]: Failed to start Wait for Network to be Configured.
When working cases A and B will both have the service starting fast and happy.
$ sudo systemctl status systemd-
Active: active (exited) since Tue 2019-04-09 07:17:16 UTC; 12s ago
[...]
Apr 09 07:17:16 bionic-dgx2 systemd-
[...]
Apr 09 07:17:16 bionic-dgx2 systemd-
[regression potential]
this alters how systemd-networkd works when it starts or restarts, specifically how it handles dhcp4; regressions would be around setting up interface(s) using dhcpv4, possibly failing to correctly configure dhcpv4 interface(s) or even failing internal assertions and exiting.
The problem is that without a route there will be no netlink even t that can be tapped.
But the change is only a 4 line change that does explicitly link->dhcp4_
Therefore the change seems rather small, reviewable and safe.
[other info]
original description:
--
root cause in systemd bug fixed in Commit
223932c786ada7f
https:/
Environment:
Ubuntu 18.04 LTS amd64
systemd package version 237-3ubuntu10.9
How to trigger:
1. add netplan interface with dhcpv4 client enabled:
enp0s8:
dhcp4: true
2. configure dhcp server to NOT give a default route, or any route for that matter
3. reboot
4. systemd-
root@sensor1:~# /lib/systemd/
Event loop failed: Connection timed out
root@sensor1:~# /lib/systemd/
managing: enp0s3
ignoring: lo
ignoring: enp0s8
How to fix:
Backport upstream changes from systemd (see related systemd ticket).
summary: |
- netplan dhcp interface with no default route causes causes systemd- - networkd-wait-online to hang + netplan dhcp interface with no default route causes systemd-networkd- + wait-online to hang |
Changed in systemd: | |
status: | New → Fix Released |
description: | updated |
description: | updated |
Changed in systemd (Ubuntu): | |
status: | Confirmed → Triaged |
Changed in systemd (Ubuntu Bionic): | |
status: | New → Confirmed |
description: | updated |
Changed in systemd (Ubuntu Bionic): | |
assignee: | nobody → Dan Streetman (ddstreet) |
importance: | Undecided → Medium |
status: | Confirmed → In Progress |
Changed in systemd (Ubuntu): | |
status: | Triaged → Fix Released |
description: | updated |
description: | updated |
Changed in systemd: | |
importance: | Undecided → Unknown |
status: | Fix Released → Unknown |
affects: | systemd → ubuntu-translations |
Changed in ubuntu-translations: | |
importance: | Unknown → Undecided |
status: | Unknown → New |
no longer affects: | ubuntu-translations |
Changed in systemd (Ubuntu): | |
importance: | Undecided → Medium |
Status changed to 'Confirmed' because the bug affects multiple users.