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 SPDX-License-Identifier: LGPL-2.1+
8 Copyright 2012 Lennart Poettering
11 <refentry id=
"systemd-halt.service">
14 <title>systemd-halt.service
</title>
15 <productname>systemd
</productname>
19 <contrib>Developer
</contrib>
20 <firstname>Lennart
</firstname>
21 <surname>Poettering
</surname>
22 <email>lennart@poettering.net
</email>
28 <refentrytitle>systemd-halt.service
</refentrytitle>
29 <manvolnum>8</manvolnum>
33 <refname>systemd-halt.service
</refname>
34 <refname>systemd-poweroff.service
</refname>
35 <refname>systemd-reboot.service
</refname>
36 <refname>systemd-kexec.service
</refname>
37 <refname>systemd-shutdown
</refname>
38 <refpurpose>System shutdown logic
</refpurpose>
42 <para><filename>systemd-halt.service
</filename></para>
43 <para><filename>systemd-poweroff.service
</filename></para>
44 <para><filename>systemd-reboot.service
</filename></para>
45 <para><filename>systemd-kexec.service
</filename></para>
46 <para><filename>/usr/lib/systemd/systemd-shutdown
</filename></para>
47 <para><filename>/usr/lib/systemd/system-shutdown/
</filename></para>
51 <title>Description
</title>
53 <para><filename>systemd-halt.service
</filename> is a system
54 service that is pulled in by
<filename>halt.target
</filename> and
55 is responsible for the actual system halt. Similarly,
56 <filename>systemd-poweroff.service
</filename> is pulled in by
57 <filename>poweroff.target
</filename>,
58 <filename>systemd-reboot.service
</filename> by
59 <filename>reboot.target
</filename> and
60 <filename>systemd-kexec.service
</filename> by
61 <filename>kexec.target
</filename> to execute the respective
64 <para>When these services are run, they ensure that PID
1 is
66 <filename>/usr/lib/systemd/systemd-shutdown
</filename> tool which
67 is then responsible for the actual shutdown. Before shutting down,
68 this binary will try to unmount all remaining file systems,
69 disable all remaining swap devices, detach all remaining storage
70 devices and kill all remaining processes.
</para>
72 <para>It is necessary to have this code in a separate binary
73 because otherwise rebooting after an upgrade might be broken — the
74 running PID
1 could still depend on libraries which are not
75 available any more, thus keeping the file system busy, which then
76 cannot be re-mounted read-only.
</para>
78 <para>Immediately before executing the actual system
79 halt/poweroff/reboot/kexec
<filename>systemd-shutdown
</filename>
80 will run all executables in
81 <filename>/usr/lib/systemd/system-shutdown/
</filename> and pass
82 one arguments to them: either
<literal>halt
</literal>,
83 <literal>poweroff
</literal>,
<literal>reboot
</literal> or
84 <literal>kexec
</literal>, depending on the chosen action. All
85 executables in this directory are executed in parallel, and
86 execution of the action is not continued before all executables
89 <para>Note that
<filename>systemd-halt.service
</filename> (and the
90 related units) should never be executed directly. Instead, trigger
91 system shutdown with a command such as
<literal>systemctl
92 halt
</literal> or suchlike.
</para>
96 <title>See Also
</title>
98 <citerefentry><refentrytitle>systemd
</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
99 <citerefentry><refentrytitle>systemctl
</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
100 <citerefentry><refentrytitle>systemd.special
</refentrytitle><manvolnum>7</manvolnum></citerefentry>,
101 <citerefentry><refentrytitle>reboot
</refentrytitle><manvolnum>2</manvolnum></citerefentry>,
102 <citerefentry><refentrytitle>systemd-suspend.service
</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
103 <citerefentry><refentrytitle>bootup
</refentrytitle><manvolnum>7</manvolnum></citerefentry>