Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

do-release-upgrade when systemd is disabled. #493

Open
1 task done
vadimkantorov opened this issue Sep 2, 2024 · 7 comments
Open
1 task done

do-release-upgrade when systemd is disabled. #493

vadimkantorov opened this issue Sep 2, 2024 · 7 comments

Comments

@vadimkantorov
Copy link

vadimkantorov commented Sep 2, 2024

cmd /c ver

Microsoft Windows [Version 10.0.22631.4037]

wsl --status

C:\Users\vadim>wsl --status
Default Distribution: Ubuntu
Default Version: 2

C:\Users\vadim>wsl -l -v
NAME STATE VERSION

  • Ubuntu Stopped 2
    UbuntuWSL1 Stopped 1
    Ubuntu-24.04 Running 1

Did the problem occur during installation?

  • Yes

What happened?

  • I have a Ubuntu-22.04/WSLv1 distro UbtuntuWSL1
  • sudo do-release-upgrade fails with stack trace somewhere after noble.tar.gz is extracted:
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.
  • This happens because snap list errors out with exit code 1 and prints: Interacting with snapd is not yet supported on Windows Subsystem for Linux 1. This command has been left available for documentation purposes only.
  • I worked around and managed to get Ubuntu-24.04/WSLv1 by installing it fresh from MS Store and then forcing WSLv1, but this is not ideal as we have to set up the distro from scratch

Related issue I created in MS's repo:

What was expected?

On Ubuntu-22.04/WSLv1 sudo do-release-upgrade should succeed and bypass not working snap list, maybe snap list could be stubbed out, or better - the upgrader script should handle this error. On WSLv1 snap/snapd and snap apps are not supported, so they need not any upgrades, and this should be simply skipped in the upgrade process

Steps to reproduce

N/A - explained above (have Ubuntu-22.04 + WSLv1 and launch sudo do-release-upgrade)

Additional information

No response

@vadimkantorov
Copy link
Author

vadimkantorov commented Sep 2, 2024

In /tmp/ubuntu-release-upgrader-t8sg0mg9/DistUpgrade/DistUpgradeQuirks.py:

     def _test_and_fail_on_tpm_fde(self):
        """
        LP: #2065229
        """
        try:
            snap_list = subprocess.check_output(['snap', 'list'])
            snaps = [s.decode().split()[0] for s in snap_list.splitlines()]
        except FileNotFoundError:
            # snapd not installed?
            return

I think except FileNotFoundError: should be extended to except:

Because DistUpgradeQuirks.py is stored in some temp directory, it was hard to change it inplace, but I succeeded, and then the upgrade process continued as it should

Then after an hour of upgrade I got this error (maybe systemd install failed):

Setting up systemd (255.4-1ubuntu8.4) ...
Installing new version of config file /etc/systemd/journald.conf ...
Installing new version of config file /etc/systemd/logind.conf ...
Installing new version of config file /etc/systemd/networkd.conf ...
Installing new version of config file /etc/systemd/pstore.conf ...
Installing new version of config file /etc/systemd/sleep.conf ...
Installing new version of config file /etc/systemd/system.conf ...
Installing new version of config file /etc/systemd/user.conf ...
/usr/lib/tmpfiles.d/polkitd.conf:2: Failed to resolve group 'polkitd': No such process
/usr/lib/tmpfiles.d/polkitd.conf:3: Failed to resolve group 'polkitd': No such process
Failed to take /etc/passwd lock: Invalid argument
dpkg: error processing package systemd (--configure):
 installed systemd package post-installation script subprocess returned error exit status 1
Errors were encountered while processing:
 systemd

It appears that some packages add systemd post-installation scripts which then cannot run as WSLv1 has no systemd

@ZupoLlask
Copy link

I guess I'm finding another fellow that appreciates WSL1 approach... ;-)

@sephiroth-j
Copy link

sephiroth-j commented Sep 3, 2024

I use wsl2 but I am getting the same error. 😕

edit:
systemd was disabled because /etc/wsl.conf was empty. It worked after enabling systemd support.

@jibel
Copy link
Collaborator

jibel commented Sep 10, 2024

Thanks for your report. I filed https://bugs.launchpad.net/ubuntu/+source/ubuntu-release-upgrader/+bug/2080233 upstream to address this issue in Ubuntu release upgrader.

@jibel jibel changed the title Ubuntu 24.04's do-release-upgrade requires a working snap list which is not there for WSLv1 - instead should just skip not working snap / snap list / snapd do-release-upgrade when systemd is disabled. Sep 10, 2024
@vadimkantorov
Copy link
Author

vadimkantorov commented Sep 10, 2024

Another suggestion:

  • allow to specify the non-random temp path for DistUpgrade/DistUpgradeQuirks.py
  • fix the problem in _test_and_fail_on_tpm_fde in DistUpgrade/DistUpgradeQuirks.py and in general make all these hacks for defensive to eat up unexpected exceptions or allow to continue on errors, it seems that many people have stumbled on various problems in DistUpgrade/DistUpgradeQuirks.py. So maybe putting this script / upgrade tools on a GitHub repo would allow regular users to report problems faster...

@jibel In the bug filed above two problems appear mixed:

  1. bug in _test_and_fail_on_tpm_fde which crashes on unexpected return code by snap list. after hacking/commenting this out I stumbled on the next problem which is more serious:
  2. bug in apt which tries to run systemd-postinstall scripts whereas systemd is disabled

Btw my distro became broken after this upgrade attempt, and --fix-broken-install did not help as it also tries to run systemd-postinstall scripts and cannot. Maybe a command-line switch for apt which would skip systemd-postinstall scripts would be nice. Luckily, I installed a fresh Ubuntu24.04 distro from Microsoft Store and switched it to WSLv1 successfully. But of course, this upgrade experience is not very nice :(

@jibel
Copy link
Collaborator

jibel commented Sep 10, 2024

2. bug in apt which tries to run systemd-postinstall scripts whereas systemd is disabled

Right, I filed https://bugs.launchpad.net/ubuntu/+source/systemd/+bug/2080257 against systemd in Ubuntu for the systemd postinst issue.

@vadimkantorov
Copy link
Author

vadimkantorov commented Sep 10, 2024

I filed https://bugs.launchpad.net/ubuntu/+source/ubuntu-release-upgrader/+bug/2080233 upstream to address this issue in Ubuntu release upgrader.

Could you please add in there investigated details about the DistUpgrade/DistUpgradeQuirks.py being problematic and its function _test_and_fail_on_tpm_fde being too conservative? That method is designed to continue fine if snap is not present, but unfortunately fails to continue if snap exists, but snap list returns a stubbed message / non-zero exit code

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants