From c763da4cfba9dd15b30a099dc1a5ddc71fd246d5 Mon Sep 17 00:00:00 2001 From: Ben Grande Date: Wed, 3 Sep 2025 15:32:21 +0200 Subject: [PATCH] Inform how to debug failed preload startup The "domain-start-failed" has to be fired before the domain is killed, as the qube is unregistered from clients when it is removed/powered off. Fixes: https://github.com/QubesOS/qubes-issues/issues/10200 For: https://github.com/QubesOS/qubes-issues/issues/1512 --- qubes/vm/dispvm.py | 6 ++++-- qubes/vm/qubesvm.py | 9 ++++----- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/qubes/vm/dispvm.py b/qubes/vm/dispvm.py index f985959f9..6ecb0493a 100644 --- a/qubes/vm/dispvm.py +++ b/qubes/vm/dispvm.py @@ -373,11 +373,13 @@ async def on_domain_started_dispvm( except asyncio.TimeoutError: raise qubes.exc.QubesException( "Timed out call to '%s' after '%d' seconds during preload " - "startup" % (service, timeout) + "startup" % (rpc, timeout) ) except (subprocess.CalledProcessError, qubes.exc.QubesException): raise qubes.exc.QubesException( - "Error on call to '%s' during preload startup" % service + "Error on call to '%s' during preload startup. To debug, run " + "the following on a new disposable of '%s': systemctl " + "--failed" % (rpc, self.template) ) if not self.preload_requested: diff --git a/qubes/vm/qubesvm.py b/qubes/vm/qubesvm.py index 4dd6c1dad..d26fded48 100644 --- a/qubes/vm/qubesvm.py +++ b/qubes/vm/qubesvm.py @@ -1548,6 +1548,10 @@ async def start( except Exception as exc: # pylint: disable=bare-except self.log.error("Start failed: %s", str(exc)) + # let anyone receiving domain-pre-start know that startup failed + await self.fire_event_async( + "domain-start-failed", reason=str(exc) + ) # This avoids losing the exception if an exception is # raised in self.kill(), because the vm is not # running or paused @@ -1555,11 +1559,6 @@ async def start( await self.kill() except qubes.exc.QubesVMNotStartedError: pass - - # let anyone receiving domain-pre-start know that startup failed - await self.fire_event_async( - "domain-start-failed", reason=str(exc) - ) raise return self