| 1 |
# System hotplug handled by udev, mdevd, or mdev (preferred order) |
| 2 |
# |
| 3 |
# Your system usually has either udevd, mdev, or mdevd. They probe the system |
| 4 |
# for devices, loading modules and any firmware needed. Since the bootstrap |
| 5 |
# often needs to be synchronized carefully, we suggest using your system log |
| 6 |
# daemon as the barrier for all other services. E.g.: |
| 7 |
# |
| 8 |
# service if:udevd <run/udevadm:5/success> [S0123456789] syslogd -F -- System log daemon |
| 9 |
# service if:mdev <run/coldplug/success> [S0123456789] syslogd -F -- System log daemon |
| 10 |
# service if:mdevd <run/coldplug/success> [S0123456789] syslogd -F -- System log daemon |
| 11 |
# |
| 12 |
# This provdes a <pid/syslogd> condition that can act as a barrier for all |
| 13 |
# other services. Notice the `if:` statement and the condition for starting |
| 14 |
# syslogd is only considered if either udevd or mdev (service) is loaded and |
| 15 |
# is guaranteed to run after each respective run stanza have completed. |
| 16 |
# |
| 17 |
# Override this file by copying it to /etc/finit.d/, using the same name, then |
| 18 |
# change the contents any way you like, it can even be empty. |
| 19 |
|
| 20 |
# Check for systemd-udevd and eudev, if we find both, we opt for the latter. |
| 21 |
service nowarn cgroup.system name:udevd notify:none env:-/etc/default/udevd pid:udevd log \ |
| 22 |
[S12345789] /lib/systemd/systemd-udevd $UDEVD_ARGS -- Device event daemon (udev) |
| 23 |
service nowarn cgroup.system name:udevd notify:none env:-/etc/default/udevd pid:udevd log \ |
| 24 |
[S12345789] udevd $UDEVD_ARGS -- Device event daemon (udev) |
| 25 |
|
| 26 |
# Wait for udevd to start, then trigger coldplug events and module loading. |
| 27 |
# The last 'settle' call waits for it to finalize processing all uevents. |
| 28 |
run nowarn if:udevd cgroup.init :1 [S] <service/udevd/ready> log udevadm settle -t 0 -- |
| 29 |
run nowarn if:udevd cgroup.init :2 [S] <service/udevd/ready> log udevadm control --reload -- |
| 30 |
run nowarn if:udevd cgroup.init :3 [S] <service/udevd/ready> log udevadm trigger -c add -t devices -- Requesting device events |
| 31 |
run nowarn if:udevd cgroup.init :4 [S] <service/udevd/ready> log udevadm trigger -c add -t subsystems -- Requesting subsystem events |
| 32 |
run nowarn if:udevd cgroup.init :5 [S] <service/udevd/ready> log udevadm settle -t 30 -- Waiting for udev to finish |
| 33 |
|
| 34 |
# If udevd is not available, check for mdevd. Unlike plain 'mdev -df', the |
| 35 |
# mdevd-coldplug process exits when mdevd has completed. So the condition |
| 36 |
# <run/coldplug/success> (same as for plain mdev below) can be relied on as a |
| 37 |
# barrier for services that, e.g., need to probe for switchcore ports or PHYs |
| 38 |
# that require firmware loading before they show up. |
| 39 |
service nowarn conflict:udevd,mdev cgroup.init notify:none if:!udevd \ |
| 40 |
[S12345789] notify:s6 mdevd -O 4 -D %n -- Device event daemon (mdevd) |
| 41 |
run nowarn conflict:udevd,mdev cgroup.init name:coldplug <service/mdevd/ready> \ |
| 42 |
[S] mdevd-coldplug -- Cold plugging system |
| 43 |
|
| 44 |
# If neither udevd or mdevd are available, fall back to mdev. The new daemon |
| 45 |
# mode calls `mdev -s` internally but does not create a PID file when that is |
| 46 |
# done, so synchronization with coldplug is fragile. |
| 47 |
service nowarn conflict:udevd,mdevd cgroup.init notify:none if:!udevd,!mdevd \ |
| 48 |
[S12345789] mdev -df -S -- Device event daemon (mdev) |
| 49 |
|
| 50 |
# Trigger a replay of all uevents from boot, before userspace was up and the |
| 51 |
# filesystem mounted. Compared to udevd, we don't know when 'mdev -df' has |
| 52 |
# finished processing all events, i.e., depending on <run/coldplug/success> is |
| 53 |
# not an indicator of all devices having been (re)discovered and fully set up. |
| 54 |
run nowarn conflict:udevd,mdevd cgroup.init name:coldplug if:mdev <service/mdev/running> \ |
| 55 |
[S] @pkglibexecdir@/coldplug -- Cold plugging system |