[WSL1] Upgrade to Ubuntu 24.04 from 22.04 fails with missing snap. Possible to work around?
Windows Version
Microsoft Windows [Version 10.0.22631.4037]
WSL Version
2.2.4.0
Are you using WSL 1 or WSL 2?
- [ ] WSL 2
- [X] WSL 1
Kernel Version
5.15.153.1-2
Distro Version
Ubuntu 22.04
Other Software
WSL version: 2.2.4.0 Kernel version: 5.15.153.1-2 WSLg version: 1.0.61 MSRDC version: 1.2.5326 Direct3D version: 1.611.1-81528511 DXCore version: 10.0.26091.1-240325-1447.ge-release Windows version: 10.0.22631.4037
Repro Steps
sudo do-release-upgrade
Traceback (most recent call last):
File "/tmp/ubuntu-release-upgrader-uqmd8iby/noble", line 8, in <module>
sys.exit(main())
File "/tmp/ubuntu-release-upgrader-uqmd8iby/DistUpgrade/DistUpgradeMain.py", line 241, in main
if app.run():
File "/tmp/ubuntu-release-upgrader-uqmd8iby/DistUpgrade/DistUpgradeController.py", line 2642, in run
return self.fullUpgrade()
File "/tmp/ubuntu-release-upgrader-uqmd8iby/DistUpgrade/DistUpgradeController.py", line 2447, in fullUpgrade
if not self.doPostInitialUpdate():
File "/tmp/ubuntu-release-upgrader-uqmd8iby/DistUpgrade/DistUpgradeController.py", line 1438, in doPostInitialUpdate
self.quirks.run("PostInitialUpdate")
File "/tmp/ubuntu-release-upgrader-uqmd8iby/DistUpgrade/DistUpgradeQuirks.py", line 102, in run
func()
File "/tmp/ubuntu-release-upgrader-uqmd8iby/DistUpgrade/DistUpgradeQuirks.py", line 127, in noblePostInitialUpdate
self._test_and_fail_on_tpm_fde()
File "/tmp/ubuntu-release-upgrader-uqmd8iby/DistUpgrade/DistUpgradeQuirks.py", line 1898, in _test_and_fail_on_tpm_fde
snap_list = subprocess.check_output(['snap', 'list'])
File "/usr/lib/python3.10/subprocess.py", line 421, in check_output
return run(*popenargs, stdout=PIPE, timeout=timeout, check=True,
File "/usr/lib/python3.10/subprocess.py", line 526, in run
raise CalledProcessError(retcode, process.args,
subprocess.CalledProcessError: Command '['snap', 'list']' returned non-zero exit status 1.
Expected Behavior
Ubuntu 24.04 installs in one way or another
Actual Behavior
Complete breakage as it seems to depend on snap list which prints this:
Interacting with snapd is not yet supported on Windows Subsystem for Linux 1.
This command has been left available for documentation purposes only.
I would propose at least snap list prints an empty list or something else reasonable.
Is it possible to upgrade to Ubuntu 24.04 in some other way to bypass snap problems?
I like WSLv1 on my Laptop because it's fast, lightweight and doesn't require Hyper-V or a full VM and uses the regular processes without a separate memory allocated for the VM.
Diagnostic Logs
No response
Logs are required for review from WSL team
If this a feature request, please reply with '/feature'. If this is a question, reply with '/question'. Otherwise please attach logs by following the instructions below, your issue will not be reviewed unless they are added. These logs will help us understand what is going on in your machine.
How to collect WSL logs
Download and execute collect-wsl-logs.ps1 in an administrative powershell prompt:
Invoke-WebRequest -UseBasicParsing "https://raw.githubusercontent.com/microsoft/WSL/master/diagnostics/collect-wsl-logs.ps1" -OutFile collect-wsl-logs.ps1
Set-ExecutionPolicy Bypass -Scope Process -Force
.\collect-wsl-logs.ps1
The script will output the path of the log file once done.
If this is a networking issue, please use collect-networking-logs.ps1, following the instructions here
Once completed please upload the output files to this Github issue.
Click here for more info on logging If you choose to email these logs instead of attaching to the bug, please send them to [email protected] with the number of the github issue in the subject, and in the message a link to your comment in the github issue and reply with '/emailed-logs'.
View similar issues
Please view the issues below to see if they solve your problem, and if the issue describes your problem please consider closing this one and thumbs upping the other issue to help us prioritize it!
Closed similar issues:
- Failed to update from 23.10 to 24.04 on WSL2, by 2024.6.13 (#11694), similarity score: 0.81
- Cannot upgrade from Ubuntu 20.04 to 22.04 (#8618), similarity score: 0.72
- Ubuntu: Failed to retrieve available kernel versions. Failed to check for processor microcode upgrades. (#7054), similarity score: 0.71
Note: You can give me feedback by thumbs upping or thumbs downing this comment.
snap needs systemd and wsl1 doesn't support it.
I mean, is it possible to stub out (or uninstall it) snap in such a way so that the upgrader moves on?
Maybe even snap list could return 0 exit code and print empty string?
Even if I sudo apt uninstall snap, then sudo do-release-upgrade / noble.tar.gz reinstalls it and fails while running snap list. I think a better stub of command snap list (and maybe others) is needed to proceed...
After the hack I described in https://github.com/ubuntu/WSL/issues/493, the upgrade fails with trying to run some systemd-using postinstall scripts
After the hack I described in ubuntu/WSL#493, the upgrade fails with trying to run some systemd-using postinstall scripts
run command: cd /bin && mv -f systemd-sysusers{,.org} && ln -s echo systemd-sysusers && cd -
then run do-release-upgrade
then success, I had already upgrade from 22.04->24.04->24.10
root@FUJITSU:~# lsb_release -a No LSB modules are available. Distributor ID: Ubuntu Description: Ubuntu 24.10 Release: 24.10 Codename: oracular root@FUJITSU:~# uname -a Linux FUJITSU 4.4.0-19041-Microsoft #4355-Microsoft Thu Apr 12 17:37:00 PST 2024 x86_64 x86_64 x86_64 GNU/Linux root@FUJITSU:~#
JFYI, this method still works in Nov/24:
- Apply the changes to
bin/systemd-sysuserssuggested by flydt on the comment above; - Run the
do-release-upgradecommand until it fails. Don't exit the window. - In the console history, copy the path to the temporary file
DistUpgradeQuirks.py. - In another terminal, edit the
DistUpgradeQuirks.pyfile. Find the line relative to the exception handling for the commandsnap list(search for['snap', 'list']) mentioned by vadimkantorov, and apply his suggestion of changing the exception handling fromexcept FileNotFoundError:by onlyexception:, making the code ignore any exceptions from this command. - Go back to the
do-release-upgradewindow and chose to resurrect the current window. It will try the upgrading process again using the same temporary file (that's what we want). If any errors appear after pressing 'r' to resurrect the window, continue by pressing 'y' (so you answer 'y' when the scripts asks you if you want to continue a few seconds later). - Continue the installation!
Thank you all for the knowledge!! WSL1 is a very impressive tech. I'm really sad that it's been being discontinued by MS.
Sorry, I am newbie here, but I bypassed with this script: `root@ffmpeg2:/home/troland# cat /usr/bin/snap #!/bin/bash
if [ "$1" == "list" ]; then echo "Name Version Rev Tracking Publisher Notes" else echo "snap: command not found: $*" fi`
I don't like edit py files and don't use snap
I observed the same issue with "snap".
On my WSL1 system, I was able to simply remove "snapd" using apt-get:
# apt-get remove snapd
Then I could perform the release upgrade.
Addendum:
After some time I noticed that I was unable to install packages to Ubuntu 24.04 as apt-get install complained about "snapd" not running. I fixed this error message with moving away this file
# mv /etc/apt/apt.conf.d/20snapd.conf /tmp/
Thereafter, apt-get balked at missing dependencies and suggested to run apt-get --fix-broken install. However, this failed when setting up systemd. This boiled down to the command # dpkg --configure systemd aborting with the message
"/usr/lib/tmpfiles.d/polkitd.conf:2: Failed to resolve group 'polkitd': No such process"
I was able to fix this error message with again moving this file away:
# mv /usr/lib/tmpfiles.d/polkitd.conf /tmp
Thereafter # dpkg --configure systemd stopped with a new error message
"Failed to take /etc/passwd lock: Invalid argument"
I figured that some postinstallation scripts where trying to get at lock on /etc/passwd using filecontrols that are not supported by WSL1, see this discussion and solution.
I applied the solution (a one liner sed script, see link above) and then configuring systemd succeeded. Returning to executing apt-get --fix-broken install, the process failed with
"Setting up polkitd (124-2ubuntu1.24.04.2) ...
Failed to take /etc/passwd lock: Invalid argument"
I used vim /var/lib/dpkg/info/polkitd.postinst to edit the script: I commented out the part where systemd-sysusers is called so that the classical adduser/addgroup command are used instead.
Finally, apt-get --fix-broken install ran successfully and I was able to use apt-get install again.