Running as a user instance won't work at all if systemd isn't running as system
manager, so refuse to start in that case.

Signed-off-by: Thomas Bächler <[email protected]>
---
 src/core/main.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/src/core/main.c b/src/core/main.c
index f9aba46..3df38c2 100644
--- a/src/core/main.c
+++ b/src/core/main.c
@@ -62,6 +62,7 @@
 #include "hwclock.h"
 #include "selinux-setup.h"
 #include "ima-setup.h"
+#include "sd-daemon.h"
 
 static enum {
         ACTION_RUN,
@@ -1381,6 +1382,10 @@ int main(int argc, char *argv[]) {
         } else {
 
                 /* Running as user instance */
+                if(!sd_booted()) {
+                        log_error("Trying to run as user instance, but the 
system has not been booted with systemd.");
+                        goto finish;
+                }
                 arg_running_as = SYSTEMD_USER;
                 log_set_target(LOG_TARGET_AUTO);
                 log_open();
-- 
1.7.12.2

_______________________________________________
systemd-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/systemd-devel

Reply via email to