1 <?xml version='1.0'?> <!--*-nxml-*-->
2 <!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN"
3 "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">
6 This file is part of systemd.
8 Copyright 2012 Lennart Poettering
10 systemd is free software; you can redistribute it and/or modify it
11 under the terms of the GNU Lesser General Public License as published by
12 the Free Software Foundation; either version 2.1 of the License, or
13 (at your option) any later version.
15 systemd is distributed in the hope that it will be useful, but
16 WITHOUT ANY WARRANTY; without even the implied warranty of
17 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18 Lesser General Public License for more details.
20 You should have received a copy of the GNU Lesser General Public License
21 along with systemd; If not, see <http://www.gnu.org/licenses/>.
24 <refentry id="systemd-halt.service">
27 <title>systemd-halt.service</title>
28 <productname>systemd</productname>
32 <contrib>Developer</contrib>
33 <firstname>Lennart</firstname>
34 <surname>Poettering</surname>
35 <email>lennart@poettering.net</email>
41 <refentrytitle>systemd-halt.service</refentrytitle>
42 <manvolnum>8</manvolnum>
46 <refname>systemd-halt.service</refname>
47 <refname>systemd-poweroff.service</refname>
48 <refname>systemd-reboot.service</refname>
49 <refname>systemd-kexec.service</refname>
50 <refname>systemd-shutdown</refname>
51 <refpurpose>System shutdown logic</refpurpose>
55 <para><filename>systemd-halt.service</filename></para>
56 <para><filename>systemd-poweroff.service</filename></para>
57 <para><filename>systemd-reboot.service</filename></para>
58 <para><filename>systemd-kexec.service</filename></para>
59 <para><filename>/usr/lib/systemd/systemd-shutdown</filename></para>
63 <title>Description</title>
65 <para><filename>systemd-halt.service</filename> is a
66 system service that is pulled in by
67 <filename>halt.target</filename> and is responsible
68 for the actual system halt. Similar,
69 <filename>systemd-poweroff.service</filename> is
70 pulled in by <filename>poweroff.target</filename>,
71 <filename>systemd-reboot.service</filename> by
72 <filename>reboot.target</filename> and
73 <filename>systemd-kexec.service</filename> by
74 <filename>kexec.target</filename> to execute the
75 respective actions.</para>
77 <para>When these services are run, they ensure that PID
79 <filename>/usr/lib/systemd/systemd-shutdown</filename>
80 tool which is then responsible for the actual
81 shutdown. Before shutting down, this binary will try to
82 unmount all remaining file systems, disable all
83 remaining swap devices, detach all remaining storage
84 devices and kill all remaining processes.</para>
86 <para>It is necessary to have this code in a separate binary
87 because otherwise rebooting after an upgrade might be broken —
88 the running PID 1 could still depend on libraries which are not
89 available any more, thus keeping the filesystem busy, which
90 then cannot be re-mounted read-only.</para>
92 <para>Immediately before executing the actual system
93 halt/poweroff/reboot/kexec
94 <filename>systemd-shutdown</filename> will run all
96 <filename>/usr/lib/systemd/system-shutdown/</filename>
97 and pass one arguments to them: either
98 <literal>halt</literal>,
99 <literal>poweroff</literal>,
100 <literal>reboot</literal> or
101 <literal>kexec</literal>, depending on the chosen
102 action. All executables in this directory are executed
103 in parallel, and execution of the action is not
104 continued before all executables finished.</para>
107 <filename>systemd-halt.service</filename> (and the
108 related units) should never be executed
109 directly. Instead, trigger system shutdown with a
110 command such as <literal>systemctl halt</literal> or
115 <title>See Also</title>
117 <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
118 <citerefentry><refentrytitle>systemctl</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
119 <citerefentry><refentrytitle>systemd.special</refentrytitle><manvolnum>7</manvolnum></citerefentry>,
120 <citerefentry><refentrytitle>reboot</refentrytitle><manvolnum>2</manvolnum></citerefentry>,
121 <citerefentry><refentrytitle>systemd-suspend.service</refentrytitle><manvolnum>8</manvolnum></citerefentry>