table of contents
|FINIT(8)||System Manager's Manual (smm)||FINIT(8)|
finit — Fast init
for Linux systems
||[finit.status_style=classic] [finit.show_status=[on,off]] [finit.debug] [rescue | recover] [single | S]|
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.
- 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.
finitto reload its configuration file(s), same as
- Restart API (
finitto perform a system shutdown, same as
- Like SIGUSR2 but performs a reboot, same as
- 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
- Sent from a a power daemon on changes to UPS status, Finit asserts the sys/pwr/fail condition
- Main configuration file
- Static service definitions
- Available services
- Symlinks from available
- Runtime files, including the condition subsystem
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|