do-release-upgrade reinstalls netplan.io, breaking systemd-networkd configuration

Bug #1845234 reported by Dan Streetman
18
This bug affects 1 person
Affects Status Importance Assigned to Milestone
netplan.io (Ubuntu)
Invalid
Undecided
Unassigned

Bug Description

[impact]

Users who have chosen to remove the 'netplan.io' package and manually configure systemd-networkd, when upgrading, will have the 'netplan.io' package reinstalled, which will create a new dynamic networkd configuration after reboot, which breaks system networking.

[test case]

install an Ubuntu release, e.g. Bionic.

Make sure some 'desktop' metapackage is installed, e.g.:
$ sudo apt install xubuntu-desktop

Remove netplan:
$ sudo apt purge netplan.io

note that the above command removes not only 'netplan.io' but also 'ubuntu-minimal'

then, configure systemd-networkd manually, in some way that would conflict with netplan's default of just using dhcp on the main interface, e.g.:

$ grep . /etc/systemd/network/*
/etc/systemd/network/10-br0.netdev:[NetDev]
/etc/systemd/network/10-br0.netdev:Name=br0
/etc/systemd/network/10-br0.netdev:Kind=bridge
/etc/systemd/network/20-ens3.network:[Match]
/etc/systemd/network/20-ens3.network:Name=ens3
/etc/systemd/network/20-ens3.network:[Network]
/etc/systemd/network/20-ens3.network:Bridge=br0
/etc/systemd/network/50-br0.network:[Match]
/etc/systemd/network/50-br0.network:Name=br0
/etc/systemd/network/50-br0.network:[Network]
/etc/systemd/network/50-br0.network:Address=192.168.122.200/24
/etc/systemd/network/50-br0.network:Gateway=192.168.122.1
/etc/systemd/network/50-br0.network:DNS=192.168.122.1

(That is a trivial example of networkd config that would conflict with netplan's default, real examples can be much more complex, even as far as causing systemd-networkd to fail to start)

reboot the system to discard old netplan networkd configuration, and pick up new manual networkd configuration. If needed, edit /etc/update-manager/release-upgrades to change Prompt to 'normal'. Then upgrade to a new release:

$ sudo do-release-upgrade

following the prompts to complete the upgrade, including the final prompt to reboot after the upgrade.

Boot into the upgraded system and check if netplan is installed and operating:

$ dpkg -l|grep netplan
ii netplan.io 0.97-0ubuntu1~19.04.1 amd64 YAML network configuration abstraction for various backends
$ ls -l /run/systemd/network/
total 8
-rw-r--r-- 1 root root 69 Sep 24 15:36 10-netplan-ens3.link
-rw-r--r-- 1 root root 129 Sep 24 15:36 10-netplan-ens3.network

[regression potential]

TBD

[other info]

This appears to require one of the 'desktop' packages installed, e.g. 'ubuntu-desktop, 'xubuntu-desktop', etc.; I reproduced it with 'xubuntu-desktop' installed, but could not reproduce it with a stock cloud image that has no 'desktop' package installed.

Revision history for this message
Dan Streetman (ddstreet) wrote :

I opened this against netplan, but it might be an issue that should be addressed in ubuntu-release-upgrader, not netplan, since netplan is just doing its job after being installed.

Revision history for this message
Brian Murray (brian-murray) wrote :

It is actually ubuntu-minimal which depends on netplan.io and ubuntu-release-upgrader will always reinstall ubuntu-minimal as it is a part of the BaseMetaPkgs configuration. If people are removing ubuntu-minimal, which happens by removing netplan.io, then they should upgrade by editing /etc/apt/sources.list and running 'sudo apt-get dist-upgrade' rather than using ubuntu-release-upgrader.

Revision history for this message
Dan Streetman (ddstreet) wrote :

> It is actually ubuntu-minimal which depends on netplan.io and ubuntu-release-upgrader will always reinstall ubuntu-minimal as it is a part of the BaseMetaPkgs configuration

this is what i initially thought, but when i tested it, the upgrade did *not* reinstall ubuntu-minimal (or netplan.io).

> If people are removing ubuntu-minimal, which happens by removing netplan.io, then they should upgrade by editing /etc/apt/sources.list and running 'sudo apt-get dist-upgrade' rather than using ubuntu-release-upgrader.

er...really? And how are people supposed to know that? If do-release-upgrade should *really* not be used if ubuntu-minimal isn't installed, then it *definitely* should check that and abort before it starts with a warning...

Revision history for this message
Felipe Reyes (freyes) wrote :

do-release-upgrade in this aspect have 2 modes: server and desktop mode, the desktop mode is used whenever any of the packages defined in the MetaPkgs[0] section is installed[2]

So when server mode is detected is when the presence of packages defined in BaseMetaPkgs is NOT enforced[1]

[0] https://bazaar.launchpad.net/~ubuntu-core-dev/ubuntu-release-upgrader/trunk/view/head:/data/DistUpgrade.cfg.bionic#L13
[1] https://bazaar.launchpad.net/~ubuntu-core-dev/ubuntu-release-upgrader/trunk/view/head:/DistUpgrade/DistUpgradeCache.py#L624
[2] https://bazaar.launchpad.net/~ubuntu-core-dev/ubuntu-release-upgrader/trunk/view/head:/DistUpgrade/DistUpgradeCache.py#L359

Revision history for this message
Steve Langasek (vorlon) wrote :

Users who remove netplan.io are removing a core component of the definition of a base Ubuntu system (that's what being a dependency of ubuntu-minimal means). This should be considered unsupported.

Any affected user should have dealt with not wanting netplan to manage their network by removing the configuration files from /etc/netplan, not by removing the package.

Changed in netplan.io (Ubuntu):
status: New → Invalid
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.