From systemd-devel Sat Aug 13 20:46:37 2022 From: Patrick Schleizer Date: Sat, 13 Aug 2022 20:46:37 +0000 To: systemd-devel Subject: Re: [systemd-devel] What is the shutdown sequence with systemd and dracut? Message-Id: <414c6401-9a8a-8fb5-9fc8-6349abd53b11 () whonix ! org> X-MARC-Message: https://marc.info/?l=systemd-devel&m=166042337428839 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