1SYSTEMD-POWEROFF.SERVICE(8)systemd-poweroff.serviceSYSTEMD-POWEROFF.SERVICE(8)
2
3
4

NAME

6       systemd-poweroff.service, systemd-halt.service, systemd-reboot.service,
7       systemd-kexec.service, systemd-shutdown - System shutdown logic
8

SYNOPSIS

10       systemd-poweroff.service
11
12       systemd-halt.service
13
14       systemd-reboot.service
15
16       systemd-kexec.service
17
18       /usr/lib/systemd/systemd-shutdown
19
20       /usr/lib/systemd/system-shutdown/
21

DESCRIPTION

23       systemd-poweroff.service is a system service that is pulled in by
24       poweroff.target and is responsible for the actual system power-off
25       operation. Similarly, systemd-halt.service is pulled in by halt.target,
26       systemd-reboot.service by reboot.target and systemd-kexec.service by
27       kexec.target to execute the respective actions.
28
29       When these services are run, they ensure that PID 1 is replaced by the
30       /usr/lib/systemd/systemd-shutdown tool which is then responsible for
31       the actual shutdown. Before shutting down, this binary will try to
32       unmount all remaining file systems (or at least remount them
33       read-only), disable all remaining swap devices, detach all remaining
34       storage devices and kill all remaining processes.
35
36       It is necessary to have this code in a separate binary because
37       otherwise rebooting after an upgrade might be broken — the running PID
38       1 could still depend on libraries which are not available any more,
39       thus keeping the file system busy, which then cannot be re-mounted
40       read-only.
41
42       Shortly before executing the actual system power-off/halt/reboot/kexec
43       systemd-shutdown will run all executables in
44       /usr/lib/systemd/system-shutdown/ and pass one arguments to them:
45       either "poweroff", "halt", "reboot", or "kexec", depending on the
46       chosen action. All executables in this directory are executed in
47       parallel, and execution of the action is not continued before all
48       executables finished. Note that these executables are run after all
49       services have been shut down, and after most mounts have been detached
50       (the root file system as well as /run/ and various API file systems are
51       still around though). This means any programs dropped into this
52       directory must be prepared to run in such a limited execution
53       environment and not rely on external services or hierarchies such as
54       /var/ to be around (or writable).
55
56       Note that systemd-poweroff.service (and the related units) should never
57       be executed directly. Instead, trigger system shutdown with a command
58       such as "systemctl poweroff".
59

SEE ALSO

61       systemd(1), systemctl(1), systemd.special(7), reboot(2), systemd-
62       suspend.service(8), bootup(7)
63
64
65
66systemd 253                                        SYSTEMD-POWEROFF.SERVICE(8)
Impressum