Fast init for Linux systems

- 3 mins read

Finit is an alternative to SysV init and systemd, originally reverse engineered from the EeePC fastinit by Claudio Matsuoka — “gaps filled with frog DNA …”

Latest release available on GitHub

Features

  • 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
  • Sourcing environment files
  • Conditions for network/process/custom dependencies
  • Pre/Post script actions
  • Tooling to enable/disable services
  • Optional built-in getty
  • Optional built-in watchdog, with support for hand-over to watchdogd
  • Built-in support for Debian/BusyBox /etc/network/interfaces, automatically calls ifup/ifdown
  • Cgroups v2, both configuration and monitoring in initctl top
  • Plugin support for customization
  • Proper rescue mode with bundled sulogin for protected maintenance shell (optional)

Used By

The GitHub finit/contrib/ section, also part of the release tarball, include sample configurations for Debian, Void, and Alpine Linux.

Alpine Linux v3.19 with Finit v4.7

Alpine Linux v3.19 with Finit v4.7

The following Buildroot derivatives provide examples of how to boot embedded systems with Finit:

There’s even a br2-external demo available, with a downloadable image, which may be more accessible to beginners.

On the desktop and server side, Finix, by Aaron Andersen, builds a full Linux distribution around Finit.

Configuration

Finit reads its setup from /etc/finit.conf and, in the recommended “split layout”, one foo.conf file per service in /etc/finit.d/. Available but not-yet-enabled services live in /etc/finit.d/available and are turned on with the initctl tool. A small taste:

# Monitor and (re)start these services as needed
service [S12345] syslogd -n -b 3 -D              -- System log daemon
service [S12345] watchdogd -L -f                 -- HW watchdog daemon
service   [2345] sshd -D                         -- OpenSSH daemon

# Wait for a default route before starting NTP, log stdout/stderr
service [2345] log <net/route/default> ntpd -n -l -I eth0 -- NTP daemon

# A getty on the first VT and the serial console
tty [12345] /dev/tty1  linux
tty [12345] @console   noclear

The service stanza, as well as task, run and others, share the same shape:

service [LVLS] <COND> log env:[-]/etc/default/daemon daemon ARGS -- Daemon daemon
^       ^      ^      ^   ^                          ^              ^       ^
|       |      |      |   |                          |              |        `-- Optional description
|       |      |      |   |                          |              `----------- Daemon arguments
|       |      |      |   |                          `-------------------------- Path to daemon
|       |      |      |    `---------------------------------------------------- Optional env. file
|       |      |       `-------------------------------------------------------- Redirect output to log
|       |       `--------------------------------------------------------------- Optional conditions
|        `---------------------------------------------------------------------- Optional Runlevels
 `------------------------------------------------------------------------------ Monitored application

Runlevels, conditions and the description are all optional, so simple cases stay simple:

service /usr/sbin/sshd -D

Dependencies are expressed with conditions. Here Finit waits for basic networking before starting nginx, and stops it again if the default route goes away:

service <net/route/default> nginx -- High performance HTTP server

At runtime the initctl tool queries status and starts, stops, and reloads services.

Note: make sure daemons do not fork and detach from the controlling TTY, usually an -n, -f, or -D flag. If a daemon detaches, Finit cannot monitor it and will try to restart it.

Blog Posts

For more on the features above, see the following posts:

Documentation

This page is just a taste. Finit now has thorough, well-organized documentation covering the full boot sequence, every stanza, and each plugin: https://finit-project.github.io

Origin

This project is the continuation of the original finit by Claudio Matsuoka, which was reverse engineered from syscalls of the EeePC fastinit daemon.

Please file bug reports, clone it, or send pull requests for bug fixes and proposed extensions using GitHub: