Systemd fails to configure bridged network in LXC container
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
systemd (Ubuntu) |
Invalid
|
Undecided
|
Unassigned |
Bug Description
In all our LXC containers running Bionic Beaver, Eoan Ermine or Focal Fossa, installing the latest systemd package results in losing network configuration.
It is still possible to configure the network "by hand" with /usr/sbin/ip, but of course, the configuration is lost at reboot.
An example is provided, followed by a complete procedure to reproduce the issue.
Affected container distributions
=======
Xenial Xerus systemd 229-4ubuntu21.27: OK, not affected
Bionic Beaver systemd 237-3ubuntu10.38: OK, not affected
Bionic Beaver systemd 237-3ubuntu10.39: BUGGY
Disco Dingo systemd 240-6ubuntu5.8: OK, not affected
Eoan Ermine systemd 242-7ubuntu3.6: OK, not affected
Eoan Ermine systemd 242-7ubuntu3.7: BUGGY
Focal Fossa systemd 244.2-1ubuntu1: BUGGY
Affected hosts
==============
Debian Buster with default 4.19.0-6-amd64, custom 5.3.9, 5.4.8 or 5.4.13 kernel
Ubuntu 16.04 lxc 2.0.8-0ubuntu1~
Example
=======
Example host bridge configuration
-------
1: lo: <LOOPBACK,
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
valid_lft forever preferred_lft forever
inet6 ::1/128 scope host
valid_lft forever preferred_lft forever
2: eth0: <BROADCAST,
link/ether 00:25:90:2b:f1:60 brd ff:ff:ff:ff:ff:ff
3: eth1: <NO-CARRIER,
link/ether 00:25:90:2b:f1:61 brd ff:ff:ff:ff:ff:ff
4: br0: <BROADCAST,
link/ether 00:25:90:2b:f1:60 brd ff:ff:ff:ff:ff:ff
inet 192.168.252.24/24 brd 192.168.252.255 scope global br0
valid_lft forever preferred_lft forever
inet 192.168.193.203/24 brd 192.168.193.255 scope global br0:1
valid_lft forever preferred_lft forever
inet6 fe80::225:
valid_lft forever preferred_lft forever
Example container network configuration
-------
lxc.net.0.type = veth
lxc.net.0.veth.pair = vps525389
lxc.net.0.flags = up
lxc.net.0.link = br0
lxc.net.0.hwaddr = 02:00:00:52:53:89
lxc.net.0.name = eth0
lxc.net.
lxc.net.
Example steps to reproduce, inside the container
-------
root@vps525389:~# lsb_release -rd
Description: Ubuntu 18.04.4 LTS
Release: 18.04
root@vps525389:~# apt-cache policy systemd
systemd:
Installed: 237-3ubuntu10.38
Candidate: 237-3ubuntu10.39
Version table:
237-
500 http://
*** 237-3ubuntu10.38 500
500 http://
100 /var/lib/
237-3ubuntu10 500
500 http://
root@vps525389:~# ip a
1: lo: <LOOPBACK,
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
valid_lft forever preferred_lft forever
inet6 ::1/128 scope host
valid_lft forever preferred_lft forever
1958: eth0@if1959: <BROADCAST,
link/ether 02:00:00:52:53:89 brd ff:ff:ff:ff:ff:ff link-netnsid 0
inet 192.168.252.177/32 brd 255.255.255.255 scope global eth0
valid_lft forever preferred_lft forever
inet6 xxxx:xxxx:
valid_lft forever preferred_lft forever
inet6 xxxx::xx:
valid_lft forever preferred_lft forever
root@vps525389:~# apt install systemd
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following additional packages will be installed:
libnss-systemd libpam-systemd libsystemd0
Suggested packages:
systemd-container policykit-1
The following packages will be upgraded:
libnss-systemd libpam-systemd libsystemd0 systemd
4 upgraded, 0 newly installed, 0 to remove and 1 not upgraded.
Need to get 3330 kB of archives.
After this operation, 7168 B of additional disk space will be used.
Do you want to continue? [Y/n]
Get:1 http://
Get:2 http://
Get:3 http://
Get:4 http://
Fetched 3330 kB in 3s (1274 kB/s)
(Reading database ... 18195 files and directories currently installed.)
Preparing to unpack .../libnss-
Unpacking libnss-
Preparing to unpack .../libpam-
Unpacking libpam-
Preparing to unpack .../systemd_
Unpacking systemd (237-3ubuntu10.39) over (237-3ubuntu10.38) ...
Preparing to unpack .../libsystemd0
Unpacking libsystemd0:amd64 (237-3ubuntu10.39) over (237-3ubuntu10.38) ...
Setting up libsystemd0:amd64 (237-3ubuntu10.39) ...
Setting up systemd (237-3ubuntu10.39) ...
Setting up libnss-
Setting up libpam-
Processing triggers for dbus (1.12.2-1ubuntu1.1) ...
Processing triggers for libc-bin (2.27-3ubuntu1) ...
root@vps525389:~# ip a
1: lo: <LOOPBACK,
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
valid_lft forever preferred_lft forever
inet6 ::1/128 scope host
valid_lft forever preferred_lft forever
1958: eth0@if1959: <BROADCAST,
link/ether 02:00:00:52:53:89 brd ff:ff:ff:ff:ff:ff link-netnsid 0
inet6 fe80::ff:
valid_lft forever preferred_lft forever
Complete procedure to reproduce the issue
=======
It is here assumed that there is a DHCP server available elsewhere on the network.
Set-up
------
1. Install an amd64 Debian Buster (default network install),
2. create a bridge on the host with a static IP and deactivate DHCP, in `/etc/network/
```
# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).
source /etc/network/
# The loopback network interface
auto lo
iface lo inet loopback
## The primary network interface
#allow-hotplug ens18
#iface ens18 inet dhcp
## This is an autoconfigured IPv6 interface
#iface ens18 inet6 auto
iface ens18 inet manual
auto br0
iface br0 inet static
address 192.168.1.168
netmask 255.255.255.0
gateway 192.168.1.220
bridge_ports ens18
```
3. reboot the host,
```bash
reboot
```
4. install lxc and create a bionic amd64 container,
```bash
apt install lxc
lxc-create -t download -n bionic
```
5. on the host, modify the network configuration of the container to use the bridge with a static IP in `/var/lib/
```
# Template used to create this container: /usr/share/
# Parameters passed to the template:
# Template script checksum (SHA-1): 273c51343604eb8
# For additional config options, please look at lxc.container.
# Uncomment the following line to support nesting containers:
#lxc.include = /usr/share/
# (Be aware this has security implications)
# Distribution configuration
lxc.include = /usr/share/
# For Ubuntu 14.04
lxc.mount.entry = /sys/kernel/debug sys/kernel/debug none bind,optional 0 0
lxc.mount.entry = /sys/kernel/
lxc.mount.entry = /sys/fs/pstore sys/fs/pstore none bind,optional 0 0
lxc.mount.entry = mqueue dev/mqueue mqueue rw,relatime,
lxc.arch = linux64
# Container specific configuration
lxc.apparmor.
lxc.apparmor.
lxc.rootfs.path = dir:/var/
lxc.uts.name = bionic
## Network configuration
#lxc.net.0.type = empty
# Network configuration
lxc.net.0.type = veth
lxc.net.0.flags = up
lxc.net.0.link = br0
lxc.net.0.name = eth0
lxc.net.
lxc.net.
```
6. inside the container, install the systemd packages without the bug, and deactivate DHCP in `/etc/netplan/
```bash
lxc-start -n bionic
lxc-attach -n bionic
apt install systemd=
sed -i 's/true/false/' /etc/netplan/
exit
```
7. stop the container.
```bash
lxc-stop -n bionic
```
Let’s do it
-----------
1. Start the container and check the IP config, which should be ok,
```bash
lxc-start -n bionic
lxc-attach -n bionic
ip a
```
2. upgrade the system and check the IP config, the static IP is gone.
```bash
apt upgrade
ip a
exit
```
If systemd is downgraded again to 237-3ubuntu10.38, the IP is back at the next reboot of the container.
description: | updated |
description: | updated |
description: | updated |
description: | updated |
description: | updated |
description: | updated |
description: | updated |
description: | updated |
description: | updated |
description: | updated |
description: | updated |
description: | updated |
description: | updated |
description: | updated |
description: | updated |
description: | updated |
description: | updated |
description: | updated |
description: | updated |
description: | updated |
description: | updated |
description: | updated |
description: | updated |
I can't reproduce your error:
ubuntu@ lp1863873- b:~$ dpkg -l systemd|grep ii lp1863873- b:~$ ip a UP,LOWER_ UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000 MULTICAST, UP,LOWER_ UP> mtu 1500 qdisc noqueue state UP group default qlen 1000 3eff:fe40: f5e0/64 scope link lp1863873- b:~$ sudo apt upgrade archive. ubuntu. com/ubuntu bionic-updates/main amd64 libnss-systemd amd64 237-3ubuntu10.39 [104 kB] archive. ubuntu. com/ubuntu bionic-updates/main amd64 libsystemd0 amd64 237-3ubuntu10.39 [206 kB] archive. ubuntu. com/ubuntu bionic-updates/main amd64 libpam-systemd amd64 237-3ubuntu10.39 [107 kB] archive. ubuntu. com/ubuntu bionic-updates/main amd64 systemd amd64 237-3ubuntu10.39 [2912 kB] archive. ubuntu. com/ubuntu bionic-updates/main amd64 udev amd64 237-3ubuntu10.39 [1102 kB] archive. ubuntu. com/ubuntu bionic-updates/main amd64 libudev1 amd64 237-3ubuntu10.39 [56.1 kB] archive. ubuntu. com/ubuntu bionic-updates/main amd64 systemd-sysv amd64 237-3ubuntu10.39 [13.9 kB] systemd_ 237-3ubuntu10. 39_amd64. deb ... systemd: amd64 (237-3ubuntu10.39) over (237-3ubuntu10.38) ... _237-3ubuntu10. 39_amd64. deb ... systemd_ 237-3ubuntu10. 39_amd64. deb ... systemd: amd64 (237-3ubuntu10.39) over (237-3ubuntu10.38) ... 237-3ubuntu10. 39_amd64. deb ... 237-3ubuntu10. 39_amd64. deb ...
ii systemd 237-3ubuntu10.38 amd64 system and service manager
ubuntu@
1: lo: <LOOPBACK,
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
valid_lft forever preferred_lft forever
inet6 ::1/128 scope host
valid_lft forever preferred_lft forever
50: eth0@if51: <BROADCAST,
link/ether 00:16:3e:40:f5:e0 brd ff:ff:ff:ff:ff:ff link-netnsid 0
inet 10.202.51.98/24 brd 10.202.51.255 scope global dynamic eth0
valid_lft 3584sec preferred_lft 3584sec
inet6 fe80::216:
valid_lft forever preferred_lft forever
ubuntu@
Reading package lists... Done
Building dependency tree
Reading state information... Done
Calculating upgrade... Done
The following package was automatically installed and is no longer required:
libfreetype6
Use 'sudo apt autoremove' to remove it.
The following packages will be upgraded:
libnss-systemd libpam-systemd libsystemd0 libudev1 systemd systemd-sysv udev
7 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
Need to get 4502 kB of archives.
After this operation, 10.2 kB of additional disk space will be used.
Do you want to continue? [Y/n] y
Get:1 http://
Get:2 http://
Get:3 http://
Get:4 http://
Get:5 http://
Get:6 http://
Get:7 http://
Fetched 4502 kB in 1s (3046 kB/s)
(Reading database ... 28660 files and directories currently installed.)
Preparing to unpack .../libnss-
Unpacking libnss-
Preparing to unpack .../libsystemd0
Unpacking libsystemd0:amd64 (237-3ubuntu10.39) over (237-3ubuntu10.38) ...
Setting up libsystemd0:amd64 (237-3ubuntu10.39) ...
(Reading database ... 28660 files and directories currently installed.)
Preparing to unpack .../libpam-
Unpacking libpam-
Preparing to unpack .../systemd_
Unpacking systemd (237-3ubuntu10.39) over (237-3ubuntu10.38) ...
Preparing to unpack .../udev_
Unpacking udev (237-3ubuntu10.39) over (237-3ubuntu10.38) ...
Preparing to unpack .....