mirror of
https://github.com/troglobit/finit.git
synced 2026-11-09 16:21:24 +00:00
Convert **Note:** et al to GitHub Markdown alerts
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
This commit is contained in:
11 files changed
+180
-131
No files matched your search
@@ -24,7 +24,8 @@ the maintainer(s) and make it easier for them to include your code.
|
|||||||
Coding Style
|
Coding Style
|
||||||
------------
|
------------
|
||||||
|
|
||||||
> **Tip:** Always submit code that follows the style of surrounding code!
|
> [!TIP]
|
||||||
|
> Always submit code that follows the style of surrounding code!
|
||||||
|
|
||||||
First of all, lines are allowed to be longer than 72 characters these
|
First of all, lines are allowed to be longer than 72 characters these
|
||||||
days. In fact, there exist no enforced maximum, but keeping it around
|
days. In fact, there exist no enforced maximum, but keeping it around
|
||||||
|
|||||||
@@ -61,12 +61,13 @@ distributions:
|
|||||||
* [Alpine Linux](contrib/alpine/), and
|
* [Alpine Linux](contrib/alpine/), and
|
||||||
* [Debian GNU/Linux](contrib/debian/), also works on Ubuntu/Linux Mint
|
* [Debian GNU/Linux](contrib/debian/), also works on Ubuntu/Linux Mint
|
||||||
|
|
||||||
> **Note:** support for various Linux distributions does not mean Finit
|
> [!NOTE]
|
||||||
> installs easily on all architectures. The bundled install scripts are
|
> Support for various Linux distributions does not mean Finit installs
|
||||||
> examples for standard installations, tested on amd64 (x86_64) systems.
|
> easily on all architectures. The bundled install scripts are examples
|
||||||
> Custom setups, e.g., for embedded systems, can be found in any of the
|
> for standard installations, tested on amd64 (x86_64) systems. Custom
|
||||||
> following [Buildroot][] based examples: [myLinux][], [Infix][], or the
|
> setups, e.g., for embedded systems, can be found in the following
|
||||||
> plain [br2-finit-demo](https://github.com/troglobit/br2-finit-demo).
|
> [Buildroot][] based examples: [myLinux][], [Infix][], or the plain
|
||||||
|
> [br2-finit-demo](https://github.com/troglobit/br2-finit-demo).
|
||||||
|
|
||||||
|
|
||||||
Example
|
Example
|
||||||
@@ -78,9 +79,10 @@ be placed in `/etc/finit.d/available` and enabled by an operator using
|
|||||||
the [initctl](#commands--status) tool. See the above mentioned Linux
|
the [initctl](#commands--status) tool. See the above mentioned Linux
|
||||||
distributions, or [myLinux][].
|
distributions, or [myLinux][].
|
||||||
|
|
||||||
> **Note:** as of Finit v4.4, .conf lines can be broken up using the
|
> [!TIP]
|
||||||
> standard UNIX continuation character (`\`), also trailing comments are
|
> As of Finit v4.4, `.conf` lines can be broken up using the standard
|
||||||
> now supported. The latter means you need to escape any hashes used in
|
> UNIX continuation character (`\`), trailing comments are now also
|
||||||
|
> supported. The latter means you need to escape any hashes used in
|
||||||
> directives and descriptions (`\#`). For more on this and examples,
|
> directives and descriptions (`\#`). For more on this and examples,
|
||||||
> see the [finit.conf(5)][] manual or [doc/config.md](doc/config.md).
|
> see the [finit.conf(5)][] manual or [doc/config.md](doc/config.md).
|
||||||
|
|
||||||
@@ -285,6 +287,7 @@ run [S] /path/to/ident --
|
|||||||
task [2] <hw/model/foo> /path/to/foo-init -- Initializing Foo board
|
task [2] <hw/model/foo> /path/to/foo-init -- Initializing Foo board
|
||||||
```
|
```
|
||||||
|
|
||||||
|
> [!TIP]
|
||||||
> Notice the trick with an empty description to hide the call to `ident`
|
> Notice the trick with an empty description to hide the call to `ident`
|
||||||
> in the Finit progress output.
|
> in the Finit progress output.
|
||||||
|
|
||||||
@@ -367,9 +370,10 @@ The `initctl` tool has three commands to help debug and optimize the
|
|||||||
setup and monitoring of cgroups. See the `ps`, `top`, and `cgroup`
|
setup and monitoring of cgroups. See the `ps`, `top`, and `cgroup`
|
||||||
commands for details.
|
commands for details.
|
||||||
|
|
||||||
> **Note:** systems that do not support cgroups, specifically version 2,
|
> [!NOTE]
|
||||||
> are automatically detected. On such systems the above functionality
|
> Systems that do not support cgroups, specifically version 2, are
|
||||||
> is disabled early at boot.
|
> automatically detected. On such systems the above functionality is
|
||||||
|
> disabled early at boot.
|
||||||
|
|
||||||
|
|
||||||
Runparts & /etc/rc.local
|
Runparts & /etc/rc.local
|
||||||
@@ -573,9 +577,10 @@ file must be used to tell Finit to stop and start it on `reload` and
|
|||||||
`runlevel` changes. If `<>` holds more [conditions](doc/conditions.md),
|
`runlevel` changes. If `<>` holds more [conditions](doc/conditions.md),
|
||||||
these will also affect how a service is maintained.
|
these will also affect how a service is maintained.
|
||||||
|
|
||||||
> **Note:** even though it is possible to start services not belonging in
|
> [!NOTE]
|
||||||
> the current runlevel these services will not be respawned automatically
|
> Even though it is possible to start services not belonging in the
|
||||||
> by Finit if they exit (crash). Hence, if the runlevel is 2, the below
|
> current runlevel these services will not be respawned automatically by
|
||||||
|
> Finit if they exit (crash). Hence, if the runlevel is 2, the below
|
||||||
> Dropbear SSH service will not be restarted if it is killed or exits.
|
> Dropbear SSH service will not be restarted if it is killed or exits.
|
||||||
|
|
||||||
The `status` command is the default, it displays a quick overview of all
|
The `status` command is the default, it displays a quick overview of all
|
||||||
|
|||||||
@@ -1,7 +1,8 @@
|
|||||||
HowTo: Finit on Alpine Linux 3.4...3.19
|
HowTo: Finit on Alpine Linux 3.4...3.19
|
||||||
=======================================
|
=======================================
|
||||||
|
|
||||||
> **Blog** https://troglobit.com/post/2021-02-12-alpine-linux-with-finit/
|
> [!TIP]
|
||||||
|
> https://troglobit.com/post/2021-02-12-alpine-linux-with-finit/
|
||||||
|
|
||||||
HowTo use Finit to boot an [Alpine Linux][] system. It is assumed that
|
HowTo use Finit to boot an [Alpine Linux][] system. It is assumed that
|
||||||
the user has already installed make, a compiler, C library header files,
|
the user has already installed make, a compiler, C library header files,
|
||||||
|
|||||||
@@ -20,8 +20,9 @@ tools pre-systemd work as intended.
|
|||||||
|
|
||||||
root@debian:~# apt install initscripts console-setup
|
root@debian:~# apt install initscripts console-setup
|
||||||
|
|
||||||
> **Note:** as of Debian 11 (Bullseye), libuev and libite are part of
|
> [!TIP]
|
||||||
> the main section of Debian. So just install the -dev packages :)
|
> As of Debian 11 (Bullseye), libuev and libite are part of the main
|
||||||
|
> section of Debian. So just install the -dev packages :)
|
||||||
|
|
||||||
The following script can then be used to configure, build, install and
|
The following script can then be used to configure, build, install and
|
||||||
set up your system to run Finit:
|
set up your system to run Finit:
|
||||||
@@ -47,7 +48,8 @@ comands to `initctl`, followed by `reload` to activate your changes.
|
|||||||
You can also use a standard [/etc/rc.local](rc.local) for one-shot tasks
|
You can also use a standard [/etc/rc.local](rc.local) for one-shot tasks
|
||||||
and initialization like keyboard language etc.
|
and initialization like keyboard language etc.
|
||||||
|
|
||||||
> **NOTE:** X Window system, you may need to `sudo apt install elogind`
|
> [!NOTE]
|
||||||
|
> For the X Window system, you may need to `sudo apt install elogind`
|
||||||
> (Bullseye and later), followed by `initctl reload` to activate it (it
|
> (Bullseye and later), followed by `initctl reload` to activate it (it
|
||||||
> is enabled by default), and logout/login again. The elogind daemon
|
> is enabled by default), and logout/login again. The elogind daemon
|
||||||
> ensures a regular non-root user can start and interact with an X
|
> ensures a regular non-root user can start and interact with an X
|
||||||
|
|||||||
+30
-24
@@ -1,5 +1,5 @@
|
|||||||
Building
|
Building Finit
|
||||||
========
|
==============
|
||||||
|
|
||||||
* [Introduction](#introduction)
|
* [Introduction](#introduction)
|
||||||
* [Configure](#configure)
|
* [Configure](#configure)
|
||||||
@@ -17,14 +17,15 @@ optional plugins to enable. It depends on two external libraries:
|
|||||||
- [libuEv][], the event loop
|
- [libuEv][], the event loop
|
||||||
- [libite][] (-lite), much needed frog DNA
|
- [libite][] (-lite), much needed frog DNA
|
||||||
|
|
||||||
**NOTE:** Most free/open source software that uses `configure` default
|
> [!IMPORTANT]
|
||||||
to install to `/usr/local`. However, some Linux distributions do no
|
> Most free/open source software packages that use `configure` default
|
||||||
longer search that path for installed software, e.g. Fedora and Alpine
|
> to install to `/usr/local`. However, some Linux distributions do no
|
||||||
Linux. To get finit's configure script to find its dependencies you
|
> longer search that path for installed software, e.g. Fedora and Alpine
|
||||||
have to help the `pkg-config` tool a bit if you do not change the
|
> Linux. To get finit's configure script to find its dependencies you
|
||||||
default prefix path:
|
> have to help the `pkg-config` tool a bit if you do not change the
|
||||||
|
> default prefix path:
|
||||||
PKG_CONFIG_LIBDIR=/usr/local/lib/pkgconfig ./configure
|
>
|
||||||
|
> PKG_CONFIG_LIBDIR=/usr/local/lib/pkgconfig ./configure
|
||||||
|
|
||||||
The configure script checks for all dependencies, including the correct
|
The configure script checks for all dependencies, including the correct
|
||||||
version of the above mentioned libraries. Currently required versions:
|
version of the above mentioned libraries. Currently required versions:
|
||||||
@@ -71,12 +72,13 @@ Below are a few of the main switches to configure:
|
|||||||
|
|
||||||
For more configure flags, see <kbd>./configure --help</kbd>
|
For more configure flags, see <kbd>./configure --help</kbd>
|
||||||
|
|
||||||
> **Note:** the configure script is not available in the GIT sources. It is
|
> [!NOTE]
|
||||||
> however included in (officially supported) released tarballs. The
|
> The configure script is not available in the GIT sources. It is
|
||||||
> idea is that you should not need GNU autotools to build, only the
|
> however included in (officially supported) released tarballs. The
|
||||||
> above mentioned dependencies, a POSIX shell, a C compiler and make.
|
> idea is that you should not need GNU autotools to build, only the
|
||||||
> Any contributing to Finit can generate it from `configure.ac` using
|
> above mentioned dependencies, a POSIX shell, a C compiler and make.
|
||||||
> the `autogen.sh` script.
|
> Any contributing to Finit can generate it from `configure.ac` using
|
||||||
|
> the `autogen.sh` script.
|
||||||
|
|
||||||
|
|
||||||
Example
|
Example
|
||||||
@@ -115,10 +117,11 @@ Linux config to:
|
|||||||
|
|
||||||
CONFIG_UEVENT_HELPER_PATH="/sbin/mdev"
|
CONFIG_UEVENT_HELPER_PATH="/sbin/mdev"
|
||||||
|
|
||||||
**Note:** If you run into problems starting Finit, take a look at
|
> [!TIP]
|
||||||
`finit.c`. One of the most common problems is a custom Linux kernel
|
> If you run into problems starting Finit, take a look at `finit.c`.
|
||||||
build that lack `CONFIG_DEVTMPFS`. Another is too much cruft in the
|
> One of the most common problems is a custom Linux kernel build that
|
||||||
system `/etc/fstab`.
|
> lack `CONFIG_DEVTMPFS`. Another is too much cruft in the system
|
||||||
|
> `/etc/fstab`.
|
||||||
|
|
||||||
|
|
||||||
Running
|
Running
|
||||||
@@ -157,8 +160,10 @@ enabled. The default Finit rescue mode configuration is installed into
|
|||||||
|
|
||||||
By default the a root shell, without login, is started.
|
By default the a root shell, without login, is started.
|
||||||
|
|
||||||
> **Note:** in this mode `initctl` will not work. Use the `-f` flag to
|
> [!IMPORTANT]
|
||||||
> force `reboot`, `shutdown`, or `poweroff`.
|
> In rescue mode `initctl` will not work, the same goes for `reboot`,
|
||||||
|
> `shutdown`, and `poweroff` commands, provided they are the Finit
|
||||||
|
> versions of these commands. Use the `-f` flag to force the action.
|
||||||
|
|
||||||
|
|
||||||
Debugging
|
Debugging
|
||||||
@@ -187,8 +192,9 @@ kernel usually reboots: `configure --enable-emergency-shell`. However,
|
|||||||
the behavior of Finit is severely limited when this is enabled, so use
|
the behavior of Finit is severely limited when this is enabled, so use
|
||||||
it only for debugging start up issues when Finit crashes.
|
it only for debugging start up issues when Finit crashes.
|
||||||
|
|
||||||
**NOTE:** Neither of these options should be enabled on production
|
> [!CAUTION]
|
||||||
systems since they can potentially give a user root access.
|
> None of these options should be enabled on production systems since
|
||||||
|
> they can potentially give a user root access.
|
||||||
|
|
||||||
|
|
||||||
[1]: ftp://troglobit.com/finit/finit-4.3.tar.gz
|
[1]: ftp://troglobit.com/finit/finit-4.3.tar.gz
|
||||||
|
|||||||
+6
-4
@@ -4,10 +4,11 @@ Tips & Tricks with the kernel cmdline
|
|||||||
This document summarizes the different boot parameters that can be
|
This document summarizes the different boot parameters that can be
|
||||||
passed on the Linux kernel command line. Not limited to Finit.
|
passed on the Linux kernel command line. Not limited to Finit.
|
||||||
|
|
||||||
The `bool` setting is one of `on, off, true false, 1, 0`.
|
> [!IMPORTANT]
|
||||||
|
> Remember to use `--` to separate kernel parameters from parameters to
|
||||||
|
> init. E.g., `init=/sbin/finit -- finit.debug rescue`
|
||||||
|
|
||||||
> **NOTE:** remember to use `--` to separate kernel parameters from
|
The `bool` setting is one of `on, off, true false, 1, 0`.
|
||||||
> parameters to init. E.g., `init=/sbin/finit -- finit.debug rescue`
|
|
||||||
|
|
||||||
* `debug`: Enable kernel debug. Debug messages are printed to the
|
* `debug`: Enable kernel debug. Debug messages are printed to the
|
||||||
console until Finit starts up, unless `loglevel=7` (below) is used.
|
console until Finit starts up, unless `loglevel=7` (below) is used.
|
||||||
@@ -30,7 +31,8 @@ The `bool` setting is one of `on, off, true false, 1, 0`.
|
|||||||
Very useful for selecting different boot modes, e.g. manufacturing test,
|
Very useful for selecting different boot modes, e.g. manufacturing test,
|
||||||
firmware upgrade, or rescue mode.
|
firmware upgrade, or rescue mode.
|
||||||
|
|
||||||
> Note: `<boot/...>` conditions cannot be cleared with `initctl`!
|
> [!NOTE]
|
||||||
|
> `<boot/...>` conditions cannot be cleared with `initctl`!
|
||||||
|
|
||||||
* `finit.config=/path/to/alternative/finit.conf`: override the
|
* `finit.config=/path/to/alternative/finit.conf`: override the
|
||||||
compile-time bootstrap config file, default:
|
compile-time bootstrap config file, default:
|
||||||
|
|||||||
+19
-11
@@ -47,9 +47,10 @@ both the `pid/setupd` *and* `pid/zebra` conditions are satisfied. A
|
|||||||
`pid/` condition is satisfied by the corresponding service's PID file
|
`pid/` condition is satisfied by the corresponding service's PID file
|
||||||
being created, i.e., the service's default readiness notification.
|
being created, i.e., the service's default readiness notification.
|
||||||
|
|
||||||
**NOTE:** Conditions also stop services when a condition is no longer
|
> [!IMPORTANT]
|
||||||
asserted. I.e., if the Zebra process above stops or restarts, netd
|
> Conditions also stop services when a condition is no longer asserted.
|
||||||
will also stop or restart.
|
> I.e., if the `zebra` process above stops or restarts, `netd` will also
|
||||||
|
> stop or restart.
|
||||||
|
|
||||||
Another example is `dropbear`, it does not support `SIGHUP`, but we can
|
Another example is `dropbear`, it does not support `SIGHUP`, but we can
|
||||||
also see optional sourcing of arguments from an environment file:
|
also see optional sourcing of arguments from an environment file:
|
||||||
@@ -106,11 +107,16 @@ on this, see [Internals](#internals).) Thus, after a reconfiguration it
|
|||||||
is up to the "owner" of the condition to convey the new (or possibly
|
is up to the "owner" of the condition to convey the new (or possibly
|
||||||
unchanged) state of it.
|
unchanged) state of it.
|
||||||
|
|
||||||
> **Note:** For `pid/` conditions it is expected that services "touch"
|
|
||||||
> or recreate their PID file on `SIGHUP`.
|
|
||||||
|
|
||||||
Static (one-shot) conditions, like `usr/`, never enter the `flux` state.
|
Static (one-shot) conditions, like `usr/`, never enter the `flux` state.
|
||||||
|
|
||||||
|
> [!IMPORTANT]
|
||||||
|
> For `pid/` conditions it is expected that the service reassert, i.e.,
|
||||||
|
> "touch" or recreate, their PID file on `SIGHUP`. This can be done by
|
||||||
|
> calling `utimensat()` on the PID file. Provided, of course, that the
|
||||||
|
> service supports reloading on `SIGHUP`, otherwise it will be restarted
|
||||||
|
> by Finit when they instead exit on the signal. For such services, use
|
||||||
|
> `<!>` to tell Finit the service does not support `SIGHUP`.
|
||||||
|
|
||||||
|
|
||||||
Built-in Conditions
|
Built-in Conditions
|
||||||
-------------------
|
-------------------
|
||||||
@@ -171,9 +177,10 @@ Built-in conditions:
|
|||||||
- `boot/arg`
|
- `boot/arg`
|
||||||
- `dev/node` and `dev/dir/node`
|
- `dev/node` and `dev/dir/node`
|
||||||
|
|
||||||
**Note:** `up` means administratively up, the interface flag `IFF_UP`.
|
> [!NOTE]
|
||||||
`running` is the `IFF_RUNNING` flag, meaning operatively up. The
|
> Here, `up` means administratively up, the interface flag `IFF_UP`.
|
||||||
difference is that `running` tells if the NIC has link.
|
> `running` is the `IFF_RUNNING` flag, meaning operatively up. The
|
||||||
|
> difference is that `running` tells if the NIC has link.
|
||||||
|
|
||||||
|
|
||||||
Composition
|
Composition
|
||||||
@@ -205,8 +212,9 @@ the service stanza for the daemon. It is far from optimal since any
|
|||||||
synchronization of depending services may fail due to the daemon not
|
synchronization of depending services may fail due to the daemon not
|
||||||
having reinitialized/created their IPC sockets, or similar.
|
having reinitialized/created their IPC sockets, or similar.
|
||||||
|
|
||||||
> **Note:** in versions of Finit prior to v4, the PID conditions were
|
> [!NOTE]
|
||||||
> called 'svc' conditions, and they were far more complex.
|
> In versions of Finit prior to v4, the PID conditions were called 'svc'
|
||||||
|
> conditions, and they were far more complex.
|
||||||
|
|
||||||
|
|
||||||
Debugging
|
Debugging
|
||||||
|
|||||||
+69
-52
@@ -46,8 +46,9 @@ Plugins start at [hook points](plugins.md#hooks) and can run various set
|
|||||||
up, or install event handlers that later provide runtime services, e.g.,
|
up, or install event handlers that later provide runtime services, e.g.,
|
||||||
PID file monitoring, or [conditions](conditions.md).
|
PID file monitoring, or [conditions](conditions.md).
|
||||||
|
|
||||||
> **Tip:** see [SysV Init Compatibility](#sysv-init-compatibility) for
|
> [!TIP]
|
||||||
> help to quickly get going with an existing SysV or BusyBox init setup.
|
> See [SysV Init Compatibility](#sysv-init-compatibility) for help to
|
||||||
|
> quickly get going with an existing SysV or BusyBox init setup.
|
||||||
|
|
||||||
|
|
||||||
### Configuration Files
|
### Configuration Files
|
||||||
@@ -127,8 +128,9 @@ properties of the `run` statement. For an example on the relation of
|
|||||||
`service` and `run` statements, and dependency handling between them,
|
`service` and `run` statements, and dependency handling between them,
|
||||||
see [Conditional Loading](#conditional-loading), below.
|
see [Conditional Loading](#conditional-loading), below.
|
||||||
|
|
||||||
> **Note:** the `finit.conf` and `finit.d/` names are only defaults.
|
> [!NOTE]
|
||||||
> They can be changed at compile-time with two `configure` options:
|
> The names `finit.conf` and `finit.d/` are only defaults. They can be
|
||||||
|
> changed at compile-time with two `configure` options:
|
||||||
> `--with-config=/etc/foo.conf` and `--with-rcsd=/var/foo.d`.
|
> `--with-config=/etc/foo.conf` and `--with-rcsd=/var/foo.d`.
|
||||||
>
|
>
|
||||||
> They can also be overridden from the [kernel command line](cmdline.md)
|
> They can also be overridden from the [kernel command line](cmdline.md)
|
||||||
@@ -187,8 +189,9 @@ above, provided their respective mount point exists.
|
|||||||
|
|
||||||
With all filesystems mounted, Finit calls `swapon`.
|
With all filesystems mounted, Finit calls `swapon`.
|
||||||
|
|
||||||
> **Tip:** to see what happens when all filesystems are mounted, have a
|
> [!TIP]
|
||||||
> look at the [`bootmisc.so` plugin](plugins.md).
|
> To see what happens when all filesystems are mounted, have a look at
|
||||||
|
> the [`bootmisc.so` plugin](plugins.md).
|
||||||
|
|
||||||
At shutdown, and after having stopped all services and other lingering
|
At shutdown, and after having stopped all services and other lingering
|
||||||
processes have been killed, filesystems are unmounted in the reverse
|
processes have been killed, filesystems are unmounted in the reverse
|
||||||
@@ -231,11 +234,12 @@ Networking is expected to be available in all runlevels except: S, 1
|
|||||||
file, Finit calls `ifup -a` -- at the very least the loopback interface
|
file, Finit calls `ifup -a` -- at the very least the loopback interface
|
||||||
is brought up.
|
is brought up.
|
||||||
|
|
||||||
> **Note:** when moving from runlevel S to 2, all run/task/services that
|
> [!NOTE]
|
||||||
> were constrained to runlevel S only are dropped from bookkeeping. So
|
> When moving from runlevel S to 2, all run/task/services that were
|
||||||
> when reaching the prompt, `initctl` will not show these run/tasks.
|
> constrained to runlevel S only are dropped from bookkeeping. So when
|
||||||
> This is a safety mechanism to prevent bootstrap-only tasks from
|
> reaching the prompt, `initctl` will not show these run/tasks. This is
|
||||||
> accidentally being run again. E.g., `console-setup.sh` above.
|
> a safety mechanism to prevent bootstrap-only tasks from accidentally
|
||||||
|
> being run again. E.g., `console-setup.sh` above.
|
||||||
|
|
||||||
|
|
||||||
### Managing Services
|
### Managing Services
|
||||||
@@ -322,7 +326,8 @@ the `ps` command we can see that the process is started with:
|
|||||||
|
|
||||||
foo -n --extra-arg=bar -s -x
|
foo -n --extra-arg=bar -s -x
|
||||||
|
|
||||||
> **Note:** the leading `-` determines if Finit should treat a missing
|
> [!NOTE]
|
||||||
|
> The leading `-` in `env:` determines if Finit should treat a missing
|
||||||
> environment file as blocking the start of the service or not. When
|
> environment file as blocking the start of the service or not. When
|
||||||
> `-` is used, a missing environment file does *not* block the start.
|
> `-` is used, a missing environment file does *not* block the start.
|
||||||
|
|
||||||
@@ -384,12 +389,13 @@ To synchronize two services the following condition can be used:
|
|||||||
|
|
||||||
For details on the syntax and options, see below.
|
For details on the syntax and options, see below.
|
||||||
|
|
||||||
> **Note:** on `initctl reload` conditions are normally set in "flux",
|
> [!NOTE]
|
||||||
> while figuring out which to stop, start or restart. Services that
|
> On `initctl reload` conditions are set in "flux", while figuring out
|
||||||
> need to be restarted have their `ready` condition removed prior to
|
> which to stop, start or restart. Services that need to be restarted
|
||||||
> Finit sending them SIGHUP (if they support that), or stop-starting
|
> have their `ready` condition removed prior to Finit sending them
|
||||||
> them. A daemon is expected to reassert its readiness, e.g. systemd
|
> SIGHUP (if they support that), or stop-starting them. A daemon is
|
||||||
> style daemons to write `READY=1\n`.
|
> expected to reassert its readiness, e.g. systemd style daemons to
|
||||||
|
> write `READY=1\n`.
|
||||||
>
|
>
|
||||||
> However, the s6 notify mode does not support this because in s6 you
|
> However, the s6 notify mode does not support this because in s6 you
|
||||||
> are expected to close your notify descriptor after having written
|
> are expected to close your notify descriptor after having written
|
||||||
@@ -429,9 +435,10 @@ example employs a wrapper script in `/etc/start.d`.
|
|||||||
# Execute the program
|
# Execute the program
|
||||||
exec /usr/bin/program $OPTIONS
|
exec /usr/bin/program $OPTIONS
|
||||||
|
|
||||||
> **Note:** the example sets `<!>` to denote that it doesn't support
|
> [!NOTE]
|
||||||
> `SIGHUP`. That way Finit will stop/start the service
|
> The example sets `<!>` to denote that it doesn't support `SIGHUP`.
|
||||||
> instead of sending SIGHUP at restart/reload events.
|
> That way Finit will stop/start the service instead of sending SIGHUP
|
||||||
|
> at restart/reload events.
|
||||||
|
|
||||||
|
|
||||||
Templating
|
Templating
|
||||||
@@ -514,6 +521,7 @@ A daemon using `SCHED_RR` currently need to run outside the default cgroups.
|
|||||||
|
|
||||||
service [...] <...> cgroup.root /path/to/daemon arg -- Real-Time process
|
service [...] <...> cgroup.root /path/to/daemon arg -- Real-Time process
|
||||||
|
|
||||||
|
> [!NOTE]
|
||||||
> Linux cgroups and details surrounding values are not explained in the
|
> Linux cgroups and details surrounding values are not explained in the
|
||||||
> Finit documentation. The Linux admin-guide cover this well:
|
> Finit documentation. The Linux admin-guide cover this well:
|
||||||
> <https://www.kernel.org/doc/html/latest/admin-guide/cgroup-v2.html>
|
> <https://www.kernel.org/doc/html/latest/admin-guide/cgroup-v2.html>
|
||||||
@@ -539,12 +547,9 @@ service name:sysklogd [S123456789] \
|
|||||||
```
|
```
|
||||||
|
|
||||||
The .conf files `/etc/finit.conf` and `/etc/finit.d/*` support the
|
The .conf files `/etc/finit.conf` and `/etc/finit.d/*` support the
|
||||||
following directives:
|
following directives. Some directives have restrictions, e.g., only
|
||||||
|
available at bootstrap, runlevel `S`, see [Limitations](#limitations)
|
||||||
|
below for details.
|
||||||
> **Note:** not all directives are available in `/etc/finit.d/*.conf`
|
|
||||||
> and some directives are only available at bootstrap, runlevel `S`,
|
|
||||||
> see [Limitations](#limitations) below for details.
|
|
||||||
|
|
||||||
|
|
||||||
### Hostname
|
### Hostname
|
||||||
@@ -556,7 +561,8 @@ the contents of that file is used.
|
|||||||
|
|
||||||
Deprecated. We recommend using `/etc/hostname` instead.
|
Deprecated. We recommend using `/etc/hostname` instead.
|
||||||
|
|
||||||
> **Note:** only read and executed in runlevel S (bootstrap).
|
> [!NOTE]
|
||||||
|
> Only read and executed in runlevel S (bootstrap).
|
||||||
|
|
||||||
|
|
||||||
### Kernel Modules
|
### Kernel Modules
|
||||||
@@ -574,7 +580,8 @@ BusyBox mdev tool, add to `/etc/mdev.conf`:
|
|||||||
|
|
||||||
$MODALIAS=.* root:root 0660 @modprobe -b "$MODALIAS"
|
$MODALIAS=.* root:root 0660 @modprobe -b "$MODALIAS"
|
||||||
|
|
||||||
> **Note:** only read and executed in runlevel S (bootstrap).
|
> [!NOTE]
|
||||||
|
> Only read and executed in runlevel S (bootstrap).
|
||||||
|
|
||||||
|
|
||||||
### Networking
|
### Networking
|
||||||
@@ -587,7 +594,8 @@ Deprecated. We recommend using dedicated task/run stanzas per runlevel,
|
|||||||
or `/etc/network/interfaces` if you have a system with `ifupdown`, like
|
or `/etc/network/interfaces` if you have a system with `ifupdown`, like
|
||||||
Debian, Ubuntu, Linux Mint, or an embedded BusyBox system.
|
Debian, Ubuntu, Linux Mint, or an embedded BusyBox system.
|
||||||
|
|
||||||
> **Note:** only read and executed in runlevel S (bootstrap).
|
> [!NOTE]
|
||||||
|
> Only read and executed in runlevel S (bootstrap).
|
||||||
|
|
||||||
|
|
||||||
### Alternate finit.d/
|
### Alternate finit.d/
|
||||||
@@ -608,8 +616,9 @@ another set of .conf files, e.g.:
|
|||||||
|
|
||||||
rcsd /etc/factory.d
|
rcsd /etc/factory.d
|
||||||
|
|
||||||
> **Note:** this directive is only available from the top-level
|
> [!NOTE]
|
||||||
> bootstrap .conf file.
|
> This directive is only available from the top-level bootstrap .conf
|
||||||
|
> file, usually `/etc/finit.conf`.
|
||||||
|
|
||||||
### Resource Limits
|
### Resource Limits
|
||||||
|
|
||||||
@@ -651,7 +660,8 @@ Finit disables networking in this mode.
|
|||||||
|
|
||||||
*Default:* 2
|
*Default:* 2
|
||||||
|
|
||||||
> **Note:** only read and executed in runlevel S (bootstrap).
|
> [!NOTE]
|
||||||
|
> Only read and executed in runlevel S (bootstrap).
|
||||||
|
|
||||||
|
|
||||||
### One-shot Commands (sequence)
|
### One-shot Commands (sequence)
|
||||||
@@ -665,10 +675,11 @@ optional arguments and description. `run` commands are guaranteed to be
|
|||||||
completed before running the next command. Useful when serialization is
|
completed before running the next command. Useful when serialization is
|
||||||
required.
|
required.
|
||||||
|
|
||||||
> **Warning:** try to avoid the `run` command. It blocks much of the
|
> [!WARNING]
|
||||||
> functionality in Finit, like (re)starting other (perhaps crashing)
|
> Try to avoid the `run` command. It blocks much of the functionality
|
||||||
> services while a `run` task is executing. Use other synchronization
|
> in Finit, like (re)starting other (perhaps crashing) services while a
|
||||||
> mechanisms instead, like conditions.
|
> `run` task is executing. Use other synchronization mechanisms
|
||||||
|
> instead, like conditions.
|
||||||
|
|
||||||
Incomplete list of unsupported `initctl` commands in `run` tasks:
|
Incomplete list of unsupported `initctl` commands in `run` tasks:
|
||||||
|
|
||||||
@@ -723,7 +734,8 @@ file, but rather watch that file for the resulting forked-off PID. This
|
|||||||
syntax also works for forking daemons that do not have a command line
|
syntax also works for forking daemons that do not have a command line
|
||||||
option to run it in the foreground, more on this below in `service`.
|
option to run it in the foreground, more on this below in `service`.
|
||||||
|
|
||||||
> **Tip:** see also [SysV Init Compatibility](#sysv-init-compatibility).
|
> [!TIP]
|
||||||
|
> See also [SysV Init Compatibility](#sysv-init-compatibility).
|
||||||
|
|
||||||
|
|
||||||
### Services
|
### Services
|
||||||
@@ -736,7 +748,8 @@ exits prematurely. Finit tries to restart services that die, by default
|
|||||||
they have to be manually restarted with `initctl restart NAME`. The
|
they have to be manually restarted with `initctl restart NAME`. The
|
||||||
limits controlling this are configurable, see the options below.
|
limits controlling this are configurable, see the options below.
|
||||||
|
|
||||||
> **Tip:** to allow endless restarts, see below option `respawn`
|
> [!TIP]
|
||||||
|
> To allow endless restarts, see below option `respawn`
|
||||||
|
|
||||||
For daemons that support it, we recommend appending `--foreground`,
|
For daemons that support it, we recommend appending `--foreground`,
|
||||||
`--no-background`, `-n`, `-F`, or similar command line argument to
|
`--no-background`, `-n`, `-F`, or similar command line argument to
|
||||||
@@ -1033,8 +1046,9 @@ before continuing. None of them can issue commands to start, stop, or
|
|||||||
restart other services. Also, ensure all your services and programs
|
restart other services. Also, ensure all your services and programs
|
||||||
either terminate or start in the background or you will block Finit.
|
either terminate or start in the background or you will block Finit.
|
||||||
|
|
||||||
> **Note:** `runparts` scripts are only read and executed in runlevel S.
|
> [!NOTE]
|
||||||
> See [hook scripts](plugins.md#hooks) for other ways to run scripts at
|
> `runparts` scripts are only read and executed in runlevel S. See
|
||||||
|
> [hook scripts](plugins.md#hooks) for other ways to run scripts at
|
||||||
> certain points during the complete lifetime of the system.
|
> certain points during the complete lifetime of the system.
|
||||||
|
|
||||||
**Recommendations:**
|
**Recommendations:**
|
||||||
@@ -1307,8 +1321,9 @@ This rescue mode can be disabled at configure time using:
|
|||||||
|
|
||||||
The rescue mode comes in two flavors; *traditional* and *fallback*.
|
The rescue mode comes in two flavors; *traditional* and *fallback*.
|
||||||
|
|
||||||
> **Note:** in this mode `initctl` will not work. Use the `-f` flag to
|
> [!NOTE]
|
||||||
> force `reboot`, `shutdown`, or `poweroff`.
|
> In this mode `initctl` will not work. Use the `-f` flag to force
|
||||||
|
> `reboot`, `shutdown`, or `poweroff`.
|
||||||
|
|
||||||
|
|
||||||
### Traditional
|
### Traditional
|
||||||
@@ -1320,11 +1335,12 @@ program is used instead. If a successful login is made, or if the user
|
|||||||
exits (Ctrl-D), the rescue mode is ended and the system boots up
|
exits (Ctrl-D), the rescue mode is ended and the system boots up
|
||||||
normally.
|
normally.
|
||||||
|
|
||||||
> **Note:** the bundled sulogin in Finit can at configure time be given
|
> [!WARNING]
|
||||||
> another user than the default (root). If the sulogin user does not
|
> The bundled sulogin in Finit can at configure time be given another
|
||||||
> have a password, or __the account is locked__, the user is presented
|
> user than the default (root). If the sulogin user does not have a
|
||||||
> with a password-less `"Press enter to enter maintenance mode."`,
|
> password, or __the account is locked__, the user is presented with a
|
||||||
> prompt which opens up a root shell.
|
> prompt: `"Press enter to enter maintenance mode."`, which will open
|
||||||
|
> up a root shell *without prompting for password*!
|
||||||
|
|
||||||
|
|
||||||
### Fallback
|
### Fallback
|
||||||
@@ -1372,10 +1388,11 @@ These can now also be set in any `.conf` file in `/etc/finit.d`.
|
|||||||
There is, however, nothing preventing you from having all configuration
|
There is, however, nothing preventing you from having all configuration
|
||||||
settings in `/etc/finit.conf`.
|
settings in `/etc/finit.conf`.
|
||||||
|
|
||||||
> **Note:** The `/etc/finit.d` directory was previously the default
|
> [!IMPORTANT]
|
||||||
> Finit [runparts](#run-parts-scripts) directory. Finit >=v4.0
|
> The default `rcsd`, i.e., `/etc/finit.d`, was previously the Finit
|
||||||
> no longer has a default `runparts` directory, make sure to
|
> [runparts](#run-parts-scripts) directory. Finit >=v4.0 no longer has
|
||||||
> update your setup, or the finit configuration, accordingly.
|
> a default `runparts` directory, make sure to update your setup, or the
|
||||||
|
> finit configuration, accordingly.
|
||||||
|
|
||||||
|
|
||||||
Watchdog
|
Watchdog
|
||||||
|
|||||||
+3
-2
@@ -34,8 +34,9 @@ build time:
|
|||||||
./configure --with-rcsd=/etc/init.d --with-config=/etc/init.d/init.conf
|
./configure --with-rcsd=/etc/init.d --with-config=/etc/init.d/init.conf
|
||||||
```
|
```
|
||||||
|
|
||||||
> **Note:** remember `--prefix` et al as well, the default is likely
|
> [!IMPORTANT]
|
||||||
> *not* what you want. See the [build docs][1] for details.
|
> Remember `--prefix` et al as well, the default is likely *not* what
|
||||||
|
> you want. See the [build docs][1] for details.
|
||||||
|
|
||||||
The resulting directory structure is depicted below. Please notice how
|
The resulting directory structure is depicted below. Please notice how
|
||||||
`/etc/finit.conf` now resides in the same sub-directory as a non-symlink
|
`/etc/finit.conf` now resides in the same sub-directory as a non-symlink
|
||||||
|
|||||||
+21
-16
@@ -35,9 +35,10 @@ For your convenience a set of *optional* plugins are available:
|
|||||||
files distributed with Finit. It is read first but can be overridden
|
files distributed with Finit. It is read first but can be overridden
|
||||||
by any of the standard tmpfiles.d directories, e.g. `/etc/tmpfiles.d`.
|
by any of the standard tmpfiles.d directories, e.g. `/etc/tmpfiles.d`.
|
||||||
|
|
||||||
> **Note:** On an embedded system both `/var` and `/run` can be `tmpfs`
|
> [!NOTE]
|
||||||
> RAM disks and `/dev` is usually a `devtmpfs`. This must be defined
|
> On an embedded system both `/var` and `/run` can be `tmpfs` RAM
|
||||||
> in the `/etc/fstab` file and in the Linux kernel config.
|
> disks and `/dev` is usually a `devtmpfs`. This must be defined in
|
||||||
|
> the `/etc/fstab` file and in the Linux kernel config.
|
||||||
|
|
||||||
* *dbus.so*: Setup and start system message bus, D-Bus, at boot.
|
* *dbus.so*: Setup and start system message bus, D-Bus, at boot.
|
||||||
_Optional plugin._
|
_Optional plugin._
|
||||||
@@ -63,8 +64,9 @@ For your convenience a set of *optional* plugins are available:
|
|||||||
|
|
||||||
Enabled by default.
|
Enabled by default.
|
||||||
|
|
||||||
> See the [Services](config.md#services) section in the configuration
|
> [!TIP]
|
||||||
> guide for an example how to run `mdevd`, alternative to plain mdev.
|
> See the [Services](config.md#services) section in the configuration
|
||||||
|
> guide for an example how to run `mdevd`, alternative to plain mdev.
|
||||||
|
|
||||||
* *rtc.so*: Restore and save system clock from/to RTC on boot/halt.
|
* *rtc.so*: Restore and save system clock from/to RTC on boot/halt.
|
||||||
Enabled by default.
|
Enabled by default.
|
||||||
@@ -89,16 +91,17 @@ For your convenience a set of *optional* plugins are available:
|
|||||||
|
|
||||||
set index 1234
|
set index 1234
|
||||||
|
|
||||||
**Note:** unlike the traditional .conf `module` directive, which load
|
Since these tasks run in the background, they return `[ OK ]` at boot,
|
||||||
any listed module immediately, this plugin creates a background `task`
|
unless the modprobe tool does not exist. Check syslog for warnings
|
||||||
which load the module(s) in the background. The program is modprobe,
|
and the actual status of the operation using `initctl`.
|
||||||
`/sbin/modprobe`, which you can override per .conf file:
|
|
||||||
|
|
||||||
set modprobe /path/to/maybe-a-modprobe-wrapper
|
> [!IMPORTANT]
|
||||||
|
> Unlike the traditional .conf `module` directive, which load any listed
|
||||||
Since these tasks run in the background, they usually return `[ OK ]`
|
> module immediately, this plugin creates a background `task` which load
|
||||||
at boot, unless the modprobe tool does not exist. Check syslog for
|
> the module(s) in the background. The program is modprobe,
|
||||||
warnings and the actual status of the operation using `initctl`.
|
> `/sbin/modprobe`, which you can override per .conf file:
|
||||||
|
>
|
||||||
|
> set modprobe /path/to/maybe-a-modprobe-wrapper
|
||||||
|
|
||||||
* *netlink.so*: Listens to Linux kernel Netlink events for gateway and
|
* *netlink.so*: Listens to Linux kernel Netlink events for gateway and
|
||||||
interfaces. These events are then sent to the Finit service monitor
|
interfaces. These events are then sent to the Finit service monitor
|
||||||
@@ -158,8 +161,10 @@ hook points:
|
|||||||
EOF
|
EOF
|
||||||
$ chmod +x /libexec/finit/hook/sys/down/foo.sh
|
$ chmod +x /libexec/finit/hook/sys/down/foo.sh
|
||||||
|
|
||||||
> **Note:** to use hook scripts, even for pre-bootstrap and pre-shutdown
|
> [!IMPORTANT]
|
||||||
> tasks, you must build with `configure --enable-hook-scripts-plugin`.
|
> To use hook scripts, even for pre-bootstrap and pre-shutdown tasks,
|
||||||
|
> you must build with `configure --enable-hook-scripts-plugin`.
|
||||||
|
|
||||||
|
|
||||||
### Bootstrap Hooks
|
### Bootstrap Hooks
|
||||||
|
|
||||||
|
|||||||
+3
-2
@@ -22,8 +22,9 @@ Finit can *not* start and monitor a daemon that:
|
|||||||
| ✔ | No | No | Yes, optionally |
|
| ✔ | No | No | Yes, optionally |
|
||||||
| ✘ | Yes | No | No |
|
| ✘ | Yes | No | No |
|
||||||
|
|
||||||
> **Note:** PID files is one mechanism used to assert conditions to
|
> [!NOTE]
|
||||||
> synchronize the start and stop of other, dependent, services.
|
> PID files is one mechanism used to assert conditions to synchronize
|
||||||
|
> the start and stop of other, dependent, services.
|
||||||
|
|
||||||
### Forks to Background w/ PID File
|
### Forks to Background w/ PID File
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user