Upgrade WSL Ubuntu (18.04) without removing snapd?

I tried to upgrade my Ubuntu WSL on Windows 10 to later Ubuntu as it had older 18.04 currently. But it failed with aborting error without additional information. I found online that others had removed snapd which was preventing the upgrade. I also removed snapd and then the upgrade succeeded. The problem and abort error messages are described in these AU posts:

I did a full update before the upgrade attempt.

sudo apt update && sudo apt upgrade

then a reboot and then do-release-upgrade

Perhaps this could be updated in Ubuntu to handle this error also?

Is this a problem only in older 18.04 or is the same procedure also needed in 20.04 and later upgrades?

Is it recommended to add snapd back after each upgrade?

I found this information afterwards online. Would this have resolved the upgrade issue also instead of removing snapd?

sudo -S apt-mark hold procps strace sudo
sudo -S env RELEASE_UPGRADER_NO_SCREEN=1 do-release-upgrade
Asked By: r4v3n6

||

Perhaps this could be updated in Ubuntu to handle this error also?

It sounds like you are asking for the Ubuntu code to be modified to handle this.
If so, please understand that this is just a user-site with no official Canonical/Ubuntu presence – You’d need to ask them for that. However, that change would be unlikely to happen in the 18.04 release that is no longer supported, even if it deals with upgrading.

Is this a problem only in older 18.04 or is the same procedure also needed in 20.04 and later upgrades?

See my answer here regarding the upgrade from 20.04 -> 22.04 in WSL. In my testing, removing snapd was no longer required. However, if you do run into issues, that would be a likely troubleshooting step.

Please do read that entire answer though, as there are some minor irritations/issues in the 22.04 release that I cover how to fix.

Is it recommended to add snapd back after each upgrade?

If you are planning on enabling Systemd, then yes. Otherwise, there’s no need that I can think of for it to be enabled. At this point, given the issues I’m still seeing with Systemd enabled, I personally recommend leaving it disabled, but your needs may be different.

I found this information afterwards online. Would this have resolved the upgrade issue also instead of removing snapd?

Unlikely. Note that the information there appears to be from 2017 and is unlikely to apply to any recent Ubuntu or WSL release. I can’t tell why the blogger felt the need to hold those packages, but I would not recommend it.

Answered By: NotTheDr01ds