| 1 |
'\" t |
| 2 |
.TH "SYSTEMD\-POWEROFF\&.SERVICE" "8" "" "systemd 261~rc3" "systemd-poweroff.service" |
| 3 |
.\" ----------------------------------------------------------------- |
| 4 |
.\" * Define some portability stuff |
| 5 |
.\" ----------------------------------------------------------------- |
| 6 |
.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
| 7 |
.\" http://bugs.debian.org/507673 |
| 8 |
.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html |
| 9 |
.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
| 10 |
.ie \n(.g .ds Aq \(aq |
| 11 |
.el .ds Aq ' |
| 12 |
.\" ----------------------------------------------------------------- |
| 13 |
.\" * set default formatting |
| 14 |
.\" ----------------------------------------------------------------- |
| 15 |
.\" disable hyphenation |
| 16 |
.nh |
| 17 |
.\" disable justification (adjust text to left margin only) |
| 18 |
.ad l |
| 19 |
.\" ----------------------------------------------------------------- |
| 20 |
.\" * MAIN CONTENT STARTS HERE * |
| 21 |
.\" ----------------------------------------------------------------- |
| 22 |
.SH "NAME" |
| 23 |
systemd-poweroff.service, systemd-halt.service, systemd-reboot.service, systemd-kexec.service, systemd-shutdown \- System shutdown logic |
| 24 |
.SH "SYNOPSIS" |
| 25 |
.PP |
| 26 |
systemd\-poweroff\&.service |
| 27 |
.PP |
| 28 |
systemd\-halt\&.service |
| 29 |
.PP |
| 30 |
systemd\-reboot\&.service |
| 31 |
.PP |
| 32 |
systemd\-kexec\&.service |
| 33 |
.PP |
| 34 |
/usr/lib/systemd/systemd\-shutdown |
| 35 |
.PP |
| 36 |
/usr/lib/systemd/system\-shutdown/ |
| 37 |
.SH "DESCRIPTION" |
| 38 |
.PP |
| 39 |
systemd\-poweroff\&.service |
| 40 |
is a system service that is pulled in by |
| 41 |
poweroff\&.target |
| 42 |
and is responsible for the actual system power\-off operation\&. Similarly, |
| 43 |
systemd\-halt\&.service |
| 44 |
is pulled in by |
| 45 |
halt\&.target, |
| 46 |
systemd\-reboot\&.service |
| 47 |
by |
| 48 |
reboot\&.target |
| 49 |
and |
| 50 |
systemd\-kexec\&.service |
| 51 |
by |
| 52 |
kexec\&.target |
| 53 |
to execute the respective actions\&. |
| 54 |
.PP |
| 55 |
When these services are run, they ensure that PID 1 is replaced by the |
| 56 |
/usr/lib/systemd/systemd\-shutdown |
| 57 |
binary which is then responsible for the actual shutdown\&. Before shutting down, this binary will try to unmount all remaining file systems (or at least remount them read\-only), disable all remaining swap devices, detach all remaining storage devices and kill all remaining processes\&. |
| 58 |
.PP |
| 59 |
It is necessary to have this code in a separate binary because otherwise rebooting after an upgrade might be broken\ \&\(em the running PID 1 could still depend on libraries which are not available any more, thus keeping the file system busy, which then cannot be re\-mounted read\-only\&. |
| 60 |
.PP |
| 61 |
Shortly before executing the actual system power\-off/halt/reboot/kexec, |
| 62 |
\fBsystemd\-shutdown\fR |
| 63 |
will run all executables in |
| 64 |
/usr/lib/systemd/system\-shutdown/\&. Those executables are called with one argument: either |
| 65 |
"poweroff", |
| 66 |
"halt", |
| 67 |
"reboot", or |
| 68 |
"kexec", depending on the chosen action\&. All executables in this directory are executed in parallel, and execution of the action is not continued before all executables finished\&. (A safety timeout of 90s is applied however\&.) Note that these executables are run |
| 69 |
\fIafter\fR |
| 70 |
all services have been shut down, and after most mounts have been unmounted (the root file system as well as |
| 71 |
/run/ |
| 72 |
and various API file systems are still around though)\&. This means any programs dropped into this directory must be prepared to run in such a limited execution environment and not rely on external services or hierarchies such as |
| 73 |
/var/ |
| 74 |
to be around (or writable)\&. |
| 75 |
.PP |
| 76 |
Note that |
| 77 |
systemd\-poweroff\&.service |
| 78 |
(and the related units) should never be executed directly\&. Instead, trigger system shutdown with a command such as |
| 79 |
"systemctl poweroff"\&. |
| 80 |
.PP |
| 81 |
Another form of shutdown is provided by the |
| 82 |
\fBsystemd-soft-reboot.service\fR(8) |
| 83 |
functionality\&. It reboots only the OS userspace, leaving the kernel, firmware, and hardware as it is\&. |
| 84 |
.SH "SEE ALSO" |
| 85 |
.PP |
| 86 |
\fBsystemd\fR(1), \fBsystemctl\fR(1), \fBsystemd.special\fR(7), \fBreboot\fR(2), \fBsystemd-suspend.service\fR(8), \fBsystemd-soft-reboot.service\fR(8), \fBbootup\fR(7) |