1DRACUT-SHUTDOWN.S(8) dracut DRACUT-SHUTDOWN.S(8)
2
3
4
6 dracut-shutdown.service - unpack the initramfs to /run/initramfs
7
9 dracut-shutdown.service
10
12 This service unpacks the initramfs image to /run/initramfs. systemd
13 pivots into /run/initramfs at shutdown, so the root filesystem can be
14 safely unmounted.
15
16 The following steps are executed during a shutdown:
17
18 • systemd switches to the shutdown.target
19
20 • systemd starts
21 /lib/systemd/system/shutdown.target.wants/dracut-shutdown.service
22
23 • dracut-shutdown.service executes
24 /usr/lib/dracut/dracut-initramfs-restore which unpacks the
25 initramfs to /run/initramfs
26
27 • systemd finishes shutdown.target
28
29 • systemd kills all processes
30
31 • systemd tries to unmount everything and mounts the remaining
32 read-only
33
34 • systemd checks, if there is a /run/initramfs/shutdown executable
35
36 • if yes, it does a pivot_root to /run/initramfs and executes
37 ./shutdown. The old root is then mounted on /oldroot.
38 /usr/lib/dracut/modules.d/99shutdown/shutdown.sh is the shutdown
39 executable.
40
41 • shutdown will try to umount every /oldroot mount and calls the
42 various shutdown hooks from the dracut modules
43
44 This ensures, that all devices are disassembled and unmounted cleanly.
45
46 To debug the shutdown process, you can get a shell in the shutdown
47 procedure by injecting "rd.break=pre-shutdown rd.shell" or
48 "rd.break=shutdown rd.shell".
49
50 # mkdir -p /run/initramfs/etc/cmdline.d
51 # echo "rd.break=pre-shutdown rd.shell" > /run/initramfs/etc/cmdline.d/debug.conf
52 # touch /run/initramfs/.need_shutdown
53
54 In case the unpack of the initramfs fails,
55 dracut-shutdown-onfailure.service executes to make sure switch root
56 doesn’t happen, since it would result in switching to an incomplete
57 initramfs.
58
60 Harald Hoyer
61
63 dracut(8)
64
65
66
67dracut 02/18/2022 DRACUT-SHUTDOWN.S(8)