]> git.ipfire.org Git - thirdparty/systemd.git/blame - man/systemd-poweroff.service.xml
update TODO
[thirdparty/systemd.git] / man / systemd-poweroff.service.xml
CommitLineData
0127336c 1<?xml version='1.0'?> <!--*-nxml-*-->
3a54a157 2<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
eea10b26 3 "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd">
db9ecf05 4<!-- SPDX-License-Identifier: LGPL-2.1-or-later -->
0127336c 5
269d17f9 6<refentry id="systemd-poweroff.service">
0127336c 7
798d3a52 8 <refentryinfo>
269d17f9 9 <title>systemd-poweroff.service</title>
798d3a52 10 <productname>systemd</productname>
798d3a52
ZJS
11 </refentryinfo>
12
13 <refmeta>
269d17f9 14 <refentrytitle>systemd-poweroff.service</refentrytitle>
798d3a52
ZJS
15 <manvolnum>8</manvolnum>
16 </refmeta>
17
18 <refnamediv>
798d3a52 19 <refname>systemd-poweroff.service</refname>
269d17f9 20 <refname>systemd-halt.service</refname>
798d3a52
ZJS
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>
798d3a52 28 <para><filename>systemd-poweroff.service</filename></para>
269d17f9 29 <para><filename>systemd-halt.service</filename></para>
798d3a52
ZJS
30 <para><filename>systemd-reboot.service</filename></para>
31 <para><filename>systemd-kexec.service</filename></para>
12b42c76 32 <para><filename>/usr/lib/systemd/systemd-shutdown</filename></para>
7fbbf283 33 <para><filename>/usr/lib/systemd/system-shutdown/</filename></para>
798d3a52
ZJS
34 </refsynopsisdiv>
35
36 <refsect1>
37 <title>Description</title>
38
e002b8a2
LP
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>
798d3a52 45
e002b8a2
LP
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>
798d3a52 51
e002b8a2
LP
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>
798d3a52 55
e002b8a2
LP
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 detached (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>
798d3a52 67
269d17f9 68 <para>Note that <filename>systemd-poweroff.service</filename> (and the related units) should never be
9551c46a 69 executed directly. Instead, trigger system shutdown with a command such as <literal>systemctl
269d17f9 70 poweroff</literal>.</para>
4de66581
LP
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>
798d3a52
ZJS
75 </refsect1>
76
77 <refsect1>
78 <title>See Also</title>
13a69c12
DT
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>
798d3a52 88 </refsect1>
0127336c
LP
89
90</refentry>