systemd-networkd: Deconfigures bridge after last attached interface disconnects (ie: LXC)

Bug #1825470 reported by MelkorLord
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
systemd (Ubuntu)
Expired
Undecided
Unassigned
Bionic
Expired
Undecided
Unassigned
Cosmic
Expired
Undecided
Unassigned
Disco
Expired
Undecided
Unassigned
Eoan
Expired
Undecided
Unassigned

Bug Description

Ubuntu 18.04 Bionic Beaver

An issue was reported to systemd-networkd on GitHub - https://github.com/systemd/systemd/issues/11650 - and all the thorough details are there.

Using anonymous bridges (ie: not attached to physical NICs) is problematic with systemd-networkd as they get deconfigured as soon as the last attached device disconnects (ie: a LXC container). Static IP configuration must be done again manually.

The root cause is that systemd-networkd assumes that every network interface have a carrier signal. There's no notion of carrier signal on anonymous bridges, a case not properly handled by systemd-networkd.

The systemd dev team provided a patch to address the issue and it would be nice to be integrated on the Ubuntu package.

The PR is here : https://github.com/systemd/systemd/commit/93b4dab57e2e13bd804cbee999241be65a443e2e

To get the proper fix, you'll need to combine 2 patches :

- The one from the PR above
- Another patch [1] which fixes a segfault introduced by the PR.

[1] https://github.com/systemd/systemd/pull/11741/commits/a294af6810df3c18909a96b556deadba0e2ab0a9

On my test environment, I rebuild the Ubuntu package with the 2 patches above from "237-3ubuntu10.17" to "237-3ubuntu10.20" and made thorough tests without hiting a single issue so I think we can assume that these 2 patches are safe to use.

Dan Streetman (ddstreet)
Changed in systemd (Ubuntu Eoan):
assignee: nobody → Dan Streetman (ddstreet)
status: New → In Progress
importance: Undecided → Medium
tags: added: ddstreet-next
Revision history for this message
Dan Streetman (ddstreet) wrote :

I tried to reproduce this, but my static ip isn't lost:

root@lp1825470-d:~# grep . /etc/systemd/network/*br0*
/etc/systemd/network/20-br0.netdev:[NetDev]
/etc/systemd/network/20-br0.netdev:Name=br0
/etc/systemd/network/20-br0.netdev:Kind=bridge
/etc/systemd/network/30-br0.network:[Match]
/etc/systemd/network/30-br0.network:Name=br0
/etc/systemd/network/30-br0.network:[Network]
/etc/systemd/network/30-br0.network:Address=1.2.3.4/24
/etc/systemd/network/30-br0.network:LinkLocalAddressing=none

root@lp1825470-d:~# ip a show br0
3: br0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc noqueue state DOWN group default qlen 1000
    link/ether ca:9e:57:58:5f:c4 brd ff:ff:ff:ff:ff:ff
    inet6 fe80::c89e:57ff:fe58:5fc4/64 scope link
       valid_lft forever preferred_lft forever
root@lp1825470-d:~# ip l add test type dummy
root@lp1825470-d:~# ip l set up dev test
root@lp1825470-d:~# ip l set test master br0
root@lp1825470-d:~# ip a show br0
3: br0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default qlen 1000
    link/ether ca:9e:57:58:5f:c4 brd ff:ff:ff:ff:ff:ff
    inet 1.2.3.4/24 brd 1.2.3.255 scope global br0
       valid_lft forever preferred_lft forever
    inet6 fe80::c89e:57ff:fe58:5fc4/64 scope link
       valid_lft forever preferred_lft forever
root@lp1825470-d:~# ip l del test
root@lp1825470-d:~# ip a show br0
3: br0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc noqueue state DOWN group default qlen 1000
    link/ether ca:9e:57:58:5f:c4 brd ff:ff:ff:ff:ff:ff
    inet6 fe80::c89e:57ff:fe58:5fc4/64 scope link
       valid_lft forever preferred_lft forever
root@lp1825470-d:~# ip l add test type dummy
root@lp1825470-d:~# ip l set up dev test
root@lp1825470-d:~# ip l set test master br0
root@lp1825470-d:~# ip a show br0
3: br0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default qlen 1000
    link/ether ca:9e:57:58:5f:c4 brd ff:ff:ff:ff:ff:ff
    inet 1.2.3.4/24 brd 1.2.3.255 scope global br0
       valid_lft forever preferred_lft forever
    inet6 fe80::c89e:57ff:fe58:5fc4/64 scope link
       valid_lft forever preferred_lft forever

Are you using systemd-networkd to manage your anonymous bridge ip address? Or are you setting the ip address manually? You mention lxc, do you have a test case involving lxc that reproduces the bug?

Changed in systemd (Ubuntu Eoan):
status: In Progress → Incomplete
tags: removed: ddstreet-next
Dan Streetman (ddstreet)
Changed in systemd (Ubuntu Eoan):
assignee: Dan Streetman (ddstreet) → nobody
Dan Streetman (ddstreet)
Changed in systemd (Ubuntu Disco):
status: New → Incomplete
Changed in systemd (Ubuntu Bionic):
status: New → Incomplete
Changed in systemd (Ubuntu Cosmic):
status: New → Incomplete
Changed in systemd (Ubuntu Eoan):
importance: Medium → Undecided
Revision history for this message
Launchpad Janitor (janitor) wrote :

[Expired for systemd (Ubuntu Bionic) because there has been no activity for 60 days.]

Changed in systemd (Ubuntu Bionic):
status: Incomplete → Expired
Revision history for this message
Launchpad Janitor (janitor) wrote :

[Expired for systemd (Ubuntu Cosmic) because there has been no activity for 60 days.]

Changed in systemd (Ubuntu Cosmic):
status: Incomplete → Expired
Revision history for this message
Launchpad Janitor (janitor) wrote :

[Expired for systemd (Ubuntu Eoan) because there has been no activity for 60 days.]

Changed in systemd (Ubuntu Eoan):
status: Incomplete → Expired
Revision history for this message
Launchpad Janitor (janitor) wrote :

[Expired for systemd (Ubuntu Disco) because there has been no activity for 60 days.]

Changed in systemd (Ubuntu Disco):
status: Incomplete → Expired
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.