summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2017-11-13 22:03:32 +0100
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2017-11-13 22:03:32 +0100
commit861f16d2679eeda79e8185057cef24653913e300 (patch)
tree99d72fa20574e6b90ef9bb1dbaa576efaab43d63
parentab8519c28b8904eb7e4f06d6b86614c7e6157f1a (diff)
downloadsystemd-861f16d2679eeda79e8185057cef24653913e300.tar.gz
systemctl: print a friendly message when systemctl is invoked, but PID 1 is not systemd (#7318)
We only show this message when we can't talk to systemd, so that client side install can work. Fixes: https://bugzilla.freedesktop.org/show_bug.cgi?id=69962
-rw-r--r--src/systemctl/systemctl.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/systemctl/systemctl.c b/src/systemctl/systemctl.c
index 670bff999c..f8c8c318a3 100644
--- a/src/systemctl/systemctl.c
+++ b/src/systemctl/systemctl.c
@@ -216,6 +216,12 @@ static int acquire_bus(BusFocus focus, sd_bus **ret) {
user = arg_scope != UNIT_FILE_SYSTEM;
+ if (!user && sd_booted() <= 0) {
+ /* Print a friendly message when the local system is actually not running systemd as PID 1. */
+ log_error("System has not been booted with systemd as init system (PID 1). Can't operate.");
+ return -EHOSTDOWN;
+ }
+
if (focus == BUS_MANAGER)
r = bus_connect_transport_systemd(arg_transport, arg_host, user, &busses[focus]);
else