Finit v4.0
This release became v4.0, and not v3.2, because of incompatible changes to service conditions. There are other significant changes as well, so make sure to read the whole change log when upgrading.
Changes
- The stand-alone
reboottool has been replaced with a symlink toinitctl, like its siblings: halt, shutdown, poweroff, and suspend. Callingreboot& C:o now defaults to the correspondinginitctl cmdwith a fallback to sending signals as per traditional SysV init. The-f(force) flag remains, wherereboot(2)is called directly - Introducing Finit progress 𝓜𝓸𝓭𝓮𝓻𝓷
- The
inictl cond set|clear CONDhave changed completely. Constrained to a flat<usr/...>namespace and automatically activated by a newusr.soplugin that checks services for usr condition changes - Removed built-in inetd super server. If you need this functionality, use an external inetd, like xinetd, instead. A pull request for a stand-alone inetd, like watchdogd and getty, is most welcome!
- Incompatible
configurescript changes, i.e., no guessing--prefixand other paths. Also, many options have been changed, renamed, or flipped defaults, or even dropped altogether. There are examples in the documentation and thecontrib/section - Service conditions change from the non-obvious
<svc/path/to/foo>to<pid/foo:id>. Not only does this give simpler internal semantics, it hopefully also makes it clear that one service'spid:!foopidfile is another service's<pid/foo>condition, issue #143 - Initial support for cgroups v2:
- services runs in a cgroup named after their respective *.conf file
- top-level groups are; init, user, and system
- all top-level groups can be configured from finit *.conf files
- each service can tweak the cgroup settings
- Use
initctl [top|ps|cgroup]commands to inspect runtime state - https://twitter.com/b0rk/status/1214341831049252870?s=20
- Major refactor of Finit's
main()function to be able to start the event loop earlier. This also facilitated factoring out functionality previously hard-coded in Finit, e.g., starting the bundled watchdogd, various distro packed udevd and other hotplugging tools - A proper rescue mode has been added. It is started extremely early and is protected with a bundled
suslogin. Exiting rescue mode now brings up the system as a normal boot, as one expects - Support for
sysvstart/stop scripts as well as monitoring forking services, stared usingsysvorservicestanza - Support for custom
kill:DELAY, default 3 sec. - Support for custom
halt:SIGNAL, default SIGTERM - Support for
pre:scriptandpost:script, allows for setup and teardown/cleanup before and after a service runs, issue #129 - Support for
env:filein/etc/default/fooor/etc/conf.d/foo, see the contrib section for examples that utilize this feature. Variables expanded from env files, and the env files themselves, are tracked for changes to see if a service .conf file is "dirty" and needs restart oninitctl reload - Support for tracking custom PID files, using
pid:!/path/to/foo.pid, useful with newsysvorservicewhich fork to background - Support starting run/task/services without absolute path, trust
$PATH - Add support for
--disable-docand--disable-contribto speed up builds and work around issue with massively parallel builds - Support for
@consolealso for external getty - Support for
nottyoption to built-in getty, for board bring-up - Support for
rescueoption to built-in getty, for rescue shells - Add
-b, batch mode, for non-interactive use toinitctl - Prefer udev to handle
/dev/if mdev is also available - Redirect dbus daemon output to syslog
- Set
$SHELL, like$PATH, to a sane default value, needed by BusyBox - Finit no longer automatically reloads its
*.conffiles after running/etc/rc.localor run-parts. Useinitctl reloadinstead. initctlwithout an argument or option now defaults to list services- Convert built-in watchdog daemon to standalone mini watchdogd, issue #102
- Improved watchdog hand-over, now based on
svc_tand not PID - Extended bootstrap, runlevel S, timeout: 10 --> 120 sec. before services not allowed in the runtime runlevel are unconditionally stopped
- Removed
HOOK_SVC_STARTandHOOK_SVC_LOST, caused more problems than they were worth. Users are encouraged to use accounting instead - Skip displaying "Restarting ..." progress for bootstrap processes
- Added a simple work queue mechanism to queue up work at boot + runtime
- Postpone deletion of
svc_tuntil anySIGKILLtimer has elapsed - As long as a stepped service changes state we queue another step all event, because services may depend on each other
- Postpone deletion of
- Require new libuEv API:
uev_init1()to reduce event cache so that the kernel can invalidate deleted events before enqueing to userspace - Rename
hwclock.soplugin tortc.sosince it now is stand-alone from thehwclocktool. Note: the kernel can also be set to load and store RTC to/from system clock at boot/halt as well, issue #110 - New plugin to support cold plugging devices, auto-loading of modules at boot. Detects required modules by reading
/sys/devices/* - New plugin for
/etc/modules-load.d/by Robert Andersson, Atlas Copco - New
name:foosupport for services, by Robert Andersson, Atlas Copco - New
manual:yessupport for services, by Robert Andersson, Atlas Copco - New
log:consolesupport for services, by Robert Andersson, Atlas Copco - Support for
:IDas a string, by Jonas Johansson, Westermo - Support for auto-reload, instead of having to do
initctl reload, when a service configuration has changed. Disabled by default, but can be enabled with./configure --enable-auto-reload - Support for logging security related events, e.g., runlevel change, start/stop or failure to start services, by Jonas Holmberg, Westermo
- Mount devtpts with recommended
ptxmode=0666 - Mount /run tmpfs with nosuid,nodev,noexec for added security
- Support for
consoleas alias for@consolein tty stanzas - Drop
--enable-rw-rootsconfigure option, userwfor your/partition in/etc/fstabinstead to trigger remount at boot - Drop default tty speed (38400) and use 0 (kernel default) instead
- Make
:IDoptional, use NULL/zero internally this allows ... - Handle use-cases where multiple services share the same PID file and thus the same condition path, e.g. different instances for different runlevels. Allow custom condition path with
name:foosyntax, creates conditions w/o a path, and ... - Always append
:IDqualifier to conditions if set for a service - The IPC socket has moved from
/run/finit.sockto/run/finit/socketofficially only supported for use by theinitctltool - The IPC socket now uses
SOCK_SEQPACKETinstead ofSOCK_STREAM.
Recommend using watchdogd v3.4, or later, which support this - Improved support for modern
/etc/network/interfaces, which has include statements. No more nativeifupof individual interfaces,
Finit now callsifup -a, orifdown -a, delegating all details to the operating system. Also, this is now done in the background, by popular request
Fixes
- Fix #96: Start udevd as a proper service
- Ensure we track run commands as well as task/service, once per runlevel
- Ensure run/tasks also go to stopping state on exit, like services, otherwise it is unnecessarily hard to restart them
- Fix missing OS/Finit title bug, adds leading newline before banner
- Remove "Failed connecting to watchdog ..." error message on systems that do not have a watchdog
- Fix #100: Early condition handling may not work if
/var/rundoes not yet exist (symlink to/run). Added compat layer for access - Fix #101: Built-in inetd removed
- Fix #102: Start built-in watchdogd as a regular service
- Fix #103: Register multiple getty if
@consoleresolves to >1 TTY, - Fix #105: Only remove /etc/nologin when moving from runlevel 0, 1, 6. Fixed by Jonas Johansson, Westermo
- Fix #109: Support for PID files in sub-directories to
/var/run - Handle rename of PID files, by Robert Andersson, Atlas Copco
- Fix #110: automatic modprobe of RTC devices, built-in hwclock
- Fix #120: Redirect
stdinto/dev/nullfor services by default - Fix #122: Switch to
nanosleep()to achieve "signal safe" sleep. Fixed by Jacques de Laval, Westermo - Fix #124: Lingering processes in process group when session leader exits. E.g., lingering
logitprocesses when parent dies - Fix #127: Show all runparts scripts as they start, like
rc.local. Fixed by Jacques de Laval, Westermo - Fix service name matching, e.g. for condition handling, may match with wrong service. Fixed by Jonas Holmberg, Westermo
- Run all run-parts scripts using
/bin/sh -c foojust like the standard run-parts tool. Found by Magnus Malm, Westermo - Fix
initctl [start | restart], should behave the same for services that have crashed. Found by Mattias Walström, Westermo - Wait for bootstrap phase to complete before cleaning out any bootstrap processes that have stopped, they may be restarted again
- Reassert condition when an unmodified run/task/service goes from WAITING back to RUNNING again after a reconfiguration event. Found and fixed by Jonas Johansson, Westermo
- Restore Ctrl-D and Ctrl-U support in built-in getty
- Remove service condition when service is deleted
- Fix C++ compilation issues, by Robert Andersson, Atlas Copco
- Build fixes for uClibc
- Provide service description for built-in watchdog daemon
- Fix #138: Handle
SIGPWRlikeSIGSUR2, i.e., power off the system - Drop the '%m' GNUism, for compat with older musl libc
- Fix #139: call
tzset()oninitctl reloadto activate system timezone changes (for logging)