interface not removed
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
netplan |
Fix Released
|
Undecided
|
Unassigned | ||
systemd |
New
|
Unknown
|
|||
netplan.io (Ubuntu) |
Fix Released
|
Undecided
|
Unassigned | ||
Focal |
Fix Released
|
Undecided
|
Simon Chopin | ||
Hirsute |
Fix Released
|
Undecided
|
Simon Chopin | ||
Impish |
Fix Released
|
Undecided
|
Unassigned |
Bug Description
[Impact]
Virtual devices such as bridge interfaces that are created via netplan
aren't destroyed when they are removed from the active netplan
configuration.
This is a known issue and has been the case for a long time:
http://
It is problematic as it can break network connectivity when doing
`netplan apply` even though the netplan configuration itself might be
correct, leading the user to search for an issue that isn't there.
This patch only brings a workaround, by allowing the user to manually
provide the previous configuration, which netplan will use to see what
the diff is.
[Test Plan]
On a VM, assuming no bridge interface is configured:
# netplan set network.
# netplan get # check that br54 is present
# netplan apply
# ip link show br54 && echo OK
# mkdir -p /tmp/np_backup/etc/ && cp -r /etc/netplan /tmp/np_backup/etc/
# netplan set network.
# netplan get # check that br54 is NOT present
# netplan apply --state /tmp/np_backup
# ip link show br54 && echo ERROR
[Potential Problems]
As usual, any netplan upgrade has the potential of breaking the user's
network setup.
This patch could make things worse: it's conceivable that with these
changes, `netplan apply --state backup` could result in a working system
but the configuration applied at startup wouldn't be correct. Indeed,
the delta between the `apply` codepath and what is run at startup grows
larger with this change.
[Original report]
While working on the UC20 integration for netplan I ran into the follow,
I may misunderstand how netplan dbus works so feel free to close as
"Invalid" if it's my misconception (and apologizes in this case). Any
help appreciated.
I ran into this while writing integration tests for snapd netplan
integration, I create (via the dbus api) a bridge br54, set it to dhcp
and then unset the interface again. After unset the br54 interface is
still available but AIUI it should be deleted. Attached is a reproducer
that uses the same dbus api as snapd is using. I ran it on a fresh 21.04
VM and got the same issue so it's probably not UC20 specific.
If I do similar things using "netplan set/netplan try/netplan appy"
directly it seems that the interface gets deleted as expected. I did not
write a script for this though, just manually tried it so I might be
wrong here.
Related branches
- Lukas Märdian: Approve
-
Diff: 995 lines (+967/-0)4 files modifieddebian/changelog (+14/-0)
debian/patches/0005-Implement-YAML-state-tracking-and-use-it-in-the-DBus.patch (+583/-0)
debian/patches/0006-netplan-set-make-it-possible-to-unset-a-whole-devtyp.patch (+368/-0)
debian/patches/series (+2/-0)
- Lukas Märdian: Pending requested
-
Diff: 1161 lines (+1007/-12) (has conflicts)7 files modifieddebian/changelog (+34/-0)
debian/control (+4/-0)
debian/gbp.conf (+4/-0)
debian/patches/0005-Implement-YAML-state-tracking-and-use-it-in-the-DBus.patch (+583/-0)
debian/patches/0006-netplan-set-make-it-possible-to-unset-a-whole-devtyp.patch (+368/-0)
debian/patches/series (+2/-0)
debian/tests/control (+12/-12)
- Lukas Märdian: Approve
-
Diff: 995 lines (+967/-0)4 files modifieddebian/changelog (+14/-0)
debian/patches/0005-Implement-YAML-state-tracking-and-use-it-in-the-DBus.patch (+583/-0)
debian/patches/0006-netplan-set-make-it-possible-to-unset-a-whole-devtyp.patch (+368/-0)
debian/patches/series (+2/-0)
Changed in systemd: | |
status: | Unknown → New |
Changed in netplan: | |
status: | Triaged → Fix Committed |
description: | updated |
description: | updated |
Changed in netplan.io (Ubuntu Focal): | |
status: | New → In Progress |
assignee: | nobody → Simon Chopin (schopin) |
Changed in netplan.io (Ubuntu Hirsute): | |
assignee: | nobody → Simon Chopin (schopin) |
status: | New → In Progress |
Changed in netplan: | |
status: | Fix Committed → Fix Released |
This is a known issue and has been the case for a long time: http:// manpages. ubuntu. com/manpages/ focal/man8/ netplan- apply.8. html#known% 20issues
Would the workaround described in the manpage (i.e. calling "ip link delete dev br54" manually) work for you?
I'll check what I can do about it inside the netplan CLI & DBus API.
I can confirm this happens using normal netplan set/netplan apply on an current Ubuntu Impish installation, using netplan 0.103:
root@ii:~# ip l | grep br54 bridges. br54.dhcp4= true BROADCAST, MULTICAST, UP> mtu 1500 qdisc noqueue state DOWN mode DEFAULT group default qlen 1000 bridges. br54.dhcp4= null BROADCAST, MULTICAST, UP> mtu 1500 qdisc noqueue state DOWN mode DEFAULT group default qlen 1000
root@ii:~# netplan get
network:
ethernets:
eth0:
dhcp4: true
version: 2
root@ii:~# netplan set network.
root@ii:~# netplan apply
root@ii:~# netplan get
network:
bridges:
br54:
dhcp4: true
ethernets:
eth0:
dhcp4: true
version: 2
root@ii:~# ip l | grep br54
4: br54: <NO-CARRIER,
root@ii:~# netplan set network.
root@ii:~# netplan apply
root@ii:~# netplan get
network:
ethernets:
eth0:
dhcp4: true
version: 2
root@ii:~# ip l | grep br54
4: br54: <NO-CARRIER,