bus-util: print a friendly message when PID1 is not systemd
Follow-up for 861f16d267.
Fixes #8913.
This commit is contained in:
+16
-4
@@ -1300,9 +1300,15 @@ int bus_connect_transport(BusTransport transport, const char *host, bool user, s
|
||||
case BUS_TRANSPORT_LOCAL:
|
||||
if (user)
|
||||
r = sd_bus_default_user(&bus);
|
||||
else
|
||||
r = sd_bus_default_system(&bus);
|
||||
else {
|
||||
if (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;
|
||||
}
|
||||
r = sd_bus_default_system(&bus);
|
||||
}
|
||||
break;
|
||||
|
||||
case BUS_TRANSPORT_REMOTE:
|
||||
@@ -1343,9 +1349,15 @@ int bus_connect_transport_systemd(BusTransport transport, const char *host, bool
|
||||
case BUS_TRANSPORT_LOCAL:
|
||||
if (user)
|
||||
r = bus_connect_user_systemd(bus);
|
||||
else
|
||||
r = bus_connect_system_systemd(bus);
|
||||
else {
|
||||
if (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;
|
||||
}
|
||||
r = bus_connect_system_systemd(bus);
|
||||
}
|
||||
break;
|
||||
|
||||
case BUS_TRANSPORT_REMOTE:
|
||||
|
||||
Reference in New Issue
Block a user