From 1d22c670b02f6a1cac8828cad606c2111f8098a6 Mon Sep 17 00:00:00 2001 From: Harald Hoyer Date: Fri, 18 Jan 2013 10:13:14 +0100 Subject: [PATCH] dracut.asc: document shutdown procedure --- dracut.asc | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/dracut.asc b/dracut.asc index 09962fe7..d11e95c4 100644 --- a/dracut.asc +++ b/dracut.asc @@ -79,7 +79,7 @@ udev pulls in modules matching the computer's detected hardware. initialized and a user-space helper started to paint animations onto the display in lockstep with the boot process. -* If the root file system is on NFS, dracut does then: +* If the root file system is on NFS, dracut does then: ** Bring up the primary network interface. ** Invoke a DHCP client, with which it can obtain a DHCP lease. ** Extract the name of the NFS share and the address of the NFS server from the @@ -120,6 +120,26 @@ final cleanup tasks. On an initramfs, the initial root file system cannot be rotated away. Instead, it is simply emptied and the final root file system mounted over the top. +== Dracut on shutdown + +On a systemd driven system, the dracut initramfs is also used for the shutdown procedure. + +The following steps are executed during a shutdown: + +* systemd switches to the shutdown.target +* systemd starts /lib/systemd/system/shutdown.target.wants/dracut-shutdown.service +* dracut-shutdown.service executes /usr/lib/dracut/dracut-initramfs-restore + which unpacks the initramfs to /run/initramfs +* systemd finishes shutdown.target +* systemd kills all processes +* systemd tries to unmount everything and mounts the remaining read-only +* systemd checks, if there is a /run/initramfs/shutdown executable +* if yes, it does a pivot_root to /run/initramfs and executes ./shutdown. + The old root is then mounted on /oldroot. /usr/lib/dracut/modules.d/99shutdown/shutdown.sh is the shutdown executable. +* shutdown will try to umount every /oldroot mount and calls the various shutdown hooks from the dracut modules + +This ensures, that all devices are disassembled and unmounted cleanly. + = User Manual == Creating an initramfs Image