mirror of
https://github.com/troglobit/finit.git
synced 2026-09-30 21:13:01 +07:00
Fix #247: fall back to reboot -f in sulogin mode
When logged in from sulogin we cannot send IPC to Finit, not even signals, to delegate reboot. For usability, attempt to tell reboot that it's in sulogin mode -- provided the bundled sulogin is used -- to let reboot trigger over to forced reboot. We cannot do much about initctl, just document this as a limitation. Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
This commit is contained in:
@@ -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
|
||||
---------
|
||||
|
||||
+4
-1
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -26,6 +26,7 @@
|
||||
#include <getopt.h>
|
||||
#include <signal.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
#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();
|
||||
|
||||
|
||||
@@ -193,6 +193,9 @@ int main(void)
|
||||
nopass:
|
||||
freepw(&pw);
|
||||
|
||||
/* tell initctl/reboot to trigger force mode */
|
||||
setenv("SULOGIN", "finit", 1);
|
||||
|
||||
return sh();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user