diff options
author | Lennart Poettering <lennart@poettering.net> | 2022-12-02 23:52:12 +0100 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2022-12-02 23:56:20 +0100 |
commit | 0f958c8d4fc13ed1c1af928b2a7d91d31c7576eb (patch) | |
tree | c86e80986c2e6828b9dc65011cca009b5b364ebd /src/systemctl/systemctl.c | |
parent | 2075b6dd394e09a0f203b9cc7e3253908397f933 (diff) | |
download | systemd-0f958c8d4fc13ed1c1af928b2a7d91d31c7576eb.tar.gz |
systemctl: print a clear warning if people invoke systemctl without /proc/
Diffstat (limited to 'src/systemctl/systemctl.c')
-rw-r--r-- | src/systemctl/systemctl.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/systemctl/systemctl.c b/src/systemctl/systemctl.c index 4f2637f0f1..29f96681df 100644 --- a/src/systemctl/systemctl.c +++ b/src/systemctl/systemctl.c @@ -22,6 +22,7 @@ #include "rlimit-util.h" #include "sigbus.h" #include "signal-util.h" +#include "stat-util.h" #include "string-table.h" #include "systemctl-add-dependency.h" #include "systemctl-cancel-job.h" @@ -1148,6 +1149,13 @@ static int run(int argc, char *argv[]) { if (r <= 0) goto finish; + if (proc_mounted() == 0) + log_warning("%s%s/proc/ is not mounted. This is not a supported mode of operation. Please fix\n" + "your invocation environment to mount /proc/ and /sys/ properly. Proceeding anyway.\n" + "Your mileage may vary.", + emoji_enabled() ? special_glyph(SPECIAL_GLYPH_WARNING_SIGN) : "", + emoji_enabled() ? " " : ""); + if (arg_action != ACTION_SYSTEMCTL && running_in_chroot() > 0) { if (!arg_quiet) log_info("Running in chroot, ignoring request."); |