[systemd-devel] What is the shutdown sequence with systemd and dracut?

Patrick Schleizer patrick-mailinglists at whonix.org
Sat Aug 13 20:46:37 UTC 2022


After your reply, this is the hopefully revised, correct shutdown
sequence. Please correct me if I am wrong.

1. systemd runs systemd units for systemd shutdown.target

2. /lib/systemd/system-shutdown (shutdown.c) runs

3. /lib/systemd/system-shutdown runs scripts in the
/usr/lib/systemd/system-shutdown/ folder

4. /lib/systemd/system-shutdown performs further cleanup (similar to
dracut, probably some functionality duplicated with dracut, includes
kill all remaining processes, unmount remaining file systems)

5. If /run/initramfs/shutdown is present, systemd-shutdown executes it.

6. /run/initramfs/shutdown (which is at time of writing only implemented
in dracut) attempts to kill all remaining processes, unmount remaining
file systems and calls kernel.

7. If /run/initramfs/shutdown fails or /run/initramfs/shutdown is not
present, systemd-shutdown calls kernel to actually perform
halt/reboot/poweroff/kexec.

Cheers,
Patrick


More information about the systemd-devel mailing list