root@jammy:~# vi /etc/apt/sources.list
root@jammy:~# apt update && apt install systemd -y
[ ... ]
root@jammy:~# apt-cache policy systemd
systemd:
Installed: 249.11-0ubuntu3.11
Candidate: 249.11-0ubuntu3.11
Version table:
*** 249.11-0ubuntu3.11 500
500 http://archive.ubuntu.com/ubuntu jammy-proposed/main amd64 Packages
100 /var/lib/dpkg/status
249.11-0ubuntu3.10 500
500 http://archive.ubuntu.com/ubuntu jammy-updates/main amd64 Packages
249.11-0ubuntu3.7 500
500 http://security.ubuntu.com/ubuntu jammy-security/main amd64 Packages
249.11-0ubuntu3 500
500 http://archive.ubuntu.com/ubuntu jammy/main amd64 Packages
root@jammy:~# vi /etc/netplan/50-cloud-init.yaml
root@jammy:~# cat /etc/netplan/50-cloud-init.yaml
# This file is generated from information provided by the datasource. Changes
# to it will not persist across an instance reboot. To disable cloud-init's
# network configuration capabilities, write a file
# /etc/cloud/cloud.cfg.d/99-disable-network-config.cfg with the following:
# network: {config: disabled}
network:
version: 2
ethernets:
eth0:
dhcp4: true optional: true
root@jammy:~# netplan generate
root@jammy:~# netplan apply
root@jammy:~# time SYSTEMD_LOG_LEVEL=debug /lib/systemd/systemd-networkd-wait-online --timeout=5
Found link 11
Found link 1
eth0: link is ignored
lo: link is ignored
real 0m0.004s
user 0m0.003s
sys 0m0.000s
root@jammy:~# echo $?
0
I also ran the test from bug 1982218 again to ensure that does not regress:
On the host, I have clean-jammy-amd64, and detached it's default network interface:
I have verified the fix using systemd 249.11-0ubuntu3.11 from jammy-proposed:
Creating a fresh container:
nr@six:~$ lxc launch ubuntu-daily:jammy jammy
Creating jammy
Starting jammy
nr@six:~$ lxc exec jammy bash
Within the container, after enabling -proposed:
root@jammy:~# vi /etc/apt/ sources. list archive. ubuntu. com/ubuntu jammy-proposed/main amd64 Packages dpkg/status 11-0ubuntu3. 10 500 archive. ubuntu. com/ubuntu jammy-updates/main amd64 Packages 11-0ubuntu3. 7 500 security. ubuntu. com/ubuntu jammy-security/main amd64 Packages 11-0ubuntu3 500 archive. ubuntu. com/ubuntu jammy/main amd64 Packages 50-cloud- init.yaml 50-cloud- init.yaml cloud.cfg. d/99-disable- network- config. cfg with the following:
optional: true LOG_LEVEL= debug /lib/systemd/ systemd- networkd- wait-online --timeout=5
root@jammy:~# apt update && apt install systemd -y
[ ... ]
root@jammy:~# apt-cache policy systemd
systemd:
Installed: 249.11-0ubuntu3.11
Candidate: 249.11-0ubuntu3.11
Version table:
*** 249.11-0ubuntu3.11 500
500 http://
100 /var/lib/
249.
500 http://
249.
500 http://
249.
500 http://
root@jammy:~# vi /etc/netplan/
root@jammy:~# cat /etc/netplan/
# This file is generated from information provided by the datasource. Changes
# to it will not persist across an instance reboot. To disable cloud-init's
# network configuration capabilities, write a file
# /etc/cloud/
# network: {config: disabled}
network:
version: 2
ethernets:
eth0:
dhcp4: true
root@jammy:~# netplan generate
root@jammy:~# netplan apply
root@jammy:~# time SYSTEMD_
Found link 11
Found link 1
eth0: link is ignored
lo: link is ignored
real 0m0.004s
user 0m0.003s
sys 0m0.000s
root@jammy:~# echo $?
0
I also ran the test from bug 1982218 again to ensure that does not regress:
On the host, I have clean-jammy-amd64, and detached it's default network interface:
nr@six:~$ virsh detach-interface clean-jammy-amd64 network
Interface detached successfully
Then, in the VM, configure systemd-networkd to use DHCP on all en* interfaces:
nr@clean- jammy-amd64: ~$ apt-cache policy systemd archive. ubuntu. com/ubuntu jammy-proposed/main amd64 Packages dpkg/status 11-0ubuntu3. 10 500 archive. ubuntu. com/ubuntu jammy-updates/main amd64 Packages 11-0ubuntu3. 7 500 security. ubuntu. com/ubuntu jammy-security/main amd64 Packages 11-0ubuntu3 500 archive. ubuntu. com/ubuntu jammy/main amd64 Packages jammy-amd64: ~$ sudo su jammy-amd64: /home/nr# cat > /etc/systemd/ network/ 10-dhcp. network << EOF
systemd:
Installed: 249.11-0ubuntu3.11
Candidate: 249.11-0ubuntu3.11
Version table:
*** 249.11-0ubuntu3.11 500
500 http://
100 /var/lib/
249.
500 http://
249.
500 http://
249.
500 http://
nr@clean-
root@clean-
[Match]
Name=en*
[Network] jammy-amd64: /home/nr# systemctl restart systemd-networkd
DHCP=yes
EOF
root@clean-
Now, back in the host, I attach a network interface without DHCP:
nr@six:~$ virsh attach-interface clean-jammy-amd64 network no-dhcp
Interface attached successfully
In the VM, check that wait-online times out since the interface does not get configured:
root@clean- jammy-amd64: /home/nr# /lib/systemd/ systemd- networkd- wait-online --any --timeout=5 jammy-amd64: /home/nr# networkctl
Timeout occurred while waiting for network connectivity.
root@clean-
IDX LINK TYPE OPERATIONAL SETUP
1 lo loopback carrier unmanaged
3 ens3 ether degraded configuring
2 links listed.
From the host, attach another interface that will get DHCP:
nr@six:~$ virsh attach-interface clean-jammy-amd64 network default
Interface attached successfully
And finally, in the VM, run wait-online again and see that it will exit successfully when the second interface is configured:
root@clean- jammy-amd64: /home/nr# /lib/systemd/ systemd- networkd- wait-online --any --timeout=0 jammy-amd64: /home/nr# networkctl
root@clean-
IDX LINK TYPE OPERATIONAL SETUP
1 lo loopback carrier unmanaged
3 ens3 ether degraded configuring
4 ens9 ether routable configured
3 links listed.