Upgrade WSL to Ubuntu Hirsute 21.04 from 20.10
I faced during sudo do-release-upgrade this situation:
Reading cache
pcilib: Cannot open /proc/bus/pci
lspci: Cannot find any working access method.
Checking package manager
Reading package lists... Done
Building dependency tree
Reading state information... Done
Hit http://security.ubuntu.com/ubuntu groovy-security InRelease
Hit http://archive.ubuntu.com/ubuntu groovy InRelease
Hit http://archive.ubuntu.com/ubuntu groovy-updates InRelease
Hit http://archive.ubuntu.com/ubuntu groovy-backports InRelease
Fetched 0 B in 6s (0 B/s)
Reading package lists... Done
Building dependency tree
Reading state information... Done
Restoring original system state
Aborting
Reading package lists... Done
Building dependency tree
Reading state information... Done
=== Command detached from window (Wed Jul 14 08:30:31 2021) ===
=== Command terminated with exit status 1 (Wed Jul 14 08:30:41 2021) ===
and hold in terminal, no further action.
How to fix it and conduct full upgrade?
Solution 1:
TL;DR: apt purge snapd
I also have a WSL1 system. Using do-release-upgrade to go from ubuntu 20.10 to 21.04 failed in the same way. I ran across this reddit post which pointed me in the right direction. Apparently, WSL doesn't like to upgrade snapd for some reason. I don't use snapd, so I just deleted it.
After removing snapd, I still saw the lspci failure, but it updated almost everything okay. There was one package which failed: usrmerge, which failed exactly like this askubuntu question: Both /lib/udev/hwdb.bin and /usr/lib/udev/hwdb.bin exist.
The solution is to delete one of them. I deleted the older one.
Solution 2:
It sounds like you are using WSL1, since lspci
is failing somewhere during the upgrade. /proc
support is a lot more limited under WSL1 than it is under WSL2.
If that's the case, try converting the instance to WSL2 before running the do-release-upgrade
.
- First, confirm the distribution name, if you don't know it already, with
wsl -l -v
. - Make sure the instance isn't running via
wsl --terminate <distroname>
. Confirm that it is stopped after a few minutes withwsl -l -v
again. - Back up the instance using
wsl --export <distroname> <filename.tar>
- Change the WSL version of the instance with
wsl --set-version <distroname> 2
Try your sudo do-release-upgrade
again there. You can always change the version back to WSL1 after that completes.
Remember, unlike the LTS releases, 21.04 is not necessarily tested by Canonical with WSL (and even less of a chance that they've tested WSL1). So keep a backup of the 20.04 to go back to just in case.