Without trigger, kernel modules won't be loaded automatically. Also
devices are not managed. For example, i915 was not loaded after boot
and my network card was not renamed from wlan0 to wlp3s0, which means
it was not handled properly by udev.
Signed-off-by: Wang He <xw897002528@gmail.com>
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
This patch fixes a long-standing issue with how Finit handles shutdown,
reboot and poweroff -- and even runlevel changes to runlevel 0 and 6.
Prior to this patch sig.c:do_shutdown() was called immediately on any
of the above events, disregarding any services that a user might have
wanted to run as part of the shutdown/reboot.
With this change the handling is unified in all frontends to instead
do a runlevel change followed by the do_shutdown() action.
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
The /etc/nologin file must be set as soon as the runlevel change to
0/1/6 comes in, not when done with runlevel change and services have
been started, if any.
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
As a last ditch effort to understand why an embedded system doesn't
boot, the operator should be able to see as much logs as possible
when enabling --debug mode on the kernel command line.
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
This patch adds an `--enable-fallback-shell` option to confiugre.
When enabled Finit will start `/bin/sh` on the console, but only
if there are no active TTYs running in the current runlevel.
With this it will be easier to do board bringup with Finit, but it also
enables using the fallback shell in a rescue mode (runlevel) where no
TTYs are allowed to run.
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
Also changes the default to set $HOME to / instead of nothing. This can
of course be improved immensely. Pull requests always welcome ;-)
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
This patch removes the now heavily outdated (and non-working) support
for callback plugins. I.e. plugins that attach themselves to services
listed in /etc/finit.conf and can be queried to determine if a service
should be started or stopped.
The Finit3 support for adding/removing services at runtime with plain
text *.conf files in /etc/finit.d and `initctl reload`, this old, and
rather cumbersome service callback feature, is not longer supported.
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
Add support for registering callbacks to be called after a given
timeout.
Use this to implement forceful termination of services that refuse to
terminate upon receiving a SIGTERM. If the service PID is not collected
within 3 seconds, send a SIGKILL to it.
Also, rework restarting of crashing services. When a service crashes for
the first time, try to restart it immediately. If it crashes again, wait
a few seconds before trying again. Just as before, if it continues to
crash, block the service.
This patch prevents double critical/error messages from being printed on
the console when there is no syslog daemon running yet.
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
Delay setup of initctl plugin to after the base filesystems are up and
after the bootmisc plugin has run.
This patch factors out the I/O initialization of plugins so it does not
have to run when plugins are loaded. Instead, plugins can now call this
API to register an I/O callback when they are ready.
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
In UTMP a terminating zero in string fields is optional, so we need to
take that into account when preparing entrys.
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
This patch makes Finit require libuEv v1.4.2, a minor bugfix update, and
libite (-lite) v1.8.2, which is quite a bit more than just a few bug
fixes. The most relevant fixes are the removal of implicit logging for
touch(), makedir(), makefifo(), and erase() inline functions. The
release also removed implicit logging to stderr on error, as well as a
a few build fixes for running on musl libc.
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
This patch adds a very special debug mode to Finit. With this feature
enabled the actual duties of PID 1 is forked off early to a child. If
that child ever dies, usually due to a SIGSEGV, this wakes up the real
PID 1 which lauches a debug shell on the console.
Remember to disable 'quiet' and enable '--debug' on the kernel command
line to get all the debug logs -- which these days goes into the kernel
log in /dev/kmsg -- simply `cat /dev/kmsg` and use Ctrl-C to get the
shell prompt back.
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>