From 5805941daf3ebf13058d4fb9bcec5d934d0e901c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Pierret=20=28fepitre=29?= Date: Fri, 7 May 2021 11:39:33 +0200 Subject: [PATCH] qvm-features-request: ensure qrexec agent is started Prevents: Traceback (most recent call last): File "/usr/bin/qvm-features-request", line 81, in sys.exit(main()) File "/usr/bin/qvm-features-request", line 78, in main stdin=devnull, stdout=devnull) File "/usr/lib/python3.7/subprocess.py", line 347, in check_call raise CalledProcessError(retcode, cmd) subprocess.CalledProcessError: Command '['qrexec-client-vm', 'dom0', 'qubes.FeaturesRequest']' returned non-zero exit status 127. and Traceback (most recent call last): File "/usr/bin/qvm-features-request", line 81, in sys.exit(main()) File "/usr/bin/qvm-features-request", line 70, in main qdb = qubesdb.QubesDB() qubesdb.Error: (2, 'No such file or directory') Fixes QubesOS/qubes-issues#4469 --- misc/qvm-features-request | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/misc/qvm-features-request b/misc/qvm-features-request index 4d21c2b..09acd13 100755 --- a/misc/qvm-features-request +++ b/misc/qvm-features-request @@ -29,6 +29,12 @@ import sys import qubesdb + +def is_active(service): + status = subprocess.call(["systemctl", "is-active", "--quiet", service]) + return status == 0 + + class FeatureRequestAction(argparse.Action): '''Action for argument parser that stores a property.''' # pylint: disable=redefined-builtin,too-few-public-methods @@ -66,7 +72,8 @@ parser.add_argument('features', def main(args=None): args = parser.parse_args(args) - + if not is_active("qubes-qrexec-agent"): + return qdb = qubesdb.QubesDB() for feature, value in args.features.items(): qdb.write('/features-request/' + feature, value)