WSL: Exit 1 when upgrading to Ubuntu 21.04
Windows Build Number
Microsoft Windows [Version 10.0.19043.985]
WSL Version
- WSL 2
- WSL 1
Kernel Version
Linux version 5.4.72-microsoft-standard-WSL2 (oe-user@oe-host) (gcc version 8.2.0 (GCC)) #1 SMP Wed Oct 28 23:40:43 UTC 2020
Distro Version
Release: 20.10
Other Software
VSCode 1.56.2 with Remote-WSL v0.56.2
Repro Steps
Change Prompt to normal in /etc/update-manager/release-upgrades
sudo apt dist-upgrade -y
sudo do-release-upgrade
Expected Behavior
The update successful
Actual Behavior
Update failed
Diagnostic Logs
Reading cache
Checking package manager
Reading package lists... Done
Building dependency tree
Reading state information... Done
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
Hit http://security.ubuntu.com/ubuntu groovy-security InRelease
Fetched 0 B in 0s (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 terminated with exit status 1 (Fri May 14 10:31:40 2021) ===
About this issue
- Original URL
- State: closed
- Created 6 years ago
- Reactions: 20
- Comments: 29 (1 by maintainers)
I had similar issue, took me some time to debug it, but here is what I found out and how I resolved it in the end:
Upgrade tool uses some snap package system which is currently not supported in WSL. I disabled its usage by commenting one line in upgrade script and then it went fine. I upgraded from 20.04 --> 20.10, but I presume it would be same for any other upgrades.
===============================
Run
sudo do-release-upgradeAfter it fails with abort - go to
/tmp, there should be some subfolder something like/tmp/ubuntu-release-upgrader-49jp2ru6/for example - where instance of upgrade tool is copied. Inside you will found out file calledDistUpgradeQuirks.py.Fine lines 128, 129 and comment them:
Then inside that folder run this command to prompt upgrade again from this edited instance of upgrade tool:
It should run fine now. A bit complicated, but once the upgrades are done, there are done.
I came across this issue too. As I didn’t use snap package, I just run
sudo apt remove snapdto fix this issue. @Mystic8b @BilboTavWorked for me when upgrading from 18.04 to 20.04. (The original issue has been closed.)
I know this is a closed issue, but in case anyone comes across this thread, do not use
do-release-upgradeto upgrade your WSL Ubuntu version. The recommended method involves modifying yoursources.listandsources.list.dwithsedornanoand upgrading throughsudo apt update' and 'sudo apt upgradefollowed bysudo apt full-upgrade.It would look something like this:
do-release-upgradecan be found here.There’s two easy solutions to the original problem:
Both should work just fine and as normal.
I debugged the python scrips looking for a place, where it exits with error. Pain in d***, but glad it helped some people.
FWIW: this appears to work going from 21.04 -> 21.10, as well.
I’m not sure what you’re talking about, the way @therealkenc explained is the way all Debian and Ubuntu releases were done, before
update-notifiereven existed. Which is just a wrapper aroundaptanyway. In the background, it’s pretty much justThere’s no magic involved here,
do-release-upgradewould do the exact same thing. You don’t have to “reconfigure everything all the time”, it’s a one-time upgrade. To me it asked 4 questions, all about config files I did modify under /etc. So I had to go through the “trouble” of pressing Return 4 times to keep my versions instead of using the package versions (but of course you could skip even those by doingapt dist-upgrade -y). And then:That’s about it. So you guys seem to overthink this issue a little, just because you need to use the original process instead of a fancy wrapper (
do-release-upgrade). There’s not much of an “issue” here.Under “groovy”.
success.
I found a simpler method in a few threads that worked… just
sudo apt remove snapdand then it ran just fine and got me from the initial 20.04 directly to impish.The
do-release-upgradepretty much assumessystemdexists, daemons can be stopped and restarted withsystemctl, andsnapswork (among other things). That’s beside generic problems with PPAs that can cause behavior like the above (for example this guy).The upgrade to 20.10 took here for me with
systemdrunning. Chat aboutsystemdis over in #994.Another way to go is to replace
focalwithgroovymanually in/etc/apt/sources.listwithnanoorsed, and do anapt update; apt upgrade. Rando guide for that here, which for Stretch to Buster, but applies to updatingsources.listin general on Debian derived distros.But probably a better play still is to
wsl.exe --importa Groovy tarball and forgo upgrade entirely. Which is what I would do IRL.You don’t need to remove Snap. It’s better if you don’t, so you don’t lose things like Docker. You just need to make it work before updating.
Thanks a lot as It works for my case, and how on earth did you find out it is related with snapd, I checked all the logs under /var/log/dist-upgrade/ and find nothing usefull🤣
Wow. This means that if it is necessary to change the distribution (if it appears in the win store), I need to reconfigure the working environment every time. It is a pain. Are there any movements in this direction? Will WSL become more like real linux? The same systemd, etc. will ever appear?
upd It turned out that the store is still 20.04, which means that we can normally update only once every 2 years. This is ridiculous.