Skip to content

Commit

Permalink
Fix #374: describe automount of /run, /tmp and tmpfiles.d support
Browse files Browse the repository at this point in the history
Signed-off-by: Joachim Wiberg <[email protected]>
  • Loading branch information
troglobit committed Oct 22, 2023
1 parent 7ff7f93 commit e2ee372
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 9 deletions.
12 changes: 8 additions & 4 deletions doc/bootstrap.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,14 @@ Bootstrap
12. Remount `/` read-write if `/` is listed in `/etc/fstab` without `ro`
13. Call 1st level hooks, `HOOK_ROOTFS_UP`
14. Mount all file systems listed in `/etc/fstab` and swap, if available.
On mount error `HOOK_MOUNT_ERROR` is called. After mount, regardless
of error, `HOOK_MOUNT_POST` is called
Finit verifies that `/dev/shm`, `/dev/pts`, `/run`, and `/tmp` are
mounted. If not, Finit mounts them as `tmpfs` because otherwise the rest
of the boot may fail. On any mount error `HOOK_MOUNT_ERROR` is called.
After mount, regardless of error, `HOOK_MOUNT_POST` is called
15. Enable SysV init signals
16. Call 2nd level hooks, `HOOK_BASEFS_UP`
17. Cleanup stale files from `/tmp/*` et al, handled by `bootmisc` plugin
17. Cleanup stale files from `/tmp/*` et al and (re)create temporary files and
directories according to [tmpfiles.d(5)][], handled by `bootmisc` plugin
18. Load kernel params from `/etc/sysctl.d/*.conf`, `/etc/sysctl.conf`
et al. (Supports all locations that SysV init does.), handled by
`procps` plugin
Expand Down Expand Up @@ -56,4 +59,5 @@ well before all 'S' runlevel tasks are started. This could be used with
system images that are created read-only and all configuration is stored
on external media.

[run-parts(8)]: http://manpages.debian.org/cgi-bin/man.cgi?query=run-parts
[run-parts(8)]: http://manpages.debian.org/cgi-bin/man.cgi?query=run-parts
[tmpfiles.d(5)]: https://www.freedesktop.org/software/systemd/man/tmpfiles.d.html
22 changes: 17 additions & 5 deletions doc/plugins.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,16 @@ For your convenience a set of *optional* plugins are available:
system and runs at `HOOK_BASEFS_UP`. The `/var`, `/run`, and `/dev`
file systems must be writable for this plugin to work.

Note: On an embedded system both `/var` and `/run` can be `tmpfs` RAM
disks and `/dev` is usually a `devtmpfs`. This must be defined in the
`/etc/fstab` file and in the Linux kernel config.
This plugin is a wrapper for the [tmpfiles.d(5)][] implementation that
Finit has. Capable but limited: no aging, attributes, or subvolumes.

By default, `/lib/finit/tmpfiles.d` carries all the default .conf
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`.

> **Note:** On an embedded system both `/var` and `/run` can be `tmpfs`
> RAM 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.
_Optional plugin._
Expand All @@ -50,8 +57,11 @@ For your convenience a set of *optional* plugins are available:
customized at build-time using the `--with-hook-scripts-path=PATH`
argument to `configure`.

* *hotplug.so*: Setup and start either udev or mdev hotplug daemon, if
available. Enabled by default.
* *hotplug.so*: Replaced with `/lib/finit/system/10-hotplug.conf`, which
checks for `udevd` and `mdev` at boot. This file can be overridden by a
file in `/etc/finit.d/10-hotplug.conf`.

Enabled by default.

> See the [Services](config.md#services) section in the configuration
> guide for an example how to run `mdevd`, alternative to plain mdev.
Expand Down Expand Up @@ -217,3 +227,5 @@ Plugins like `tty.so` extend finit by acting on events, they are called
I/O plugins and are called from the finit main loop when `poll()`
detects an event. See the source code for `plugins/*.c` for more help
and ideas.

[tmpfiles.d(5)]: https://www.freedesktop.org/software/systemd/man/tmpfiles.d.html

0 comments on commit e2ee372

Please sign in to comment.