Debian Codegraph @

man/finit.8

raw
1 .\" Hey, EMACS: -*- nroff -*-
2 .\" First parameter, NAME, should be all caps
3 .\" Second parameter, SECTION, should be 1-8, maybe w/ subsection
4 .\" other parameters are allowed: see man(7), man(1)
5 .Dd Jul 9, 2025
6 .\" Please adjust this date whenever revising the manpage.
7 .Dt FINIT 8 SMM
8 .Os Linux
9 .Sh NAME
10 .Nm finit
11 .Nd Fast init for Linux systems
12 .Sh SYNOPSIS
13 .Nm /sbin/finit --
14 .Op debug
15 .Op quiet
16 .Op rescue | recover
17 .Op single | S
18 .Op panic=SEC
19 .Op loglevel=<0-7>
20 .Op fsck.mode=[auto,skip,force]
21 .Op fsck.repair=[no,yes,preen]
22 .Op finit.debug=<true,false>
23 .Op finit.fstab=/path/to/fstab
24 .Op finit.cond=foo[,bar[,baz]]
25 .Op finit.config=/path/to/finit.conf
26 .Op finit.status_style=<classic,modern>
27 .Op finit.status=<on,off>
28 .Nm /sbin/telinit
29 .Op Fl hv
30 .Op q | Q | s | S | 0-9
31 .Sh DESCRIPTION
32 Fast init for Linux systems. Reverse engineered from the EeePC
33 fastinit, 10+ years ago by Claudio Matsuoka, "gaps filled with frog
34 DNA ...". Focus is on small and embedded systems, although Finit is
35 fully usable on server and desktop systems as well.
36 .Sh OPTIONS
37 When
38 .Sy not
39 started as PID 1,
40 .Nm
41 behaves like
42 .Nm telinit ,
43 following classic UNIX command line syntax. The options are:
44 .Pp
45 .Bl -tag -width Ds -compact -offset indent
46 .It Fl h
47 Show built-in help text.
48 .It Fl v
49 Show program version.
50 .El
51 .Pp
52 More options are implemented for SysV init support, but are ignored.
53 .Sh ARGUMENTS
54 When
55 .Sy not
56 started as PID 1,
57 .Nm ,
58 or
59 .Nm telinit ,
60 take these arguments:
61 .Pp
62 .Bl -tag -width Ds -compact -offset indent
63 .It q | Q
64 Reload configuration, same as
65 .Cm initctl reload .
66 .It 0 - 9
67 Go to runlevel N, same as
68 .Cm initctl reload N .
69 .It s | S
70 Go to single user mode, runlevel 1.
71 .El
72 .Sh FEATURES
73 .Bl -bullet -width 1n -compact
74 .It
75 Runlevels, defined per service
76 .It
77 One-shot tasks, services (daemons), or SysV init start/stop scripts
78 .It
79 Runparts and
80 .Pa /etc/rc.local
81 support
82 .It
83 Process supervision similar to
84 .Xr systemd 8
85 .It
86 Sourcing environment files
87 .It
88 Conditions for network/process/custom dependencies
89 .It
90 Process readiness notification for synchronizing system startup as well
91 as reconfiguration at runtime. Natively PID files are used, but systemd
92 .Cm sd_notify()
93 and s6 notification is also supported.
94 .It
95 Limited support for
96 .Xr tmpfiles.d 5 ,
97 no aging, attributes, or subvolumes
98 .It
99 Pre/Post script actions
100 .It
101 Tooling to enable/disable services
102 .It
103 Built-in getty
104 .It
105 Built-in watchdog, with support for hand-over to
106 .Lk https://troglobit.com/watchdogd.html watchdogd
107 .It
108 Built-in support for Debian/BusyBox
109 .Pa /etc/network/interfaces
110 .It
111 Cgroups v2, both configuration and monitoring in `initctl top`
112 .It
113 Plugin support for customization
114 .It
115 Proper rescue mode with bundled `sulogin` for protected maintenance shell
116 .El
117 .Sh BOOTPARAM
118 .Nm
119 support the following command line parameters to alter the behavior
120 at boot. Notice the
121 .Cm --
122 separator needed to tell the kernel which paramters should be given to
123 PID 1. For more information on this, and available kernel command line
124 options, see
125 .Xr bootparam 7 .
126 .Bl -tag -width pid -offset indent
127 .It Cm debug
128 Enable kernel debug. Debug messages are printed to the console until
129 Finit starts up, unless
130 .Cm loglevel=7
131 (below) is used.
132 .It Cm fsck.mode=<auto,force,skip>
133 Defaults to
134 .Cm auto ,
135 unless Finit is built with
136 .Cm configure --enable-fastboot ,
137 in which case the default is
138 .Cm skip .
139 .It Cm fsck.repair=<preen,yes,no>
140 Defaults to
141 .Cm preen ,
142 unless Finit is built with
143 .Cm configure --enable-fsckfix ,
144 in which case the default is
145 .Cm yes .
146 This configure option also sets
147 .Cm fsck.mode=force ,
148 unless fastboot is also enabled. I.e.,
149 .Cm configure --enable-fastboot
150 build option overrides the
151 .Cm fsck.mode
152 default value.
153 .It Cm finit.cond=foo[,bar[,baz]]
154 set
155 .Cm <boot/foo>
156 condition, optionally multiple conditions can be set using the same
157 option, separated with a comma. Alternatively, multiple
158 .Cm foo.cond=arg
159 can be given. Each will result in a
160 .Cm <boot/arg>
161 condition being set to control the rest of the system bootstrap.
162 .Pp
163 Very useful for selecting different boot modes, e.g. manufacturing test,
164 firmware upgrade, or rescue mode.
165 .Pp
166 .Sy Note:
167 .Cm <boot/...>
168 conditions cannot be cleared with
169 .Nm initctl !
170 .It Cm finit.config=/path/to/alternative/finit.conf
171 override the compile-time bootstrap config file, default:
172 .Bd -unfilled -offset indent
173 ./configure --with-config=/etc/finit.conf
174 .Ed
175 Useful when starting up in various rescue mode, factory, or
176 production test setups. Use the top-level configuration file
177 directive
178 .Cm rcsd Ar /path/to/finit.d
179 to override the default rcS.d directory.
180 .It Cm finit.debug
181 Enable Finit debug messages on system console and log. Sometimes useful
182 when doing board bringup. Before the system log daemon has started,
183 Finit use the kernel ring buffer,
184 .Pa /dev/kmsg .
185 .It Cm finit.fstab=/path/to/fstab.alt
186 Tell
187 .Nm
188 to use an alternate
189 .Cm fstab
190 to mount the file system from. Remember, this file must be on the
191 .Cm root=...
192 file system provided to Finit from the kernel. If this file is missing,
193 .Nm
194 falls back to its built-in default, which can be changed at build time
195 using the
196 .Cm --with-fstab=/path/to/footab
197 configure option. It is even possible to completely disable the
198 built-in using
199 .Cm --without-fstab ,
200 meaning
201 .Nm
202 .Sy must
203 be started with the
204 .Cm finit.fstab
205 option.
206 .Pp
207 Should
208 .Nm
209 discover that there is no fstab file available, including the fallback,
210 it triggers the same failure mode as when
211 .Cm fsck
212 fails, starting
213 .Xr sulogin 8 ,
214 if that is availble. When
215 .Cm sulogin
216 is missing, or when the user exits from
217 .Cm sulogin ,
218 the system is rebooted.
219 .Pp
220 Default fstab, unless changed at build-time:
221 .Pa /etc/fstab
222 .It Cm finit.status=<on,off>
223 Control finit boot progress, including banner. This used to be called
224 .Cm finit.show_status ,
225 which still works but is deprecated.
226 .It Cm finit.status_style=<classic,modern>
227 Set Finit boot progress style, when enabled.
228 .It Cm loglevel=<0-7>
229 set the kernel's log level, which is more granular than
230 .Cm debug .
231 Also, when
232 .Cm loglevel=7 ,
233 Finit will
234 .Em not disable
235 kernel logs to the console. This is very useful when debugging the
236 kernel at system bring-up. Since
237 .Cm loglevel=7
238 is the same as
239 .Cm debug
240 this means you have to use
241 .Cm quiet
242 for a quiet boot, until sysklogd takes over logging of kernel events.
243 .It Cm panic=SEC
244 By default the kernel does not reboot after a kernel panic. This
245 setting will cause a kernel reboot after
246 .Ar SEC
247 seconds.
248 .It Cm quiet
249 Suppress kernel logging to console, except for warnings and errors.
250 Also, see
251 .Cm loglevel
252 and
253 .Cm quiet
254 above.
255 .It Cm rescue | recover
256 Start rescue/maintenance mode. If your system comes with the bundled
257 .Cm sulogin
258 program (Finit, or from util-linux/Busybox), you will be given a root
259 login to a maintenance shell. However, if
260 .Cm sulogin
261 is missing, the file
262 .Pa /lib/finit/rescue.conf
263 is read and the system booted in a limited fallback mode. See
264 .Xr finit.conf 5
265 for more information.
266 .It Cm single | S
267 Single user mode, runlevel 1, in Finit. Useful to debug problems with
268 the regular runlevel. All services and TTYs in
269 .Cm [1]
270 will be started, e.g., a
271 .Cm tty [1] @console nologin
272 configuration presents you with a root console without login.
273 .Pp
274 .Sy Note:
275 by definition, single user mode does not have networking enabled. This
276 is also true for runlevel 1.
277 .El
278 .Sh BOOTING
279 .Pp
280 Before laucnhing services, the system needs to be bootstrapped. This
281 involves mounting all filesystems (not already mounted by an initramfs)
282 in
283 .Pa /etc/fstab ,
284 or any alternate
285 .Pa fstab
286 file provided on the Finit command line using
287 .Cm finit.fstab ,
288 ensuring that necessary filesystems like:
289 .Pa /dev ,
290 .Pa /proc ,
291 .Pa /sys ,
292 and
293 .Pa /run
294 are available and can provide the system with the services required.
295 .Pp
296 With that out of the way, a set of plugins take over:
297 .Pp
298 .Bl -tag -width bootmisc.so -offset indent
299 .It Cm bootmisc.so
300 Cleans up stale files from previous boots and default directories are
301 created in tmpfs filesystems
302 .It Cm modprobe.so
303 Probes kernel modules required by the system
304 .It Cm procps.so
305 Set kernel variables from
306 .Pa /etc/sysctl.conf
307 et al
308 .El
309 .Pp
310 When the plugins are done, finit reads
311 .Pa /etc/finit.conf
312 and all other enabled services in
313 .Pa /etc/finit.d/* .
314 First all services, run/tasks in runlevel S (bootStrap) are started,
315 When all run/tasks have completed, Finit changes to the configured
316 runlevel (default 2), Processes are started in parallel, in dependency
317 order according to their conditions.
318 .Pp
319 When all services and run/tasks have been started, the console progress
320 is disabled and all configured getty services are started.
321 .Sh CONDITIONS
322 The condition subysystem in Finit was initially created to track PID
323 files of daemons. If service/task B requires service A to have started,
324 Finit waits for the PID file of service A to be created/updated before
325 it starts service B. Conversely, if service A is stopped and its PID
326 file removed, service B is also stopped.
327 .Pp
328 The following condition families are available today:
329 .Pp
330 .Bl -tag -width service -offset indent
331 .It Cm net
332 Linux netlink events, e.g. net/route/default, net/eth0/up, and
333 net/et0/running
334 .It Cm pid
335 PID files based on the service declaration
336 .Cm name:id ,
337 gives the condition pid/name:id
338 .It Cm service
339 Tracks run/task/service state stansitions, including readiness. E.g.,
340 .Cm service/foo/ready
341 can be used as a condition for service
342 .Cm bar ,
343 provided
344 .Cm foo
345 properly signals its readiness to Finit.
346 .It Cm sys
347 System conditions, e.g. sys/key/ctrlaltdel and sys/pwr/fail
348 .It Cm usr
349 User conditions, assert and deassert using
350 .Cm initctl cond [set|clr] foo
351 .El
352 .Sh SIGNALS
353 PID 1 is the only process that by default blocks all signals. Finit
354 allows for the following signals to control operation, but recommends
355 instead using the
356 .Xr initctl 8
357 tool.
358 .Pp
359 .Bl -tag -width TERM
360 .It HUP
361 Tell
362 .Nm
363 to reload its configuration file(s), same as
364 .Cm initctl reload
365 .It USR1
366 Restart API
367 .Cm ( initctl )
368 socket.
369 .It USR2
370 Tell
371 .Nm
372 to perform a system shutdown, same as
373 .Cm initctl poweroff
374 .It TERM
375 Like SIGUSR2 but performs a reboot, same as
376 .Cm initctl reboot
377 .It INT
378 Sent from kernel when Ctrl-Alt-Del is pressed (on the console), this
379 asserts the sys/key/ctrlaltdel condition, which can be used to start
380 tasks or services
381 .It PWR
382 Sent from a a power daemon on changes to UPS status, Finit asserts
383 the sys/pwr/fail condition
384 .El
385 .Sh FILES
386 .Bl -tag -width /etc/finit.d/available/*.conf -compact
387 .It Pa /etc/finit.conf
388 Main configuration file
389 .It Pa /etc/finit.d/*.conf
390 Static service definitions
391 .It Pa /etc/finit.d/available/*.conf
392 Available services
393 .It Pa /etc/finit.d/enabled/*.conf
394 Symlinks from available
395 .It Pa /run/finit/
396 Runtime files, including the condition subsystem
397 .El
398 .Sh SEE ALSO
399 .Xr finit.conf 5
400 .Xr initctl 8
401 .Xr tmpfiles.d 5
402 .Sh AUTHORS
403 .Nm
404 was conceived and reverse engineered by Claudio Matsuoka. Since v1.0,
405 maintained by Joachim Wiberg, with contributions by many others.