LXD Deb->snap transition fails in WSL due to snap command not working (yet)
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
lxd (Ubuntu) |
Fix Released
|
Low
|
Stéphane Graber | ||
Cosmic |
Fix Released
|
Low
|
Stéphane Graber |
Bug Description
[Impact]
* Upgrading .deb-packaged lxd to the lxd .deb package that just installs the snap fails when the lxd snap can't be installed.
* This breaks package upgrades and specifically do-release-upgrade in the middle of the release upgrade.
* The fix lets skipping the installation of the lxd snap if lxd has not been activated on the system.
[Test Case]
1.
* Install the Ubuntu 18.04 app from the Microsoft Store on Windows 10
* Upgrade the packages to the latest versions in 18.04
* Make sure the lxd package is installed
* Run sudo do-release-upgrade
* Observe the release upgrade failing without the fix and offering skipping the snap installation and then succeeding after skipping it.
* Observe the lxd package still being installed but the lxc and lxd commands asking for installing the lxd snap
* Pretend that there is an activated lxd server:
# mkdir /var/lib/lxd
# touch /var/lib/
* Reinstall the lxd package
# apt-get install --reinstall lxd
* Observe the installation not allowing to skip the installation of the lxd snap. (By removing the created file skipping can be made allowed again.)
2.
* On a fully upgraded cosmic system install the previous version of the package, then upgrade to the fixed version.
* Observe the upgrade succeeding
3.
* On a fully upgraded cosmic system install the fixed version of the package, then remove the lxd snap.
* Observe the lxc and lxd commands asking for installing the lxd snap.
4.
* On a fully upgraded cosmic system purge the lxd packge and remove the lxd snap.
* Install the fixed package and observe it installing the lxd snap as well.
[Regression Potential]
* The fix includes changing the packaged-shipped lxc and lxd commands to print an error message if the lxd snap is missing. This is very simple and unlikely to cause regressions.
* The change to the package's prerm script is more extensive and in case of a programming error error it may cause upgrade/
[Original Bug Text]
Upgrading from Bionic to Cosmic (or later) is not possible in WSL (https:/
As a workaround one can do:
$ sudo mv /usr/bin/snap /usr/bin/snap.real
$ sudo ln -s /bin/true /usr/bin/snap
in a separate terminal, but this is not a smooth upgrade experience by any means.
The upgrade can fail the same way if the snap store is not available possibly due to strict firewalling requirements and most likely distro upgrades should work in those environments as well.
As a solution when the snap transition does not work during the package upgrade please upgrade the package to a state, where new invocations of lxd or lxc starts the snap installation later.
A prototype can be found here:
https:/
tags: | added: id-5c9b7900c475da3728353b23 |
tags: | added: id-5c536653f083fd53e3c3deaf |
description: | updated |
description: | updated |
tags: | added: id-5cad1e2aa0db9c596d15215d |
tags: | added: id-5cc028d1039e9572f93b3f1e |
I don't believe that dist-upgrading WSL is officially supported as it's an Ubuntu installation which does not run a supported Ubuntu kernel. As you point out, LXD cannot work in such an environment and so it's reasonable for its upgrade to similarly fail.
The lxd-installer proposal also isn't suitable because lxd.migrate which performs the needed data migration from the deb over to the snap requires the previous version of LXD to be functional.
This is why we do the upgrade from preinst and prevent the system from upgrading at all unless the upgrade is processed properly. Anything else would effectively result to data loss.
In the event that the store isn't available, we offer the user the choice between retrying after they've made sure it's accessible or giving up on the upgrade until such a time they can make it available (or have manually remove LXD from their system).