Simplify, drop --enable-fallback-shell from configure script

Recommend using `notty` option in tty stanza instead.  See the updated
docs for details.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
This commit is contained in:
Joachim Wiberg
2021-04-18 23:13:19 +02:00
parent aee92751ac
commit 7f76202865
8 changed files with 20 additions and 53 deletions
+1 -8
View File
@@ -53,10 +53,6 @@ AC_ARG_ENABLE(emergency_shell,
Use only for debugging very early boot problems with Finit]),,[
enable_emergency_shell=no])
AC_ARG_ENABLE(fallback_shell,
AS_HELP_STRING([--enable-fallback-shell], [Start a shell if no TTYs can start]),,[
enable_fallback_shell=no])
AC_ARG_ENABLE(auto_reload,
AS_HELP_STRING([--enable-auto-reload], [Automatic reload on any .conf change]),,[
enable_auto_reload=no])
@@ -130,13 +126,10 @@ AC_ARG_WITH(random-seed,
### Enable features ###########################################################################
# Create config.h from selected features and fallback defautls
# Create config.h from selected features and fallback defaults
AS_IF([test "x$enable_emergency_shell" = "xyes"], [
AC_DEFINE(EMERGENCY_SHELL, 1, [Fork off init and let PID 1 wait and start /bin/sh if init crashes.])])
AS_IF([test "x$enable_fallback_shell" = "xyes"], [
AC_DEFINE(FALLBACK_SHELL, 1, [Start /bin/sh on console if no TTYs.])])
AS_IF([test "x$enable_auto_reload" = "xyes"], [
AC_DEFINE(AUTO_RELOAD, 1, [Finit automatically does `initctl reload` on any .conf change])])
+1 -1
View File
@@ -34,7 +34,7 @@ Bootstrap
24. Call 4th level hooks, `HOOK_SVC_UP`
25. Call `/etc/rc.local`, if it exists and is an executable shell script
26. Call 5th level (last) hooks, `HOOK_SYSTEM_UP`
27. Start all configured TTYs, or a fallback shell on `/dev/console`
27. Start all configured TTYs
In (19) and (22) tasks and services defined in `/etc/finit.conf` and
`/etc/sysctl.d/*.conf` are started. Remember, all `service` and `task`
+10 -7
View File
@@ -153,19 +153,22 @@ kernel messages and add `debug` to enable Finit debug messages.
append="init=/sbin/finit debug"
```
To debug startup issues, in particular issues with getty/login, try
`configure --enable-fallback-shell`. When no TTYs are detected, and
Finit is configured with this option, Finit will try to start a bare
`/bin/sh` on the boot console. Remember, this is only for debugging
and would leave your production system potentially wide open.
To debug startup issues, in particular issues with getty/login, add
the following to your Finit .conf file:
tty [12345789] notty noclear
The `notty` option ensures reusing the stdin/stdout set up by the
kernel. Remember, this is only for debugging and would leave your
production system potentially wide open.
There is also a rescue shell available, in case Finit crashes and the
kernel usually reboots: `configure --enable-emergency-shell`. However,
the behavior of Finit is severely limited when this is enabled, so use
it only for debugging start up issues when Finit crashes.
**NOTE:** Neither of these two configure options should be enabled on
production systems since they can potentially give a user root access.
**NOTE:** Neither of these options should be enabled on production
systems since they can potentially give a user root access.
[1]: ftp://troglobit.com/finit/finit-3.0.tar.xz
+7 -5
View File
@@ -522,12 +522,14 @@ can be omitted to keep the kernel default.
tty [12345] @console noclear vt220
On really bare bones systems Finit offers a fallback shell, which
should not be enabled on production systems since. This because it
may give a user root access without having to log in. However, for
bringup and system debugging it can come in handy:
On really bare bones systems Finit can give you a shell prompt as
soon as bootstrap is done, without opening any device node:
configure --enable-fallback-shell
tty [12345789] notty noclear
This should of course not be enabled on production systems. Because it
may give a user root access without having to log in. However, for
board bringup and system debugging it can come in handy.
One can also use the `service` stanza to start a stand-alone shell:
-4
View File
@@ -737,10 +737,6 @@ int conf_reload(void)
globfree(&gl);
/* Verify config, do we have at least one TTY available? */
if (tty_fallback(FINIT_CONF))
logit(LOG_WARNING, "warning, no getty enabled on local TTYs.");
/* Mark any reverse deps as chenaged. */
service_update_rdeps();
+1 -1
View File
@@ -433,7 +433,7 @@ svc_t *svc_find_by_tty(char *dev)
{
svc_t *svc, *iter = NULL;
/* this is valid for fallback shells */
/* this is valid for fallback (notty) shells */
if (!dev)
return NULL;
-26
View File
@@ -286,32 +286,6 @@ int tty_exec(svc_t *tty)
return run_getty2(dev, tty->cmd, args, tty->noclear, tty->nowait, tty->rlimit);
}
/*
* Fallback shell if no TTYs are active
*/
int tty_fallback(char *file)
{
svc_t *svc, *iter = NULL;
size_t num = 0;
for (svc = svc_iterator(&iter, 1); svc; svc = svc_iterator(&iter, 0)) {
if (!svc_is_tty(svc) || svc_is_removed(svc))
continue;
num++;
}
#ifdef FALLBACK_SHELL
char line[32] = "tty [12345789] notty noclear";
if (!num) {
_d("No TTY active in configuration, enabling fallback shell.");
return service_register(SVC_TYPE_TTY, line, global_rlimit, file);
}
#endif
return num == 0;
}
/**
* Local Variables:
* indent-tabs-mode: t
-1
View File
@@ -51,7 +51,6 @@ int tty_parse_args (char *cmdline, struct tty *tty);
int tty_exists (char *dev);
int tty_exec (svc_t *tty);
int tty_fallback (char *file);
#endif /* FINIT_TTY_H_ */