DOKK / manpages / debian 12 / finit / finit.8.en
FINIT(8) System Manager's Manual (smm) FINIT(8)

finitFast init for Linux systems

/sbin/finit [finit.status_style=classic] [finit.show_status=[on,off]] [finit.debug] [rescue | recover] [single | S]

/sbin/telinit [-hv] [q | Q | 0-9]

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.

Features include:

  • Runlevels, defined per service
  • One-shot tasks, services (daemons), or SysV init start/stop scripts
  • Runparts and /etc/rc.local support
  • Process supervision similar to systemd(8)
  • Sourcing environment files
  • Conditions for network/process/custom dependencies
  • Pre/Post script actions
  • Tooling to enable/disable services
  • Built-in getty
  • Built-in watchdog, with support for hand-over to watchdogd
  • Built-in support for Debian/BusyBox /etc/network/interfaces
  • Cgroups v2, both configuration and monitoring in `initctl top`
  • Plugin support for customization
  • Proper rescue mode with bundled `sulogin` for protected maintenance shell

Before laucnhing services, the system needs to be bootstrapped. This involves mounting all filesystems (not already mounted by an initramfs) in /etc/fstab, ensuring that necessary filesystems like: /dev, /proc, /sys, and /run are available and can provide the system with the services required.

With that out of the way, a set of plugins take over:

Cleans up stale files from previous boots and default directories are created in tmpfs filesystems
Probes kernel modules required by the system
Set kernel variables from /etc/sysctl.conf et al

When the plugins are done, finit reads /etc/finit.conf and all other enabled services in /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.

When all services and run/tasks have been started, the console progress is disabled and all configured getty services are started.

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.

The following condition families are available today:

Linux netlink events, e.g. net/route/default, net/eth0/up, and net/et0/running
PID files basd on the service declaration name:id, gives the condition pid/name:id
System conditions, e.g. sys/key/ctrlaltdel and sys/pwr/fail
User conditions, assert and deassert using initctl cond [set|clr] foo

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 initctl(8) tool.

HUP
Tell finit to reload its configuration file(s), same as initctl reload
USR1
Restart API (initctl) socket.
USR2
Tell finit to perform a system shutdown, same as initctl poweroff
TERM
Like SIGUSR2 but performs a reboot, same as initctl reboot
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
PWR
Sent from a a power daemon on changes to UPS status, Finit asserts the sys/pwr/fail condition

/etc/finit.conf
Main configuration file
/etc/finit.d/*.conf
Static service definitions
/etc/finit.d/available/*.conf
Available services
/etc/finit.d/enabled/*.conf
Symlinks from available
/run/finit/
Runtime files, including the condition subsystem

finit.conf(5) initctl(8)

finit was conceived and reverse engineered by Claudio Matsuoka. Since v1.0, maintained by Joachim Wiberg, with contributions by many others.

June 6, 2021 Linux