]> git.ipfire.org Git - thirdparty/systemd.git/blob - man/systemd-poweroff.service.xml
journald: bring order of MaxLevelXYZ= setting explanations in sync with listed names
[thirdparty/systemd.git] / man / systemd-poweroff.service.xml
1 <?xml version='1.0'?> <!--*-nxml-*-->
2 <!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
3 "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd">
4 <!-- SPDX-License-Identifier: LGPL-2.1-or-later -->
5
6 <refentry id="systemd-poweroff.service">
7
8 <refentryinfo>
9 <title>systemd-poweroff.service</title>
10 <productname>systemd</productname>
11 </refentryinfo>
12
13 <refmeta>
14 <refentrytitle>systemd-poweroff.service</refentrytitle>
15 <manvolnum>8</manvolnum>
16 </refmeta>
17
18 <refnamediv>
19 <refname>systemd-poweroff.service</refname>
20 <refname>systemd-halt.service</refname>
21 <refname>systemd-reboot.service</refname>
22 <refname>systemd-kexec.service</refname>
23 <refname>systemd-shutdown</refname>
24 <refpurpose>System shutdown logic</refpurpose>
25 </refnamediv>
26
27 <refsynopsisdiv>
28 <para><filename>systemd-poweroff.service</filename></para>
29 <para><filename>systemd-halt.service</filename></para>
30 <para><filename>systemd-reboot.service</filename></para>
31 <para><filename>systemd-kexec.service</filename></para>
32 <para><filename>/usr/lib/systemd/systemd-shutdown</filename></para>
33 <para><filename>/usr/lib/systemd/system-shutdown/</filename></para>
34 </refsynopsisdiv>
35
36 <refsect1>
37 <title>Description</title>
38
39 <para><filename>systemd-poweroff.service</filename> is a system service that is pulled in by
40 <filename>poweroff.target</filename> and is responsible for the actual system power-off
41 operation. Similarly, <filename>systemd-halt.service</filename> is pulled in by
42 <filename>halt.target</filename>, <filename>systemd-reboot.service</filename> by
43 <filename>reboot.target</filename> and <filename>systemd-kexec.service</filename> by
44 <filename>kexec.target</filename> to execute the respective actions.</para>
45
46 <para>When these services are run, they ensure that PID 1 is replaced by the
47 <filename>/usr/lib/systemd/systemd-shutdown</filename> tool which is then responsible for the actual
48 shutdown. Before shutting down, this binary will try to unmount all remaining file systems (or at least
49 remount them read-only), disable all remaining swap devices, detach all remaining storage devices and
50 kill all remaining processes.</para>
51
52 <para>It is necessary to have this code in a separate binary because otherwise rebooting after an upgrade
53 might be broken — the running PID 1 could still depend on libraries which are not available any more,
54 thus keeping the file system busy, which then cannot be re-mounted read-only.</para>
55
56 <para>Shortly before executing the actual system power-off/halt/reboot/kexec
57 <filename>systemd-shutdown</filename> will run all executables in
58 <filename>/usr/lib/systemd/system-shutdown/</filename> and pass one arguments to them: either
59 <literal>poweroff</literal>, <literal>halt</literal>, <literal>reboot</literal>, or
60 <literal>kexec</literal>, depending on the chosen action. All executables in this directory are executed
61 in parallel, and execution of the action is not continued before all executables finished. Note that
62 these executables are run <emphasis>after</emphasis> all services have been shut down, and after most
63 mounts have been unmounted (the root file system as well as <filename>/run/</filename> and various API
64 file systems are still around though). This means any programs dropped into this directory must be
65 prepared to run in such a limited execution environment and not rely on external services or hierarchies
66 such as <filename>/var/</filename> to be around (or writable).</para>
67
68 <para>Note that <filename>systemd-poweroff.service</filename> (and the related units) should never be
69 executed directly. Instead, trigger system shutdown with a command such as <literal>systemctl
70 poweroff</literal>.</para>
71
72 <para>Another form of shutdown is provided by the
73 <citerefentry><refentrytitle>systemd-soft-reboot.service</refentrytitle><manvolnum>8</manvolnum></citerefentry>
74 functionality. It reboots only the OS userspace, leaving the kernel, firmware, and hardware as it is.</para>
75 </refsect1>
76
77 <refsect1>
78 <title>See Also</title>
79 <para><simplelist type="inline">
80 <member><citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry></member>
81 <member><citerefentry><refentrytitle>systemctl</refentrytitle><manvolnum>1</manvolnum></citerefentry></member>
82 <member><citerefentry><refentrytitle>systemd.special</refentrytitle><manvolnum>7</manvolnum></citerefentry></member>
83 <member><citerefentry><refentrytitle>reboot</refentrytitle><manvolnum>2</manvolnum></citerefentry></member>
84 <member><citerefentry><refentrytitle>systemd-suspend.service</refentrytitle><manvolnum>8</manvolnum></citerefentry></member>
85 <member><citerefentry><refentrytitle>systemd-soft-reboot.service</refentrytitle><manvolnum>8</manvolnum></citerefentry></member>
86 <member><citerefentry><refentrytitle>bootup</refentrytitle><manvolnum>7</manvolnum></citerefentry></member>
87 </simplelist></para>
88 </refsect1>
89
90 </refentry>