Restarting `systemd-networkd` looses unmanaged bridged parents

Bug #2036127 reported by Simon Déziel
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
systemd (Ubuntu)
New
Undecided
Unassigned

Bug Description

My home network comprises many VLANs managed by `systemd-networkd`/`netplan`. Those VLANs are then used as parent interfaces for LXD networks. Whenever `systemd-networkd` is restarted (i.e: post-update), my whole network breaks because all the unmanaged bridges lose their parent devices. Another way to see it is that `systemd-networkd` undoes the `master` setting of those VLAN devices.

Here is a simplified reproducer:

1. Create a `vlan1` device

$ lxc launch ubuntu:22.04 networkd-bug
Creating networkd-bug
Starting networkd-bug

$ lxc file push - networkd-bug/etc/netplan/99-vlan1.yaml << EOF
network:
  version: 2
  vlans:
    vlan1:
      id: 1
      link: eth0
EOF

$ lxc exec networkd-bug -- netplan apply

2. Manually create a bridge and join `vlan1` to it

$ lxc exec networkd-bug -- ip link add br0 type bridge
$ lxc exec networkd-bug -- ip link set vlan1 master br0
$ lxc exec networkd-bug -- ip link
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN mode DEFAULT group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
2: vlan1@eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue master br0 state UP mode DEFAULT group default qlen 1000
    link/ether 00:16:3e:94:6e:47 brd ff:ff:ff:ff:ff:ff
3: br0: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN mode DEFAULT group default qlen 1000
    link/ether 42:b6:31:01:47:9a brd ff:ff:ff:ff:ff:ff
164: eth0@if165: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP mode DEFAULT group default qlen 1000
    link/ether 00:16:3e:94:6e:47 brd ff:ff:ff:ff:ff:ff link-netnsid 0

3. Restart `systemd-networkd`

$ lxc exec networkd-bug -- systemctl restart systemd-networkd

4. Notice `vlan1` lost it's master config

$ lxc exec networkd-bug -- ip link
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN mode DEFAULT group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
2: vlan1@eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP mode DEFAULT group default qlen 1000
    link/ether 00:16:3e:94:6e:47 brd ff:ff:ff:ff:ff:ff
3: br0: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN mode DEFAULT group default qlen 1000
    link/ether 42:b6:31:01:47:9a brd ff:ff:ff:ff:ff:ff
164: eth0@if165: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP mode DEFAULT group default qlen 1000
    link/ether 00:16:3e:94:6e:47 brd ff:ff:ff:ff:ff:ff link-netnsid 0

Ideally, `vlan1` should retain it's `master` setting and I wouldn't loose connectivity :)

Additional information:

# apt-cache policy systemd netplan.io iproute2
systemd:
  Installed: 249.11-0ubuntu3.9
  Candidate: 249.11-0ubuntu3.9
  Version table:
 *** 249.11-0ubuntu3.9 500
        500 http://archive.ubuntu.com/ubuntu jammy-updates/main amd64 Packages
        100 /var/lib/dpkg/status
     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
netplan.io:
  Installed: 0.105-0ubuntu2~22.04.3
  Candidate: 0.105-0ubuntu2~22.04.3
  Version table:
 *** 0.105-0ubuntu2~22.04.3 500
        500 http://archive.ubuntu.com/ubuntu jammy-updates/main amd64 Packages
        100 /var/lib/dpkg/status
     0.104-0ubuntu2 500
        500 http://archive.ubuntu.com/ubuntu jammy/main amd64 Packages
iproute2:
  Installed: 5.15.0-1ubuntu2
  Candidate: 5.15.0-1ubuntu2
  Version table:
 *** 5.15.0-1ubuntu2 500
        500 http://archive.ubuntu.com/ubuntu jammy/main amd64 Packages
        100 /var/lib/dpkg/status

# lsb_release -rd
Description: Ubuntu 22.04.3 LTS
Release: 22.04
# uname -a
Linux networkd-bug 6.2.0-32-generic #32~22.04.1-Ubuntu SMP PREEMPT_DYNAMIC Fri Aug 18 10:40:13 UTC 2 x86_64 x86_64 x86_64 GNU/Linux

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.