Merge ~edugomez/ubuntu-release-upgrader:no-restart-wsl into ubuntu-release-upgrader:ubuntu/main

Proposed by Edu Gómez Escandell
Status: Merged
Merged at revision: 14196b3143fbbbec9cc720234708b131efa2e05b
Proposed branch: ~edugomez/ubuntu-release-upgrader:no-restart-wsl
Merge into: ubuntu-release-upgrader:ubuntu/main
Diff against target: 68 lines (+28/-3)
3 files modified
DistUpgrade/DistUpgradeController.py (+12/-3)
DistUpgrade/DistUpgradeView.py (+10/-0)
debian/changelog (+6/-0)
Reviewer Review Type Date Requested Status
Ubuntu Core Development Team Pending
Review via email: mp+425846@code.launchpad.net

Commit message

DistUpgrade: No longer attempting to reboot in WSL (LP: #1958668).

Description of the change

On WSL, at the end of a do-release-upgrade, the upgrader proposes to reboot the machine and then fails to do so. This happens because it is not possible to reboot, due to the lack of systemd. This results in an error.

There is no clean way of restarting from within WSL, so the solution is to ask the user to close all other Ubuntu WSL instances before the current one, and signal the Launcher to restart after quitting. This will kill all instances of Ubuntu WSL, hence why the user is advised to close the others first.

To post a comment you must log in.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
diff --git a/DistUpgrade/DistUpgradeController.py b/DistUpgrade/DistUpgradeController.py
index 6571ebb..7fe796e 100644
--- a/DistUpgrade/DistUpgradeController.py
+++ b/DistUpgrade/DistUpgradeController.py
@@ -2026,9 +2026,14 @@ class DistUpgradeController(object):
2026 self._view.updateStatus(_("System upgrade is complete.")) 2026 self._view.updateStatus(_("System upgrade is complete."))
2027 get_telemetry().done()2027 get_telemetry().done()
2028 # FIXME should we look into /var/run/reboot-required here?2028 # FIXME should we look into /var/run/reboot-required here?
2029 if (not inside_chroot() and2029 if not inside_chroot():
2030 self._view.confirmRestart()):2030 if self._inside_WSL():
2031 subprocess.Popen("/sbin/reboot")2031 self._view.adviseExitOtherWSL()
2032 with open("/run/launcher-command", "w+", encoding="utf-8") as f:
2033 f.write("action: reboot\n")
2034 self._view.adviseRestartWSL()
2035 elif self._view.confirmRestart():
2036 subprocess.Popen("/sbin/reboot")
2032 sys.exit(0)2037 sys.exit(0)
2033 return True2038 return True
2034 2039
@@ -2126,6 +2131,10 @@ class DistUpgradeController(object):
21262131
2127 os.seteuid(int(uid))2132 os.seteuid(int(uid))
21282133
2134 def _inside_WSL(self):
2135 return os.path.exists("/proc/sys/fs/binfmt_misc/WSLInterop")
2136
2137
2129if __name__ == "__main__":2138if __name__ == "__main__":
2130 from .DistUpgradeViewText import DistUpgradeViewText2139 from .DistUpgradeViewText import DistUpgradeViewText
2131 logging.basicConfig(level=logging.DEBUG)2140 logging.basicConfig(level=logging.DEBUG)
diff --git a/DistUpgrade/DistUpgradeView.py b/DistUpgrade/DistUpgradeView.py
index 3611c89..9f9f34b 100644
--- a/DistUpgrade/DistUpgradeView.py
+++ b/DistUpgrade/DistUpgradeView.py
@@ -430,6 +430,16 @@ class DistUpgradeView(object):
430 "Do you want to do this "430 "Do you want to do this "
431 "now?")431 "now?")
432 return self.askYesNoQuestion(summary, msg)432 return self.askYesNoQuestion(summary, msg)
433 def adviseExitOtherWSL(self):
434 summary = _("Action required")
435 msg = _("Exit all other instances of Ubuntu WSL before continuing.")
436 extended = _("Unsaved progress may otherwise be lost.")
437 return self.information(summary, msg, extended)
438 def adviseRestartWSL(self):
439 summary = _("WSL restart required")
440 msg = _("Exit this instance of Ubuntu WSL.")
441 extended = _("The upgrade will then be complete.")
442 return self.information(summary, msg, extended)
433 def error(self, summary, msg, extended_msg=None):443 def error(self, summary, msg, extended_msg=None):
434 " display a error "444 " display a error "
435 pass445 pass
diff --git a/debian/changelog b/debian/changelog
index ba99ee1..66ff85a 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,9 @@
1ubuntu-release-upgrader (1:22.10.5~ppa1) UNRELEASED; urgency=medium
2
3 * DistUpgrade: No longer attempting to reboot in WSL (LP: #1958668).
4
5 -- Edu Gómez Escandell <edu.gomez.escandell@canonical.com> Wed, 29 Jun 2022 09:13:09 +0200
6
1ubuntu-release-upgrader (1:22.10.4) kinetic; urgency=medium7ubuntu-release-upgrader (1:22.10.4) kinetic; urgency=medium
28
3 * DistUpgrade: Add deb2snap entry for snapd-desktop-integration (LP: #1975747).9 * DistUpgrade: Add deb2snap entry for snapd-desktop-integration (LP: #1975747).

Subscribers

People subscribed via source and target branches