microsoft / WSL

Issues found on WSL
https://docs.microsoft.com/windows/wsl
MIT License
17.54k stars 823 forks source link

[WSL1] Upgrade to Ubuntu 24.04 from 22.04 fails with missing snap. Possible to work around? #11982

Open vadimkantorov opened 3 months ago

vadimkantorov commented 3 months ago

Windows Version

Microsoft Windows [Version 10.0.22631.4037]

WSL Version

2.2.4.0

Are you using WSL 1 or WSL 2?

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

github-actions[bot] commented 3 months ago

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](https://github.com/Microsoft/WSL/blob/master/diagnostics/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](https://github.com/Microsoft/WSL/blob/master/diagnostics/collect-networking-logs.ps1), following the instructions [here](https://github.com/microsoft/WSL/blob/master/CONTRIBUTING.md#collect-wsl-logs-for-networking-issues) Once completed please upload the output files to this Github issue. [Click here for more info on logging](https://github.com/microsoft/WSL/blob/master/CONTRIBUTING.md#8-collect-wsl-logs-recommended-method) If you choose to email these logs instead of attaching to the bug, please send them to wsl-gh-logs@microsoft.com 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:

Note: You can give me feedback by thumbs upping or thumbs downing this comment.

zcobol commented 3 months ago

snap needs systemd and wsl1 doesn't support it.

vadimkantorov commented 2 months ago

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...

vadimkantorov commented 2 months ago

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

flydt commented 1 month ago

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:~#

viniciusvillas commented 2 weeks ago

JFYI, this method still works in Nov/24:

1) Apply the changes to bin/systemd-sysusers suggested by flydt on the comment above; 2) Run the do-release-upgrade command until it fails. Don't exit the window. 3) In the console history, copy the path to the temporary file DistUpgradeQuirks.py. 4) In another terminal, edit the DistUpgradeQuirks.py file. Find the line relative to the exception handling for the command snap list (search for ['snap', 'list']) mentioned by vadimkantorov, and apply his suggestion of changing the exception handling from except FileNotFoundError: by only exception:, making the code ignore any exceptions from this command. 5) Go back to the do-release-upgrade window 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). 6) 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.

ryuqe787 commented 2 hours ago

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