| 1 | Rescue Mode |
| 2 | =========== |
| 3 | |
| 4 | Finit supports a rescue mode which is activated by the `rescue` option |
| 5 | on the kernel command line. See [cmdline docs](../cmdline.md) for how to |
| 6 | activate it. |
| 7 | |
| 8 | This rescue mode can be disabled at configure time using: |
| 9 | |
| 10 | configure --without-rescue |
| 11 | |
| 12 | The rescue mode comes in two flavors; *traditional* and *fallback*. |
| 13 | |
| 14 | > [!NOTE] |
| 15 | > In this mode `initctl` will not work. Use the `-f` flag to force |
| 16 | > `reboot`, `shutdown`, or `poweroff`. |
| 17 | |
| 18 | Traditional |
| 19 | ----------- |
| 20 | |
| 21 | This is what most users expect. A very early maintenance login prompt, |
| 22 | served by the system `sulogin` program from util-linux, or BusyBox. If |
| 23 | that is not found in `$PATH`, the bundled `/libexec/finit/sulogin` |
| 24 | program is used instead. If a successful login is made, or if the user |
| 25 | exits (Ctrl-D), the rescue mode is ended and the system boots up |
| 26 | normally. |
| 27 | |
| 28 | > [!WARNING] |
| 29 | > The bundled sulogin in Finit can at configure time be given another |
| 30 | > user than the default (root). If the sulogin user does not have a |
| 31 | > password, or __the account is locked__, the user is presented with a |
| 32 | > prompt: `"Press enter to enter maintenance mode."`, which will open |
| 33 | > up a root shell *without prompting for password*! |
| 34 | |
| 35 | Fallback |
| 36 | -------- |
| 37 | |
| 38 | If no `sulogin` program is found, Finit tries to bring up as much of its |
| 39 | own functionality as possible, yet limiting many aspects, meaning; no |
| 40 | network, no `fsck` of file systems in `/etc/fstab`, no `/etc/rc.local`, |
| 41 | no `runparts`, and most plugins are skipped (except those that provide |
| 42 | functionality for the condition subsystem). |
| 43 | |
| 44 | Instead of reading `/etc/finit.conf` et al, system configuration is read |
| 45 | from `/lib/finit/rescue.conf`, which can be freely modified by the |
| 46 | system administrator. |
| 47 | |
| 48 | The bundled default `rescue.conf` contains nothing more than: |
| 49 | |
| 50 | runlevel 1 |
| 51 | tty [12345] rescue |
| 52 | |
| 53 | The `tty` has the `rescue` option set, which works similar to the board |
| 54 | bring-up tty option `notty`. The major difference being that `sulogin` |
| 55 | is started to query for root/admin password. If `sulogin` is not found, |
| 56 | `rescue` behaves like `notty` and gives a plain root shell prompt. |
| 57 | |
| 58 | If Finit cannot find `/lib/finit/rescue.conf` it defaults to: |
| 59 | |
| 60 | tty [12345] rescue |
| 61 | |
| 62 | There is no way to exit the *fallback* rescue mode. |