From a9520b71003b292be286e0ffdb8b3909a4e1ea6c Mon Sep 17 00:00:00 2001 From: Michael Hudson-Doyle Date: Thu, 14 Jul 2022 12:11:37 +1200 Subject: [PATCH 1/3] Pass ignore-running: true when refreshing ourself Otherwise the refresh awareness blocks refresh when you are connected via SSH. --- subiquity/server/controllers/refresh.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/subiquity/server/controllers/refresh.py b/subiquity/server/controllers/refresh.py index 5cbac3ab..5ef5693f 100644 --- a/subiquity/server/controllers/refresh.py +++ b/subiquity/server/controllers/refresh.py @@ -215,7 +215,7 @@ class RefreshController(SubiquityController): async def start_update(self, context): change = await self.app.snapd.post( 'v2/snaps/{}'.format(self.snap_name), - {'action': 'refresh'}) + {'action': 'refresh', 'ignore-running': True}) context.description = "change id: {}".format(change) return change From 135a870509a521f6e5088767e5367f2c41bd4763 Mon Sep 17 00:00:00 2001 From: Michael Hudson-Doyle Date: Fri, 15 Jul 2022 10:16:20 +1200 Subject: [PATCH 2/3] restart into cleaned environment --- subiquity/client/client.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/subiquity/client/client.py b/subiquity/client/client.py index 255c3735..c9ead64d 100644 --- a/subiquity/client/client.py +++ b/subiquity/client/client.py @@ -203,7 +203,7 @@ class SubiquityClient(TuiApplication): cmdline.extend(['--server-pid', self.opts.server_pid]) log.debug("restarting %r", cmdline) - os.execvp(cmdline[0], cmdline) + os.execvpe(cmdline[0], cmdline, orig_environ(os.environ)) def resp_hook(self, response): headers = response.headers From 942e5f5f1bd9dcf44d41ce3fb64da4529210a0f1 Mon Sep 17 00:00:00 2001 From: Michael Hudson-Doyle Date: Fri, 15 Jul 2022 12:05:13 +1200 Subject: [PATCH 3/3] set _ORIG variables in environment for 'subiquity' app this so orig_environ works when connecting via SSH --- snapcraft.yaml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/snapcraft.yaml b/snapcraft.yaml index 0d758010..5b89f46b 100644 --- a/snapcraft.yaml +++ b/snapcraft.yaml @@ -11,8 +11,15 @@ apps: subiquity: command: usr/bin/subiquity-cmd environment: + # Save original values of environment variables, we want to restore them + # for the debug shell (LP: #1975629) and restart (LP: #1978139) + PYTHONPATH_ORIG: $PYTHONPATH + PATH_ORIG: $PATH + PYTHONIOENCODING_ORIG: $PYTHONIOENCODING PYTHONIOENCODING: utf-8 + SUBIQUITY_ROOT_ORIG: $SUBIQUITY_ROOT SUBIQUITY_ROOT: $SNAP + PYTHON_ORIG: $PYTHON PYTHON: $SNAP/usr/bin/python3.8 probert: command: bin/probert