]> git.ipfire.org Git - thirdparty/dracut.git/blob - modules.d/98dracut-systemd/dracut-shutdown.service.8.asc
fix(dracut-shutdown): add cleanup handler on failure
[thirdparty/dracut.git] / modules.d / 98dracut-systemd / dracut-shutdown.service.8.asc
1 DRACUT-SHUTDOWN.SERVICE(8)
2 ===========================
3 :doctype: manpage
4 :man source: dracut
5 :man manual: dracut
6
7 NAME
8 ----
9 dracut-shutdown.service - unpack the initramfs to /run/initramfs
10
11 SYNOPSIS
12 --------
13 dracut-shutdown.service
14
15 DESCRIPTION
16 -----------
17 This service unpacks the initramfs image to /run/initramfs.
18 systemd pivots into /run/initramfs at shutdown, so the root filesystem
19 can be safely unmounted.
20
21 The following steps are executed during a shutdown:
22
23 * systemd switches to the shutdown.target
24 * systemd starts /lib/systemd/system/shutdown.target.wants/dracut-shutdown.service
25 * dracut-shutdown.service executes /usr/lib/dracut/dracut-initramfs-restore which unpacks the initramfs to /run/initramfs
26 * systemd finishes shutdown.target
27 * systemd kills all processes
28 * systemd tries to unmount everything and mounts the remaining read-only
29 * systemd checks, if there is a /run/initramfs/shutdown executable
30 * 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.
31 * shutdown will try to umount every /oldroot mount and calls the various shutdown hooks from the dracut modules
32
33 This ensures, that all devices are disassembled and unmounted cleanly.
34
35 To debug the shutdown process, you can get a shell in the shutdown procedure
36 by injecting "rd.break=pre-shutdown rd.shell" or "rd.break=shutdown rd.shell".
37 ----
38 # mkdir -p /run/initramfs/etc/cmdline.d
39 # echo "rd.break=pre-shutdown rd.shell" > /run/initramfs/etc/cmdline.d/debug.conf
40 # touch /run/initramfs/.need_shutdown
41 ----
42
43 In case the unpack of the initramfs fails, dracut-shutdown-onfailure.service
44 executes to make sure switch root doesn't happen, since it would result in
45 switching to an incomplete initramfs.
46
47 AUTHORS
48 -------
49 Harald Hoyer
50
51 SEE ALSO
52 --------
53 *dracut*(8)