From: Yu Watanabe Date: Sun, 4 Aug 2024 05:07:13 +0000 (+0900) Subject: systemctl: refuse --capsule=foo with --system X-Git-Tag: v257-rc1~729^2~1 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=bcf982223cc5d051818dc88866a42f6a08f39a4a;p=thirdparty%2Fsystemd.git systemctl: refuse --capsule=foo with --system Fixes the following assertion: === systemctl --capsule=hoge --system reboot Assertion 'runtime_scope == RUNTIME_SCOPE_USER' failed at src/shared/bus-util.c:479, function bus_connect_transport(). Aborting. Aborted (core dumped) === Follow-up for 56cb74c3cd1358d7d0b3f613feaf2eeab601a6bd. --- diff --git a/src/systemctl/systemctl.c b/src/systemctl/systemctl.c index 5bb6ccacf7f..1e36455cf21 100644 --- a/src/systemctl/systemctl.c +++ b/src/systemctl/systemctl.c @@ -1075,6 +1075,10 @@ static int systemctl_parse_argv(int argc, char *argv[]) { return log_error_errno(SYNTHETIC_ERRNO(EINVAL), "Cannot access user instance remotely."); + if (arg_transport == BUS_TRANSPORT_CAPSULE && arg_runtime_scope != RUNTIME_SCOPE_USER) + return log_error_errno(SYNTHETIC_ERRNO(EINVAL), + "Cannot access system instance with --capsule=/-C."); + if (arg_wait && arg_no_block) return log_error_errno(SYNTHETIC_ERRNO(EINVAL), "--wait may not be combined with --no-block.");