From ba5d19e1b4d072a22bfb75de13345c189186fc01 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Marczykowski-G=C3=B3recki?= Date: Mon, 26 Feb 2018 02:53:35 +0100 Subject: [PATCH] vm: provide better error message for VM startup timeout "Cannot execute qrexec-daemon!" error is very misleading for a startup timeout error, make it clearer. This rely on qrexec-daemon using distinct exit code for timeout error, but even without that, include its stderr in the error message. --- qubes/vm/qubesvm.py | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/qubes/vm/qubesvm.py b/qubes/vm/qubesvm.py index e8803765..7fc743fa 100644 --- a/qubes/vm/qubesvm.py +++ b/qubes/vm/qubesvm.py @@ -1313,9 +1313,17 @@ class QubesVM(qubes.vm.mix.net.NetVMMixin, qubes.vm.BaseVM): try: yield from self.start_daemon( qubes.config.system_path['qrexec_daemon_path'], *qrexec_args, - env=qrexec_env) - except subprocess.CalledProcessError: - raise qubes.exc.QubesVMError(self, 'Cannot execute qrexec-daemon!') + env=qrexec_env, stderr=subprocess.PIPE) + except subprocess.CalledProcessError as err: + if err.returncode == 3: + raise qubes.exc.QubesVMError(self, + 'Cannot connect to qrexec agent for {} seconds, ' + 'see /var/log/xen/console/guest-{}.log for details'.format( + self.qrexec_timeout, self.name + )) + else: + raise qubes.exc.QubesVMError(self, + 'qrexec-daemon startup failed: ' + err.stderr.decode()) @asyncio.coroutine def start_qubesdb(self):