contrib, system: convert the shipped .conf files to the block format

The examples people copy from were still written in the line-based
format, so the block format was documented but nowhere demonstrated.

Two names in contrib were accidents of the old format, where the
service name falls out of the command basename: the Alpine and Void
keymap task was called zcat, and Debian's console/keyboard setup tasks
carried a .sh suffix.  They now carry the name their file implies.
Nothing referenced the old names.

The mdevd coldplug path keeps the name it has always had.  Its legacy
line spelled the name inside the cgroup argument, where it names the
cgroup leaf and not the service, so the barrier condition really is
<run/mdevd-coldplug/success> and not the <run/coldplug/success> the
comment above it promises.  Converted as-is so boot ordering does not
change; the discrepancy is now written down where it happens.

A list may not contain comments, the lexer sees the entries after the
'#' regardless:

    modules = {
    #	"fbcon",
    	"softdog"
    }

so the commented-out module candidates sit above the list instead.

setup-sysroot.sh removes 10-hotplug.conf from the test sysroot, so that
file is covered by parsing only, not by make check.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
This commit is contained in:
Joachim Wiberg committed 2026-07-30 15:21:31 +02:00
1 parent b9ad9bcb21
commit b44a5ff2f8
46 files changed
+587 -156

No files matched your search

+16 -6
View File
@@ -3,24 +3,34 @@
## Runlevel to start after bootstrap, runlevel 'S' ## Runlevel to start after bootstrap, runlevel 'S'
# Default is 2 # Default is 2
#runlevel 2 #runlevel = 2
# Top-level cgroups and their default settings. All groups mandatory # Top-level cgroups and their default settings. All groups mandatory
# but more can be added, max 8 groups in total currently. The cgroup # but more can be added, max 8 groups in total currently. The cgroup
# 'root' is also available, reserved for RT processes. Settings are # 'root' is also available, reserved for RT processes. Settings are
# as-is, only one shorthand 'mem.' exists, other than that it's the # as-is, only one shorthand 'mem.' exists, other than that it's the
# cgroup v2 controller default names. # cgroup v2 controller default names.
#cgroup init cpu.weight:100 #cgroup init { cpu.weight = 100 }
#cgroup user cpu.weight:100 #cgroup user { cpu.weight = 100 }
#cgroup system cpu.weight:9700 #cgroup system { cpu.weight = 9700 }
# Task to run if ctrl-alt-del is pressed. This condition is asserted by # Task to run if ctrl-alt-del is pressed. This condition is asserted by
# Finit upon receiving SIGINT (from the kernel). # Finit upon receiving SIGINT (from the kernel).
#task <sys/key/ctrlaltdel> [12345789] initctl reboot -- Rebooting system #task reboot {
# description = "Rebooting system"
# runlevel = "12345789"
# conditions = { "sys/key/ctrlaltdel" }
# command = "initctl reboot"
#}
# Task to run if the kernel gets a power fail condition is pressed. # Task to run if the kernel gets a power fail condition is pressed.
# Asserted by Finit upon receiving SIGPWR (from the kernel). # Asserted by Finit upon receiving SIGPWR (from the kernel).
#task <sys/pwr/fail> [12345789] initctl poweroff -- Shutting down system #task poweroff {
# description = "Shutting down system"
# runlevel = "12345789"
# conditions = { "sys/pwr/fail" }
# command = "initctl poweroff"
#}
## Bootstrap services and tasks ## Bootstrap services and tasks
# Can be listed here or in /etc/finit.d/*.conf # Can be listed here or in /etc/finit.d/*.conf
+7 -1
View File
@@ -1,3 +1,9 @@
# Handle PWR button to shutdown/reboot -- useful in Qemu (virt-manager) # Handle PWR button to shutdown/reboot -- useful in Qemu (virt-manager)
# Depends on syslogd having started. Redirect any output to log. # Depends on syslogd having started. Redirect any output to log.
service [2345] <pid/syslogd> log acpid -f -- ACPI daemon service acpid {
description = "ACPI daemon"
runlevel = "2345"
conditions = { "pid/syslogd" }
log { }
command = "acpid -f"
}
+7 -1
View File
@@ -1 +1,7 @@
service [2345] <pid/syslogd> env:-/etc/conf.d/crond crond -f -S $CRON_OPTS -- Cron daemon service crond {
description = "Cron daemon"
runlevel = "2345"
conditions = { "pid/syslogd" }
envfile = "-/etc/conf.d/crond"
command = "crond -f -S $CRON_OPTS"
}
@@ -1,2 +1,7 @@
# Start SSH daemon as soon as basic networking comes up # Start SSH daemon as soon as basic networking comes up
service [2345] env:-/etc/conf.d/dropbear dropbear -R -F $DROPBEAR_OPTS -- Dropbear SSH daemon service dropbear {
description = "Dropbear SSH daemon"
runlevel = "2345"
envfile = "-/etc/conf.d/dropbear"
command = "dropbear -R -F $DROPBEAR_OPTS"
}
+23 -4
View File
@@ -1,5 +1,24 @@
# Consoles to start getty on when system is up # Consoles to start getty on when system is up
tty [12345] /dev/ttyS0 noclear tty ttyS0 {
tty [12345] /dev/tty1 noclear nowait runlevel = "12345"
tty [2345] /dev/tty2 noclear nowait device = "/dev/ttyS0"
tty [2345] /dev/tty3 noclear nowait noclear = true
}
tty tty1 {
runlevel = "12345"
device = "/dev/tty1"
noclear = true
nowait = true
}
tty tty2 {
runlevel = "2345"
device = "/dev/tty2"
noclear = true
nowait = true
}
tty tty3 {
runlevel = "2345"
device = "/dev/tty3"
noclear = true
nowait = true
}
+6 -1
View File
@@ -1,2 +1,7 @@
# Oneshot task to run once at bootstrap # Oneshot task to run once at bootstrap
task [S] env:/etc/conf.d/loadkmap zcat $KEYMAP | loadkmap -- Loading keymap task keymap {
description = "Loading keymap"
runlevel = "S"
envfile = "/etc/conf.d/loadkmap"
command = "zcat $KEYMAP | loadkmap"
}
+5 -1
View File
@@ -1 +1,5 @@
service [2345] lxdm -- Lightweight Login Manager service lxdm {
description = "Lightweight Login Manager"
runlevel = "2345"
command = "lxdm"
}
@@ -1,7 +1,2 @@
## Linux kernel modules to load ## Linux kernel modules to load
#module fbcon #modules = { "fbcon", "button", "evdev", "mousedev", "8139cp", "softdog" }
#module button
#module evdev
#module mousedev
#module 8139cp
#module softdog
+8 -1
View File
@@ -1,2 +1,9 @@
# Busybox ntpd has no option to use syslog when running in foreground # Busybox ntpd has no option to use syslog when running in foreground
service [2345] <pid/syslogd> env:-/etc/conf.d/ntpd log ntpd -n $NTPD_OPTS -- NTP daemon service ntpd {
description = "NTP daemon"
runlevel = "2345"
conditions = { "pid/syslogd" }
envfile = "-/etc/conf.d/ntpd"
log { }
command = "ntpd -n $NTPD_OPTS"
}
+13 -2
View File
@@ -1,4 +1,15 @@
# Start syslogd as soon as possible, should always run # Start syslogd as soon as possible, should always run
# Start klogd as soon as possible, but after syslogd # Start klogd as soon as possible, but after syslogd
service [S12345] env:-/etc/conf.d/syslog syslogd -n $SYSLOGD_OPTS -- Syslog daemon service syslogd {
service [S12345] <pid/syslogd> env:-/etc/conf.d/klogd klogd -n $KLOGD_OPTS -- Kernel log daemon description = "Syslog daemon"
runlevel = "S12345"
envfile = "-/etc/conf.d/syslog"
command = "syslogd -n $SYSLOGD_OPTS"
}
service klogd {
description = "Kernel log daemon"
runlevel = "S12345"
conditions = { "pid/syslogd" }
envfile = "-/etc/conf.d/klogd"
command = "klogd -n $KLOGD_OPTS"
}
@@ -1 +1,6 @@
service [S123456789] env:-/etc/conf.d/watchdog watchdog $WATCHDOG_OPTS $WATCHDOG_DEV -- System watchdog service watchdog {
description = "System watchdog"
runlevel = "S123456789"
envfile = "-/etc/conf.d/watchdog"
command = "watchdog $WATCHDOG_OPTS $WATCHDOG_DEV"
}
+16 -6
View File
@@ -3,24 +3,34 @@
## Runlevel to start after bootstrap, runlevel 'S' ## Runlevel to start after bootstrap, runlevel 'S'
# Default is 2 # Default is 2
#runlevel 2 #runlevel = 2
# Top-level cgroups and their default settings. All groups mandatory # Top-level cgroups and their default settings. All groups mandatory
# but more can be added, max 8 groups in total currently. The cgroup # but more can be added, max 8 groups in total currently. The cgroup
# 'root' is also available, reserved for RT processes. Settings are # 'root' is also available, reserved for RT processes. Settings are
# as-is, only one shorthand 'mem.' exists, other than that it's the # as-is, only one shorthand 'mem.' exists, other than that it's the
# cgroup v2 controller default names. # cgroup v2 controller default names.
#cgroup init cpu.weight:100 #cgroup init { cpu.weight = 100 }
#cgroup user cpu.weight:100 #cgroup user { cpu.weight = 100 }
#cgroup system cpu.weight:9700 #cgroup system { cpu.weight = 9700 }
# Task to run if ctrl-alt-del is pressed. This condition is asserted by # Task to run if ctrl-alt-del is pressed. This condition is asserted by
# Finit upon receiving SIGINT (from the kernel). # Finit upon receiving SIGINT (from the kernel).
#task <sys/key/ctrlaltdel> [12345789] initctl reboot -- Rebooting system #task reboot {
# description = "Rebooting system"
# runlevel = "12345789"
# conditions = { "sys/key/ctrlaltdel" }
# command = "initctl reboot"
#}
# Task to run if the kernel gets a power fail condition is pressed. # Task to run if the kernel gets a power fail condition is pressed.
# Asserted by Finit upon receiving SIGPWR (from the kernel). # Asserted by Finit upon receiving SIGPWR (from the kernel).
#task <sys/pwr/fail> [12345789] initctl poweroff -- Shutting down system #task poweroff {
# description = "Shutting down system"
# runlevel = "12345789"
# conditions = { "sys/pwr/fail" }
# command = "initctl poweroff"
#}
## Bootstrap services and tasks ## Bootstrap services and tasks
# Can be listed here or in /etc/finit.d/*.conf # Can be listed here or in /etc/finit.d/*.conf
+8 -1
View File
@@ -1,3 +1,10 @@
# Handle PWR button to shutdown/reboot -- useful in Qemu (virt-manager) # Handle PWR button to shutdown/reboot -- useful in Qemu (virt-manager)
# Depends on a syslog daemon having started. Redirect any output to log. # Depends on a syslog daemon having started. Redirect any output to log.
service [2345] <pid/syslogd> env:-/etc/default/acpid log acpid -f $OPTIONS -- ACPI daemon service acpid {
description = "ACPI daemon"
runlevel = "2345"
conditions = { "pid/syslogd" }
envfile = "-/etc/default/acpid"
log { }
command = "acpid -f $OPTIONS"
}
@@ -1 +1,8 @@
task [2345] <sys/pwr/ac,pid/syslogd> halt:usr1 env:-/etc/default/anacron anacron -d -q $ANACRON_ARGS -- Anacron jobs task anacron {
description = "Anacron jobs"
runlevel = "2345"
conditions = { "sys/pwr/ac", "pid/syslogd" }
envfile = "-/etc/default/anacron"
stop-signal = "usr1"
command = "anacron -d -q $ANACRON_ARGS"
}
@@ -1,2 +1,6 @@
sysv [S] /etc/init.d/apparmor -- AppArmor initialization sysv apparmor {
description = "AppArmor initialization"
runlevel = "S"
command = "/etc/init.d/apparmor"
}
@@ -1 +1,6 @@
service [2345] env:-/etc/default/avahi-daemon avahi-daemon -s $AVAHI_DAEMON_OPTS -- Avahi mDNS/DNS-SD Stack service avahi-daemon {
description = "Avahi mDNS/DNS-SD Stack"
runlevel = "2345"
envfile = "-/etc/default/avahi-daemon"
command = "avahi-daemon -s $AVAHI_DAEMON_OPTS"
}
@@ -1,3 +1,9 @@
# To ignore errors like "org.freedesktop.hostname1", update the env file with # To ignore errors like "org.freedesktop.hostname1", update the env file with
# "--noplugin=hostname", i.e. append to BLUETOOTHD_OPTS # "--noplugin=hostname", i.e. append to BLUETOOTHD_OPTS
service [2345] log:null env:-/etc/default/bluetooth /usr/libexec/bluetooth/bluetoothd -n $BLUETOOTHD_OPTS -- Bluetooth service service bluetoothd {
description = "Bluetooth service"
runlevel = "2345"
envfile = "-/etc/default/bluetooth"
log { file = "/dev/null" }
command = "/usr/libexec/bluetooth/bluetoothd -n $BLUETOOTHD_OPTS"
}
@@ -1,2 +1,6 @@
# Oneshot task to run once at bootstrap # Oneshot task to run once at bootstrap
task [S] /lib/console-setup/console-setup.sh -- Setting up console font and keymap task console-setup {
description = "Setting up console font and keymap"
runlevel = "S"
command = "/lib/console-setup/console-setup.sh"
}
+7 -1
View File
@@ -1 +1,7 @@
service [2345] <sys/pwr/ac,pid/syslogd> env:-/etc/default/cron cron -f $EXTRA_OPTS -- Background job processing daemon service cron {
description = "Background job processing daemon"
runlevel = "2345"
conditions = { "sys/pwr/ac", "pid/syslogd" }
envfile = "-/etc/default/cron"
command = "cron -f $EXTRA_OPTS"
}
@@ -1,4 +1,9 @@
# On some systems, bootstrap can be really quick and cause elogind # On some systems, bootstrap can be really quick and cause elogind
# to not start before a user has managed to log in. To prevent # to not start before a user has managed to log in. To prevent
# this, add <pid/elogind> as condition to your TTYs in getty.conf # this, add <pid/elogind> as condition to your TTYs in getty.conf
service [2345] <pid/syslogd> /usr/libexec/elogind -- Login manager service elogind {
description = "Login manager"
runlevel = "2345"
conditions = { "pid/syslogd" }
command = "/usr/libexec/elogind"
}
+37 -6
View File
@@ -1,7 +1,38 @@
# Consoles to start getty on when system is up # Consoles to start getty on when system is up
tty [12345] /dev/tty1 linux noclear nowait tty tty1 {
tty [2345] /dev/tty2 linux nowait runlevel = "12345"
tty [2345] /dev/tty3 linux nowait device = "/dev/tty1"
tty [2345] /dev/tty4 linux nowait term = "linux"
tty [2345] /dev/tty5 linux nowait noclear = true
tty [2345] /dev/tty6 linux nowait nowait = true
}
tty tty2 {
runlevel = "2345"
device = "/dev/tty2"
term = "linux"
nowait = true
}
tty tty3 {
runlevel = "2345"
device = "/dev/tty3"
term = "linux"
nowait = true
}
tty tty4 {
runlevel = "2345"
device = "/dev/tty4"
term = "linux"
nowait = true
}
tty tty5 {
runlevel = "2345"
device = "/dev/tty5"
term = "linux"
nowait = true
}
tty tty6 {
runlevel = "2345"
device = "/dev/tty6"
term = "linux"
nowait = true
}
@@ -1,2 +1,6 @@
# Oneshot task to run once at bootstrap # Oneshot task to run once at bootstrap
task [S] /lib/console-setup/keyboard-setup.sh -- Setting up console keyboard layout task keyboard-setup {
description = "Setting up console keyboard layout"
runlevel = "S"
command = "/lib/console-setup/keyboard-setup.sh"
}
@@ -1 +1,5 @@
service [3] lightdm -- Light Display Manager service lightdm {
description = "Light Display Manager"
runlevel = "3"
command = "lightdm"
}
@@ -1,8 +1,2 @@
## Linux kernel modules to load ## Linux kernel modules to load
#module fbcon #modules = { "fbcon", "button", "evdev", "loop", "psmouse", "mousedev", "8139cp" }
#module button
#module evdev
#module loop
#module psmouse
#module mousedev
#module 8139cp
@@ -1,2 +1,6 @@
# Need to stop plymouth, or it'll block stdin on tty1 # Need to stop plymouth, or it'll block stdin on tty1
task [S] /usr/bin/plymouth quit -- Stopping Plymouth Boot Screen task plymouth {
description = "Stopping Plymouth Boot Screen"
runlevel = "S"
command = "/usr/bin/plymouth quit"
}
@@ -1,3 +1,8 @@
# Start rsyslogd as soon as possible, should always run # Start rsyslogd as soon as possible, should always run
# Provides pid/syslogd condition # Provides pid/syslogd condition
service [S12345] name:syslogd env:-/etc/default/rsyslog rsyslogd -n $RSYSLOGD_OPTIONS -- Reliable syslog daemon service syslogd {
description = "Reliable syslog daemon"
runlevel = "S12345"
envfile = "-/etc/default/rsyslog"
command = "rsyslogd -n $RSYSLOGD_OPTIONS"
}
+7 -1
View File
@@ -1,2 +1,8 @@
# Simple NTP client (SNTP) # Simple NTP client (SNTP)
service [2345] <net/route/default> env:-/etc/default/sntpd sntpd -n $SNTPD_OPTIONS -- SNTP client service sntpd {
description = "SNTP client"
runlevel = "2345"
conditions = { "net/route/default" }
envfile = "-/etc/default/sntpd"
command = "sntpd -n $SNTPD_OPTIONS"
}
+7 -1
View File
@@ -1,2 +1,8 @@
# Start SSH daemon as soon as basic networking comes up # Start SSH daemon as soon as basic networking comes up
service [2345] <net/lo/up> env:-/etc/default/ssh /usr/sbin/sshd -D $SSHD_OPTS -- OpenSSH daemon service sshd {
description = "OpenSSH daemon"
runlevel = "2345"
conditions = { "net/lo/up" }
envfile = "-/etc/default/ssh"
command = "/usr/sbin/sshd -D $SSHD_OPTS"
}
@@ -1,2 +1,7 @@
# Start sysklogd as soon as possible, should always run if enabled # Start sysklogd as soon as possible, should always run if enabled
service [S123456789] env:-/etc/default/syslogd syslogd -F $SYSLOGD_OPTIONS -- System logging daemon service syslogd {
description = "System logging daemon"
runlevel = "S123456789"
envfile = "-/etc/default/syslogd"
command = "syslogd -F $SYSLOGD_OPTIONS"
}
+5 -1
View File
@@ -1,4 +1,8 @@
# Here we use XDM since it has few dependencies (relatively speaking). # Here we use XDM since it has few dependencies (relatively speaking).
# It is also an example of a service without a -- description. # It is also an example of a service without a -- description.
# service [3] lxdm -- Lightweight Login Manager # service [3] lxdm -- Lightweight Login Manager
service [3] xdm -nodaemon -- X Display Manager service xdm {
description = "X Display Manager"
runlevel = "3"
command = "xdm -nodaemon"
}
+107 -43
View File
@@ -1,85 +1,149 @@
# Sample finit.conf to demonstrate the syntax # Sample finit.conf to demonstrate the syntax
# #
host testbed hostname = "testbed"
# Linux kernel modules to load # Linux kernel modules to load
module button modules = { "button", "evdev", "loop", "psmouse" }
module evdev
module loop
module psmouse
# Top-level cgroups and their default settings. All groups mandatory # Top-level cgroups and their default settings. All groups mandatory
# but more can be added, max 8 groups in total currently. The cgroup # but more can be added, max 8 groups in total currently. The cgroup
# 'root' is also available, reserved for RT processes. Settings are # 'root' is also available, reserved for RT processes. Settings are
# as-is, only one shorthand 'mem.' exists, other than that it's the # as-is, only one shorthand 'mem.' exists, other than that it's the
# cgroup v2 controller default names. # cgroup v2 controller default names.
cgroup init cpu.weight:100 cgroup init { cpu.weight = 100 }
cgroup user cpu.weight:100 cgroup user { cpu.weight = 100 }
cgroup system cpu.weight:9700 cpu.max:50000 cgroup system { cpu.weight = 9700 cpu.max = 50000 }
# Example extra cgroup # Example extra cgroup
cgroup maint cpu.weight:100 cgroup maint { cpu.weight = 100 }
# Runlevel to start after bootstrap, runlevel 'S' # Runlevel to start after bootstrap, runlevel 'S'
runlevel 2 runlevel = 2
# Network bringup script # Network bringup script
network service networking start network = "service networking start"
# Max file size for each log file: 100 kiB, rotate max 4 copies: # Max file size for each log file: 100 kiB, rotate max 4 copies:
# log => log.1 => log.2.gz => log.3.gz => log.4.gz # log => log.1 => log.2.gz => log.3.gz => log.4.gz
log size:100k count:4 log {
size = 100k
count = 4
}
# Virtual consoles to start getty on # Virtual consoles to start getty on
tty /dev/tty1 tty tty1 { device = "/dev/tty1" }
tty /dev/tty2 tty tty2 { device = "/dev/tty2" }
tty /dev/tty3 tty tty3 { device = "/dev/tty3" }
# Task to run if ctrl-alt-del is pressed. This condition is asserted by # Task to run if ctrl-alt-del is pressed. This condition is asserted by
# Finit upon receiving SIGINT (from the kernel). # Finit upon receiving SIGINT (from the kernel).
task <sys/key/ctrlaltdel> [12345789] initctl reboot -- Rebooting system task reboot {
description = "Rebooting system"
runlevel = "12345789"
conditions = { "sys/key/ctrlaltdel" }
command = "initctl reboot"
}
# Task to run if the kernel gets a power fail condition is pressed. # Task to run if the kernel gets a power fail condition is pressed.
# Asserted by Finit upon receiving SIGPWR (from the kernel). # Asserted by Finit upon receiving SIGPWR (from the kernel).
task <sys/pwr/fail> [12345789] initctl poweroff -- Shutting down system task poweroff {
description = "Shutting down system"
runlevel = "12345789"
conditions = { "sys/pwr/fail" }
command = "initctl poweroff"
}
# Alternative method instead of runparts # Alternative method instead of runparts
#task [S] /etc/init.d/keyboard-setup start -- Setting up preliminary keymap #task keyboard-setup {
#task [S] /etc/init.d/acpid start -- Starting ACPI Daemon # description = "Setting up preliminary keymap"
#task [S] /etc/init.d/kbd start -- Preparing console # runlevel = "S"
#run [2] /etc/init.d/networking start -- Start networking # command = "/etc/init.d/keyboard-setup start"
#}
#task acpid {
# description = "Starting ACPI Daemon"
# runlevel = "S"
# command = "/etc/init.d/acpid start"
#}
#task kbd {
# description = "Preparing console"
# runlevel = "S"
# command = "/etc/init.d/kbd start"
#}
#run networking {
# description = "Start networking"
# runlevel = "2"
# command = "/etc/init.d/networking start"
#}
# Services to be monitored and respawned as needed # Services to be monitored and respawned as needed
# klgod and syslogd are placed in the maint cgroup # klogd and syslogd are placed in the maint cgroup. There is no
cgroup.maint # "current cgroup" to switch in this format, every block names its own.
service [2345] <pid/syslogd> klogd -n -- Kernel logging server service klogd {
service [2345] syslogd -n -- Syslog server description = "Kernel logging server"
runlevel = "2345"
conditions = { "pid/syslogd" }
cgroup maint {}
command = "klogd -n"
}
service syslogd {
description = "Syslog server"
runlevel = "2345"
cgroup maint {}
command = "syslogd -n"
}
# gdm in the system cgroup (default when read from it's own .conf file) # gdm gets its own limits inside the system group, which is where
cgroup.system # services end up when no cgroup block is given.
service [3] cgroup:cpu.weight:250,mem.max:10M gdm -- GNOME Display Manager service gdm {
description = "GNOME Display Manager"
runlevel = "3"
cgroup system {
cpu.weight = 250
memory.max = 10M
}
command = "gdm"
}
# Start SSH daemon with opts from /etc/default/ssh (if available), move # Start SSH daemon with opts from /etc/default/ssh (if available), move
# to user cgroup with cpu.weight:250. Default for services is system # to user cgroup with cpu.weight 250. Default weight in the user group
# group. Default weight in user group is 100 (above). Max length of # is 100 (above).
# cgroup argument is (currently) 63 chars. service sshd {
# description = "OpenSSH daemon"
# Notice alternative syntax where current cgroup is only set for this runlevel = "2345"
# particular service. envfile = "-/etc/default/ssh"
service [2345] cgroup.user:cpu.weight:250,mem.max:10M env:-/etc/default/ssh /usr/sbin/sshd -D $SSHD_OPTS -- OpenSSH daemon cgroup user {
cpu.weight = 250
memory.max = 10M
}
command = "/usr/sbin/sshd -D $SSHD_OPTS"
}
# The BusyBox ntpd does not use syslog when running in the foreground # The BusyBox ntpd does not use syslog when running in the foreground
# So we use this trick to redirect stdout/stderr to a log file. The # So we use this trick to redirect stdout/stderr to a log file. The
# log file is rotated with the above settings. The condition declares # log file is rotated with the above settings. The condition declares
# a dependency on a system default route (gateway) to be set. A single # a dependency on a system default route (gateway) to be set. ntpd
# <!> at the beginning means ntpd does not respect SIGHUP for restart. # does not respect SIGHUP, so Finit restarts it on reload instead.
service [2345] <!net/route/default> log:/var/log/ntpd.log ntpd -n -l -I eth0 -- NTP daemon service ntpd {
description = "NTP daemon"
runlevel = "2345"
conditions = { "net/route/default" }
reload-signal = "none"
log { file = "/var/log/ntpd.log" }
command = "ntpd -n -l -I eth0"
}
# Run start scripts from this directory # Run start scripts from this directory
# runparts /etc/start.d #runparts = "/etc/start.d"
# For multiple instances of the same service, add :ID somewhere between # For multiple instances of the same service, add :ID to the block title.
# the service/run/task keyword and the command. service httpd:80 {
service :80 [2345] /sbin/httpd -f -h /http -p 80 -- Web server description = "Web server"
service :8080 [2345] /sbin/httpd -f -h /http -p 8080 -- Old web server runlevel = "2345"
command = "/sbin/httpd -f -h /http -p 80"
}
service httpd:8080 {
description = "Old web server"
runlevel = "2345"
command = "/sbin/httpd -f -h /http -p 8080"
}
+16 -6
View File
@@ -3,24 +3,34 @@
## Runlevel to start after bootstrap, runlevel 'S' ## Runlevel to start after bootstrap, runlevel 'S'
# Default is 2 # Default is 2
#runlevel 2 #runlevel = 2
# Top-level cgroups and their default settings. All groups mandatory # Top-level cgroups and their default settings. All groups mandatory
# but more can be added, max 8 groups in total currently. The cgroup # but more can be added, max 8 groups in total currently. The cgroup
# 'root' is also available, reserved for RT processes. Settings are # 'root' is also available, reserved for RT processes. Settings are
# as-is, only one shorthand 'mem.' exists, other than that it's the # as-is, only one shorthand 'mem.' exists, other than that it's the
# cgroup v2 controller default names. # cgroup v2 controller default names.
#cgroup init cpu.weight:100 #cgroup init { cpu.weight = 100 }
#cgroup user cpu.weight:100 #cgroup user { cpu.weight = 100 }
#cgroup system cpu.weight:9700 #cgroup system { cpu.weight = 9700 }
# Task to run if ctrl-alt-del is pressed. This condition is asserted by # Task to run if ctrl-alt-del is pressed. This condition is asserted by
# Finit upon receiving SIGINT (from the kernel). # Finit upon receiving SIGINT (from the kernel).
#task <sys/key/ctrlaltdel> [12345789] initctl reboot -- Rebooting system #task reboot {
# description = "Rebooting system"
# runlevel = "12345789"
# conditions = { "sys/key/ctrlaltdel" }
# command = "initctl reboot"
#}
# Task to run if the kernel gets a power fail condition is pressed. # Task to run if the kernel gets a power fail condition is pressed.
# Asserted by Finit upon receiving SIGPWR (from the kernel). # Asserted by Finit upon receiving SIGPWR (from the kernel).
#task <sys/pwr/fail> [12345789] initctl poweroff -- Shutting down system #task poweroff {
# description = "Shutting down system"
# runlevel = "12345789"
# conditions = { "sys/pwr/fail" }
# command = "initctl poweroff"
#}
## Bootstrap services and tasks ## Bootstrap services and tasks
# Can be listed here or in /etc/finit.d/*.conf # Can be listed here or in /etc/finit.d/*.conf
+5 -1
View File
@@ -1,3 +1,7 @@
# Handle PWR button to shutdown/reboot -- useful in Qemu (virt-manager) # Handle PWR button to shutdown/reboot -- useful in Qemu (virt-manager)
# Depends on syslogd having started. Redirect any output to log. # Depends on syslogd having started. Redirect any output to log.
service [2345] acpid -f -- ACPI daemon service acpid {
description = "ACPI daemon"
runlevel = "2345"
command = "acpid -f"
}
+6 -1
View File
@@ -1 +1,6 @@
service [2345] <pid/syslogd> crond -f -S -c /etc/crontabs -- Cron daemon service crond {
description = "Cron daemon"
runlevel = "2345"
conditions = { "pid/syslogd" }
command = "crond -f -S -c /etc/crontabs"
}
+5 -1
View File
@@ -1 +1,5 @@
service [2345] dhcpcd -B -M -- DHCP client service dhcpcd {
description = "DHCP client"
runlevel = "2345"
command = "dhcpcd -B -M"
}
+5 -1
View File
@@ -1 +1,5 @@
service [S12345] dmeventd -f -- Device mapper event daemon service dmeventd {
description = "Device mapper event daemon"
runlevel = "S12345"
command = "dmeventd -f"
}
+18 -3
View File
@@ -1,4 +1,19 @@
# Consoles to start Finit built-in getty on when system is up # Consoles to start Finit built-in getty on when system is up
tty [12345] /dev/tty1 noclear nowait tty tty1 {
tty [2345] /dev/tty2 noclear nowait runlevel = "12345"
tty [2345] /dev/tty3 noclear nowait device = "/dev/tty1"
noclear = true
nowait = true
}
tty tty2 {
runlevel = "2345"
device = "/dev/tty2"
noclear = true
nowait = true
}
tty tty3 {
runlevel = "2345"
device = "/dev/tty3"
noclear = true
nowait = true
}
+5 -1
View File
@@ -1,2 +1,6 @@
# Oneshot task to run once at bootstrap # Oneshot task to run once at bootstrap
task [S] zcat /etc/keymap/se.bmap.gz | loadkmap -- Loading keymap task keymap {
description = "Loading keymap"
runlevel = "S"
command = "zcat /etc/keymap/se.bmap.gz | loadkmap"
}
+5 -1
View File
@@ -1 +1,5 @@
service [2345] lxdm -- Lightweight Login Manager service lxdm {
description = "Lightweight Login Manager"
runlevel = "2345"
command = "lxdm"
}
+2 -6
View File
@@ -1,7 +1,3 @@
## Linux kernel modules to load ## Linux kernel modules to load
#module fbcon # Other candidates: fbcon, button, evdev, mousedev, 8139cp
#module button modules = { "softdog" }
#module evdev
#module mousedev
#module 8139cp
module softdog
+7 -1
View File
@@ -1,2 +1,8 @@
# Silly Busybox ntpd has no option to use syslog when running in foreground # Silly Busybox ntpd has no option to use syslog when running in foreground
service [2345] <pid/syslogd> log ntpd -n -N -p pool.ntp.org -- NTP daemon service ntpd {
description = "NTP daemon"
runlevel = "2345"
conditions = { "pid/syslogd" }
log { }
command = "ntpd -n -N -p pool.ntp.org"
}
+5 -1
View File
@@ -1,2 +1,6 @@
# Start SSH daemon as soon as basic networking comes up # Start SSH daemon as soon as basic networking comes up
service [2345] /usr/sbin/sshd -D -- OpenSSH daemon service sshd {
description = "OpenSSH daemon"
runlevel = "2345"
command = "/usr/sbin/sshd -D"
}
+11 -2
View File
@@ -1,4 +1,13 @@
# Start syslogd as soon as possible, should always run # Start syslogd as soon as possible, should always run
# Start klogd as soon as possible, but after syslogd # Start klogd as soon as possible, but after syslogd
service [S12345] syslogd -n -- Syslog daemon service syslogd {
service [S12345] <pid/syslogd> klogd -n -- Kernel log daemon description = "Syslog daemon"
runlevel = "S12345"
command = "syslogd -n"
}
service klogd {
description = "Kernel log daemon"
runlevel = "S12345"
conditions = { "pid/syslogd" }
command = "klogd -n"
}
+7 -1
View File
@@ -1 +1,7 @@
service @uuidd:uuidd [2345] uuidd -F -- UUID generation daemon service uuidd {
description = "UUID generation daemon"
runlevel = "2345"
user = "uuidd"
group = "uuidd"
command = "uuidd -F"
}
+124 -24
View File
@@ -5,51 +5,151 @@
# often needs to be synchronized carefully, we suggest using your system log # often needs to be synchronized carefully, we suggest using your system log
# daemon as the barrier for all other services. E.g.: # daemon as the barrier for all other services. E.g.:
# #
# service if:udevd <run/udevadm:5/success> [S0123456789] syslogd -F -- System log daemon # service syslogd {
# service if:mdev <run/coldplug/success> [S0123456789] syslogd -F -- System log daemon # description = "System log daemon"
# service if:mdevd <run/coldplug/success> [S0123456789] syslogd -F -- System log daemon # runlevel = "S0123456789"
# if = "udevd"
# conditions = { "run/udevadm:5/success" }
# command = "syslogd -F"
# }
#
# with `if = "mdev"` or `if = "mdevd"` and the matching coldplug condition
# for those variants.
# #
# This provdes a <pid/syslogd> condition that can act as a barrier for all # This provdes a <pid/syslogd> condition that can act as a barrier for all
# other services. Notice the `if:` statement and the condition for starting # other services. Notice the `if` setting: the condition for starting
# syslogd is only considered if either udevd or mdev (service) is loaded and # syslogd is only considered if either udevd or mdev (service) is loaded and
# is guaranteed to run after each respective run stanza have completed. # is guaranteed to run after each respective run stanza have completed.
# #
# Override this file by copying it to /etc/finit.d/, using the same name, then # Override this file by copying it to /etc/finit.d/, using the same name, then
# change the contents any way you like, it can even be empty. # change the contents any way you like, it can even be empty.
#
# The leading '-' on every command says a missing binary is expected here, so
# the block is skipped quietly and the next candidate gets its turn.
# Check for systemd-udevd and eudev, if we find both, we opt for the latter. # Check for systemd-udevd and eudev, if we find both, we opt for the latter.
service nowarn cgroup.system,name:udevd name:udevd notify:none env:-/etc/default/udevd pid:udevd log \ service udevd {
[S12345789] /lib/systemd/systemd-udevd $UDEVD_ARGS -- Device event daemon (udev) description = "Device event daemon (udev)"
service nowarn cgroup.system,name:udevd name:udevd notify:none env:-/etc/default/udevd pid:udevd log \ runlevel = "S12345789"
[S12345789] udevd $UDEVD_ARGS -- Device event daemon (udev) notify = "none"
envfile = "-/etc/default/udevd"
pidfile = "udevd"
pidfile-create = true
log { }
cgroup system { name = "udevd" }
command = "-/lib/systemd/systemd-udevd $UDEVD_ARGS"
}
service udevd {
description = "Device event daemon (udev)"
runlevel = "S12345789"
notify = "none"
envfile = "-/etc/default/udevd"
pidfile = "udevd"
pidfile-create = true
log { }
cgroup system { name = "udevd" }
command = "-udevd $UDEVD_ARGS"
}
# Wait for udevd to start, then trigger coldplug events and module loading. # Wait for udevd to start, then trigger coldplug events and module loading.
# The last 'settle' call waits for it to finalize processing all uevents. # The last 'settle' call waits for it to finalize processing all uevents.
run nowarn if:udevd cgroup.init,name:udevadm :1 [S] <service/udevd/ready> log udevadm settle -t 0 -- run udevadm:1 {
run nowarn if:udevd cgroup.init,name:udevadm :2 [S] <service/udevd/ready> log udevadm control --reload -- runlevel = "S"
run nowarn if:udevd cgroup.init,name:udevadm :3 [S] <service/udevd/ready> log udevadm trigger -c add -t devices -- Requesting device events if = "udevd"
run nowarn if:udevd cgroup.init,name:udevadm :4 [S] <service/udevd/ready> log udevadm trigger -c add -t subsystems -- Requesting subsystem events conditions = { "service/udevd/ready" }
run nowarn if:udevd cgroup.init,name:udevadm :5 [S] <service/udevd/ready> log udevadm settle -t 30 -- Waiting for udev to finish log { }
cgroup init { name = "udevadm" }
command = "-udevadm settle -t 0"
}
run udevadm:2 {
runlevel = "S"
if = "udevd"
conditions = { "service/udevd/ready" }
log { }
cgroup init { name = "udevadm" }
command = "-udevadm control --reload"
}
run udevadm:3 {
description = "Requesting device events"
runlevel = "S"
if = "udevd"
conditions = { "service/udevd/ready" }
log { }
cgroup init { name = "udevadm" }
command = "-udevadm trigger -c add -t devices"
}
run udevadm:4 {
description = "Requesting subsystem events"
runlevel = "S"
if = "udevd"
conditions = { "service/udevd/ready" }
log { }
cgroup init { name = "udevadm" }
command = "-udevadm trigger -c add -t subsystems"
}
run udevadm:5 {
description = "Waiting for udev to finish"
runlevel = "S"
if = "udevd"
conditions = { "service/udevd/ready" }
log { }
cgroup init { name = "udevadm" }
command = "-udevadm settle -t 30"
}
# If udevd is not available, check for mdevd. Unlike plain 'mdev -df', the # If udevd is not available, check for mdevd. Unlike plain 'mdev -df', the
# mdevd-coldplug process exits when mdevd has completed. So the condition # mdevd-coldplug process exits when mdevd has completed. So the condition
# <run/coldplug/success> (same as for plain mdev below) can be relied on as a # <run/mdevd-coldplug/success> can be relied on as a barrier for services
# barrier for services that, e.g., need to probe for switchcore ports or PHYs # that, e.g., need to probe for switchcore ports or PHYs that require
# that require firmware loading before they show up. # firmware loading before they show up.
service nowarn conflict:udevd,mdev cgroup.init,name:mdevd notify:none if:!udevd \ service mdevd {
[S12345789] notify:s6 mdevd -O 4 -D %n -- Device event daemon (mdevd) description = "Device event daemon (mdevd)"
run nowarn conflict:udevd,mdev cgroup.init,name:coldplug <service/mdevd/ready> \ runlevel = "S12345789"
[S] mdevd-coldplug -- Cold plugging system if = "!udevd"
conflicts = { "udevd", "mdev" }
notify = "s6"
cgroup init { name = "mdevd" }
command = "-mdevd -O 4 -D %n"
}
# NOTE: this block is named for its command, so its barrier condition is
# <run/mdevd-coldplug/success>, not the <run/coldplug/success> the
# plain mdev stanza below provides. The legacy line spelled the
# name inside the cgroup argument, where it names the cgroup leaf
# rather than the service, and the two paths have differed ever
# since. Left as it was so boot ordering does not change.
run mdevd-coldplug {
description = "Cold plugging system"
runlevel = "S"
conflicts = { "udevd", "mdev" }
conditions = { "service/mdevd/ready" }
cgroup init { name = "coldplug" }
command = "-mdevd-coldplug"
}
# If neither udevd or mdevd are available, fall back to mdev. The new daemon # If neither udevd or mdevd are available, fall back to mdev. The new daemon
# mode calls `mdev -s` internally but does not create a PID file when that is # mode calls `mdev -s` internally but does not create a PID file when that is
# done, so synchronization with coldplug is fragile. # done, so synchronization with coldplug is fragile.
service nowarn conflict:udevd,mdevd cgroup.init,name:mdev notify:none if:!udevd,!mdevd \ service mdev {
[S12345789] mdev -df -S -- Device event daemon (mdev) description = "Device event daemon (mdev)"
runlevel = "S12345789"
if = "!udevd,!mdevd"
conflicts = { "udevd", "mdevd" }
notify = "none"
cgroup init { name = "mdev" }
command = "-mdev -df -S"
}
# Trigger a replay of all uevents from boot, before userspace was up and the # Trigger a replay of all uevents from boot, before userspace was up and the
# filesystem mounted. Compared to udevd, we don't know when 'mdev -df' has # filesystem mounted. Compared to udevd, we don't know when 'mdev -df' has
# finished processing all events, i.e., depending on <run/coldplug/success> is # finished processing all events, i.e., depending on <run/coldplug/success> is
# not an indicator of all devices having been (re)discovered and fully set up. # not an indicator of all devices having been (re)discovered and fully set up.
run nowarn conflict:udevd,mdevd cgroup.init name:coldplug if:mdev <service/mdev/running> \ run coldplug {
[S] @pkglibexecdir@/coldplug -- Cold plugging system description = "Cold plugging system"
runlevel = "S"
if = "mdev"
conflicts = { "udevd", "mdevd" }
conditions = { "service/mdev/running" }
cgroup init {}
command = "-@pkglibexecdir@/coldplug"
}
+9 -3
View File
@@ -1,4 +1,10 @@
# Test service, only used for `make check`, not for public use # Test service, only used for `make check`, not for public use
service [S123456789] name:testserv pid:!/run/testserv.pid \ service testserv {
<boot/testserv> cgroup.system notify:none \ description = "Test serv daemon"
/sbin/serv -n -p -i testserv -- Test serv daemon runlevel = "S123456789"
conditions = { "boot/testserv" }
notify = "none"
pidfile = "/run/testserv.pid"
cgroup system {}
command = "/sbin/serv -n -p -i testserv"
}