diff --git a/doc/build.md b/doc/build.md index 996a08be..21aa9878 100644 --- a/doc/build.md +++ b/doc/build.md @@ -153,6 +153,9 @@ enabled. The default Finit rescue mode configuration is installed into By default the a root shell, without login, is started. +> **Note:** in this mode `initctl` will not work. Use the `-f` flag to +> force `reboot`, `shutdown`, or `poweroff`. + Debugging --------- diff --git a/doc/cmdline.md b/doc/cmdline.md index c0dab112..30b029be 100644 --- a/doc/cmdline.md +++ b/doc/cmdline.md @@ -63,7 +63,10 @@ The `bool` setting is one of `on, off, true false, 1, 0`. you will be given a root login to a maintenance shell. However, if `sulogin` is missing, the file `/lib/finit/rescue.conf` is read and the system booted in a limited fallback mode. See [config.md][] - for more information. + for more information. + + **Note:** in this mode `initctl` will not work. Correct the problem + and use `reboot -f` to force reboot. * `single`, or `S`: Single user mode, runlevel 1, in Finit. Useful to debug problems with the regular runlevel. All services and TTYs in diff --git a/doc/config.md b/doc/config.md index 11eb9910..e593eb34 100644 --- a/doc/config.md +++ b/doc/config.md @@ -645,6 +645,9 @@ activate it. The rescue mode comes in two flavors; *traditional* and *fallback*. +> **Note:** in this mode `initctl` will not work. Use the `-f` flag to +> force `reboot`, `shutdown`, or `poweroff`. + ### Traditional diff --git a/src/reboot.c b/src/reboot.c index c047ceb4..69930155 100644 --- a/src/reboot.c +++ b/src/reboot.c @@ -26,6 +26,7 @@ #include #include #include +#include #include #include #include "util.h" @@ -159,6 +160,10 @@ int reboot_main(int argc, char *argv[]) /* Check for any overrides */ transform(NULL); + /* Check if we're in sulogin shell */ + if (getenv("SULOGIN")) + force = 1; + if (force) { sync(); diff --git a/src/sulogin.c b/src/sulogin.c index cd407217..62cb9360 100644 --- a/src/sulogin.c +++ b/src/sulogin.c @@ -193,6 +193,9 @@ int main(void) nopass: freepw(&pw); + /* tell initctl/reboot to trigger force mode */ + setenv("SULOGIN", "finit", 1); + return sh(); } }