]> git.ipfire.org Git - thirdparty/systemd.git/blob - man/systemd-halt.service.xml
f0b39a8828fe4142f034c02e7920bb6af5d58735
[thirdparty/systemd.git] / man / systemd-halt.service.xml
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">
4
5 <!--
6 SPDX-License-Identifier: LGPL-2.1+
7
8 Copyright 2012 Lennart Poettering
9 -->
10
11 <refentry id="systemd-halt.service">
12
13 <refentryinfo>
14 <title>systemd-halt.service</title>
15 <productname>systemd</productname>
16
17 <authorgroup>
18 <author>
19 <contrib>Developer</contrib>
20 <firstname>Lennart</firstname>
21 <surname>Poettering</surname>
22 <email>lennart@poettering.net</email>
23 </author>
24 </authorgroup>
25 </refentryinfo>
26
27 <refmeta>
28 <refentrytitle>systemd-halt.service</refentrytitle>
29 <manvolnum>8</manvolnum>
30 </refmeta>
31
32 <refnamediv>
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>
39 </refnamediv>
40
41 <refsynopsisdiv>
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>
48 </refsynopsisdiv>
49
50 <refsect1>
51 <title>Description</title>
52
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
62 actions.</para>
63
64 <para>When these services are run, they ensure that PID 1 is
65 replaced by the
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>
71
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>
77
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
87 finished.</para>
88
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>
93 </refsect1>
94
95 <refsect1>
96 <title>See Also</title>
97 <para>
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>
104 </para>
105 </refsect1>
106
107 </refentry>