mirror of
https://github.com/troglobit/finit.git
synced 2026-09-30 13:02:37 +07:00
406 lines
11 KiB
Plaintext
406 lines
11 KiB
Plaintext
.\" Hey, EMACS: -*- nroff -*-
|
|
.\" First parameter, NAME, should be all caps
|
|
.\" Second parameter, SECTION, should be 1-8, maybe w/ subsection
|
|
.\" other parameters are allowed: see man(7), man(1)
|
|
.Dd Jul 9, 2025
|
|
.\" Please adjust this date whenever revising the manpage.
|
|
.Dt FINIT 8 SMM
|
|
.Os Linux
|
|
.Sh NAME
|
|
.Nm finit
|
|
.Nd Fast init for Linux systems
|
|
.Sh SYNOPSIS
|
|
.Nm /sbin/finit --
|
|
.Op debug
|
|
.Op quiet
|
|
.Op rescue | recover
|
|
.Op single | S
|
|
.Op panic=SEC
|
|
.Op loglevel=<0-7>
|
|
.Op fsck.mode=[auto,skip,force]
|
|
.Op fsck.repair=[no,yes,preen]
|
|
.Op finit.debug=<true,false>
|
|
.Op finit.fstab=/path/to/fstab
|
|
.Op finit.cond=foo[,bar[,baz]]
|
|
.Op finit.config=/path/to/finit.conf
|
|
.Op finit.status_style=<classic,modern>
|
|
.Op finit.status=<on,off>
|
|
.Nm /sbin/telinit
|
|
.Op Fl hv
|
|
.Op q | Q | s | S | 0-9
|
|
.Sh DESCRIPTION
|
|
Fast init for Linux systems. Reverse engineered from the EeePC
|
|
fastinit, 10+ years ago by Claudio Matsuoka, "gaps filled with frog
|
|
DNA ...". Focus is on small and embedded systems, although Finit is
|
|
fully usable on server and desktop systems as well.
|
|
.Sh OPTIONS
|
|
When
|
|
.Sy not
|
|
started as PID 1,
|
|
.Nm
|
|
behaves like
|
|
.Nm telinit ,
|
|
following classic UNIX command line syntax. The options are:
|
|
.Pp
|
|
.Bl -tag -width Ds -compact -offset indent
|
|
.It Fl h
|
|
Show built-in help text.
|
|
.It Fl v
|
|
Show program version.
|
|
.El
|
|
.Pp
|
|
More options are implemented for SysV init support, but are ignored.
|
|
.Sh ARGUMENTS
|
|
When
|
|
.Sy not
|
|
started as PID 1,
|
|
.Nm ,
|
|
or
|
|
.Nm telinit ,
|
|
take these arguments:
|
|
.Pp
|
|
.Bl -tag -width Ds -compact -offset indent
|
|
.It q | Q
|
|
Reload configuration, same as
|
|
.Cm initctl reload .
|
|
.It 0 - 9
|
|
Go to runlevel N, same as
|
|
.Cm initctl reload N .
|
|
.It s | S
|
|
Go to single user mode, runlevel 1.
|
|
.El
|
|
.Sh FEATURES
|
|
.Bl -bullet -width 1n -compact
|
|
.It
|
|
Runlevels, defined per service
|
|
.It
|
|
One-shot tasks, services (daemons), or SysV init start/stop scripts
|
|
.It
|
|
Runparts and
|
|
.Pa /etc/rc.local
|
|
support
|
|
.It
|
|
Process supervision similar to
|
|
.Xr systemd 8
|
|
.It
|
|
Sourcing environment files
|
|
.It
|
|
Conditions for network/process/custom dependencies
|
|
.It
|
|
Process readiness notification for synchronizing system startup as well
|
|
as reconfiguration at runtime. Natively PID files are used, but systemd
|
|
.Cm sd_notify()
|
|
and s6 notification is also supported.
|
|
.It
|
|
Limited support for
|
|
.Xr tmpfiles.d 5 ,
|
|
no aging, attributes, or subvolumes
|
|
.It
|
|
Pre/Post script actions
|
|
.It
|
|
Tooling to enable/disable services
|
|
.It
|
|
Built-in getty
|
|
.It
|
|
Built-in watchdog, with support for hand-over to
|
|
.Lk https://troglobit.com/watchdogd.html watchdogd
|
|
.It
|
|
Built-in support for Debian/BusyBox
|
|
.Pa /etc/network/interfaces
|
|
.It
|
|
Cgroups v2, both configuration and monitoring in `initctl top`
|
|
.It
|
|
Plugin support for customization
|
|
.It
|
|
Proper rescue mode with bundled `sulogin` for protected maintenance shell
|
|
.El
|
|
.Sh BOOTPARAM
|
|
.Nm
|
|
support the following command line parameters to alter the behavior
|
|
at boot. Notice the
|
|
.Cm --
|
|
separator needed to tell the kernel which paramters should be given to
|
|
PID 1. For more information on this, and available kernel command line
|
|
options, see
|
|
.Xr bootparam 7 .
|
|
.Bl -tag -width pid -offset indent
|
|
.It Cm debug
|
|
Enable kernel debug. Debug messages are printed to the console until
|
|
Finit starts up, unless
|
|
.Cm loglevel=7
|
|
(below) is used.
|
|
.It Cm fsck.mode=<auto,force,skip>
|
|
Defaults to
|
|
.Cm auto ,
|
|
unless Finit is built with
|
|
.Cm configure --enable-fastboot ,
|
|
in which case the default is
|
|
.Cm skip .
|
|
.It Cm fsck.repair=<preen,yes,no>
|
|
Defaults to
|
|
.Cm preen ,
|
|
unless Finit is built with
|
|
.Cm configure --enable-fsckfix ,
|
|
in which case the default is
|
|
.Cm yes .
|
|
This configure option also sets
|
|
.Cm fsck.mode=force ,
|
|
unless fastboot is also enabled. I.e.,
|
|
.Cm configure --enable-fastboot
|
|
build option overrides the
|
|
.Cm fsck.mode
|
|
default value.
|
|
.It Cm finit.cond=foo[,bar[,baz]]
|
|
set
|
|
.Cm <boot/foo>
|
|
condition, optionally multiple conditions can be set using the same
|
|
option, separated with a comma. Alternatively, multiple
|
|
.Cm foo.cond=arg
|
|
can be given. Each will result in a
|
|
.Cm <boot/arg>
|
|
condition being set to control the rest of the system bootstrap.
|
|
.Pp
|
|
Very useful for selecting different boot modes, e.g. manufacturing test,
|
|
firmware upgrade, or rescue mode.
|
|
.Pp
|
|
.Sy Note:
|
|
.Cm <boot/...>
|
|
conditions cannot be cleared with
|
|
.Nm initctl !
|
|
.It Cm finit.config=/path/to/alternative/finit.conf
|
|
override the compile-time bootstrap config file, default:
|
|
.Bd -unfilled -offset indent
|
|
./configure --with-config=/etc/finit.conf
|
|
.Ed
|
|
Useful when starting up in various rescue mode, factory, or
|
|
production test setups. Use the top-level configuration file
|
|
directive
|
|
.Cm rcsd Ar /path/to/finit.d
|
|
to override the default rcS.d directory.
|
|
.It Cm finit.debug
|
|
Enable Finit debug messages on system console and log. Sometimes useful
|
|
when doing board bringup. Before the system log daemon has started,
|
|
Finit use the kernel ring buffer,
|
|
.Pa /dev/kmsg .
|
|
.It Cm finit.fstab=/path/to/fstab.alt
|
|
Tell
|
|
.Nm
|
|
to use an alternate
|
|
.Cm fstab
|
|
to mount the file system from. Remember, this file must be on the
|
|
.Cm root=...
|
|
file system provided to Finit from the kernel. If this file is missing,
|
|
.Nm
|
|
falls back to its built-in default, which can be changed at build time
|
|
using the
|
|
.Cm --with-fstab=/path/to/footab
|
|
configure option. It is even possible to completely disable the
|
|
built-in using
|
|
.Cm --without-fstab ,
|
|
meaning
|
|
.Nm
|
|
.Sy must
|
|
be started with the
|
|
.Cm finit.fstab
|
|
option.
|
|
.Pp
|
|
Should
|
|
.Nm
|
|
discover that there is no fstab file available, including the fallback,
|
|
it triggers the same failure mode as when
|
|
.Cm fsck
|
|
fails, starting
|
|
.Xr sulogin 8 ,
|
|
if that is availble. When
|
|
.Cm sulogin
|
|
is missing, or when the user exits from
|
|
.Cm sulogin ,
|
|
the system is rebooted.
|
|
.Pp
|
|
Default fstab, unless changed at build-time:
|
|
.Pa /etc/fstab
|
|
.It Cm finit.status=<on,off>
|
|
Control finit boot progress, including banner. This used to be called
|
|
.Cm finit.show_status ,
|
|
which still works but is deprecated.
|
|
.It Cm finit.status_style=<classic,modern>
|
|
Set Finit boot progress style, when enabled.
|
|
.It Cm loglevel=<0-7>
|
|
set the kernel's log level, which is more granular than
|
|
.Cm debug .
|
|
Also, when
|
|
.Cm loglevel=7 ,
|
|
Finit will
|
|
.Em not disable
|
|
kernel logs to the console. This is very useful when debugging the
|
|
kernel at system bring-up. Since
|
|
.Cm loglevel=7
|
|
is the same as
|
|
.Cm debug
|
|
this means you have to use
|
|
.Cm quiet
|
|
for a quiet boot, until sysklogd takes over logging of kernel events.
|
|
.It Cm panic=SEC
|
|
By default the kernel does not reboot after a kernel panic. This
|
|
setting will cause a kernel reboot after
|
|
.Ar SEC
|
|
seconds.
|
|
.It Cm quiet
|
|
Suppress kernel logging to console, except for warnings and errors.
|
|
Also, see
|
|
.Cm loglevel
|
|
and
|
|
.Cm quiet
|
|
above.
|
|
.It Cm rescue | recover
|
|
Start rescue/maintenance mode. If your system comes with the bundled
|
|
.Cm sulogin
|
|
program (Finit, or from util-linux/Busybox), you will be given a root
|
|
login to a maintenance shell. However, if
|
|
.Cm sulogin
|
|
is missing, the file
|
|
.Pa /lib/finit/rescue.conf
|
|
is read and the system booted in a limited fallback mode. See
|
|
.Xr finit.conf 5
|
|
for more information.
|
|
.It Cm single | S
|
|
Single user mode, runlevel 1, in Finit. Useful to debug problems with
|
|
the regular runlevel. All services and TTYs in
|
|
.Cm [1]
|
|
will be started, e.g., a
|
|
.Cm tty [1] @console nologin
|
|
configuration presents you with a root console without login.
|
|
.Pp
|
|
.Sy Note:
|
|
by definition, single user mode does not have networking enabled. This
|
|
is also true for runlevel 1.
|
|
.El
|
|
.Sh BOOTING
|
|
.Pp
|
|
Before laucnhing services, the system needs to be bootstrapped. This
|
|
involves mounting all filesystems (not already mounted by an initramfs)
|
|
in
|
|
.Pa /etc/fstab ,
|
|
or any alternate
|
|
.Pa fstab
|
|
file provided on the Finit command line using
|
|
.Cm finit.fstab ,
|
|
ensuring that necessary filesystems like:
|
|
.Pa /dev ,
|
|
.Pa /proc ,
|
|
.Pa /sys ,
|
|
and
|
|
.Pa /run
|
|
are available and can provide the system with the services required.
|
|
.Pp
|
|
With that out of the way, a set of plugins take over:
|
|
.Pp
|
|
.Bl -tag -width bootmisc.so -offset indent
|
|
.It Cm bootmisc.so
|
|
Cleans up stale files from previous boots and default directories are
|
|
created in tmpfs filesystems
|
|
.It Cm modprobe.so
|
|
Probes kernel modules required by the system
|
|
.It Cm procps.so
|
|
Set kernel variables from
|
|
.Pa /etc/sysctl.conf
|
|
et al
|
|
.El
|
|
.Pp
|
|
When the plugins are done, finit reads
|
|
.Pa /etc/finit.conf
|
|
and all other enabled services in
|
|
.Pa /etc/finit.d/* .
|
|
First all services, run/tasks in runlevel S (bootStrap) are started,
|
|
When all run/tasks have completed, Finit changes to the configured
|
|
runlevel (default 2), Processes are started in parallel, in dependency
|
|
order according to their conditions.
|
|
.Pp
|
|
When all services and run/tasks have been started, the console progress
|
|
is disabled and all configured getty services are started.
|
|
.Sh CONDITIONS
|
|
The condition subysystem in Finit was initially created to track PID
|
|
files of daemons. If service/task B requires service A to have started,
|
|
Finit waits for the PID file of service A to be created/updated before
|
|
it starts service B. Conversely, if service A is stopped and its PID
|
|
file removed, service B is also stopped.
|
|
.Pp
|
|
The following condition families are available today:
|
|
.Pp
|
|
.Bl -tag -width service -offset indent
|
|
.It Cm net
|
|
Linux netlink events, e.g. net/route/default, net/eth0/up, and
|
|
net/et0/running
|
|
.It Cm pid
|
|
PID files based on the service declaration
|
|
.Cm name:id ,
|
|
gives the condition pid/name:id
|
|
.It Cm service
|
|
Tracks run/task/service state stansitions, including readiness. E.g.,
|
|
.Cm service/foo/ready
|
|
can be used as a condition for service
|
|
.Cm bar ,
|
|
provided
|
|
.Cm foo
|
|
properly signals its readiness to Finit.
|
|
.It Cm sys
|
|
System conditions, e.g. sys/key/ctrlaltdel and sys/pwr/fail
|
|
.It Cm usr
|
|
User conditions, assert and deassert using
|
|
.Cm initctl cond [set|clr] foo
|
|
.El
|
|
.Sh SIGNALS
|
|
PID 1 is the only process that by default blocks all signals. Finit
|
|
allows for the following signals to control operation, but recommends
|
|
instead using the
|
|
.Xr initctl 8
|
|
tool.
|
|
.Pp
|
|
.Bl -tag -width TERM
|
|
.It HUP
|
|
Tell
|
|
.Nm
|
|
to reload its configuration file(s), same as
|
|
.Cm initctl reload
|
|
.It USR1
|
|
Restart API
|
|
.Cm ( initctl )
|
|
socket.
|
|
.It USR2
|
|
Tell
|
|
.Nm
|
|
to perform a system shutdown, same as
|
|
.Cm initctl poweroff
|
|
.It TERM
|
|
Like SIGUSR2 but performs a reboot, same as
|
|
.Cm initctl reboot
|
|
.It INT
|
|
Sent from kernel when Ctrl-Alt-Del is pressed (on the console), this
|
|
asserts the sys/key/ctrlaltdel condition, which can be used to start
|
|
tasks or services
|
|
.It PWR
|
|
Sent from a a power daemon on changes to UPS status, Finit asserts
|
|
the sys/pwr/fail condition
|
|
.El
|
|
.Sh FILES
|
|
.Bl -tag -width /etc/finit.d/available/*.conf -compact
|
|
.It Pa /etc/finit.conf
|
|
Main configuration file
|
|
.It Pa /etc/finit.d/*.conf
|
|
Static service definitions
|
|
.It Pa /etc/finit.d/available/*.conf
|
|
Available services
|
|
.It Pa /etc/finit.d/enabled/*.conf
|
|
Symlinks from available
|
|
.It Pa /run/finit/
|
|
Runtime files, including the condition subsystem
|
|
.El
|
|
.Sh SEE ALSO
|
|
.Xr finit.conf 5
|
|
.Xr initctl 8
|
|
.Xr tmpfiles.d 5
|
|
.Sh AUTHORS
|
|
.Nm
|
|
was conceived and reverse engineered by Claudio Matsuoka. Since v1.0,
|
|
maintained by Joachim Wiberg, with contributions by many others.
|