diff --git a/finit.c b/finit.c index 682c514c..93485f42 100644 --- a/finit.c +++ b/finit.c @@ -133,10 +133,20 @@ static int client(int argc, char *argv[]) static int run_loop(void) { + int delay = DELAY_TTY ?: 1; + _d("Entering main loop ..."); while (1) { svc_monitor(); plugin_monitor(); + + /* Delayed start of TTYs to let the system stabilize + * after switching runlevels. */ + if (delay) { + if (--delay == 0) + tty_runlevel(runlevel); + continue; + } } return 0; @@ -269,9 +279,6 @@ int main(int argc, char* argv[]) /* Hooks that should run at the very end */ plugin_run_hooks(HOOK_SYSTEM_UP); - /* Start GETTY on console(s) */ - tty_runlevel(runlevel); - /* * Enter main loop to monior /dev/initctl and services */ diff --git a/finit.h b/finit.h index 93736e7e..b8981926 100644 --- a/finit.h +++ b/finit.h @@ -60,6 +60,9 @@ # define DEFHOST "noname" #endif +/* Delay start of GETTY at boot. Must be > 0 */ +#define DELAY_TTY 2 + #define CMD_SIZE 256 #define LINE_SIZE 1024 #define BUF_SIZE 4096