1<?xml version='1.0'?>
2<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
3  "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">
4<!-- SPDX-License-Identifier: LGPL-2.1-or-later -->
5
6<refentry id="systemd-sleep.conf"
7          xmlns:xi="http://www.w3.org/2001/XInclude">
8  <refentryinfo>
9    <title>systemd-sleep.conf</title>
10    <productname>systemd</productname>
11  </refentryinfo>
12
13  <refmeta>
14    <refentrytitle>systemd-sleep.conf</refentrytitle>
15    <manvolnum>5</manvolnum>
16  </refmeta>
17
18  <refnamediv>
19    <refname>systemd-sleep.conf</refname>
20    <refname>sleep.conf.d</refname>
21    <refpurpose>Suspend and hibernation configuration file</refpurpose>
22  </refnamediv>
23
24  <refsynopsisdiv>
25    <para><filename>/etc/systemd/sleep.conf</filename></para>
26    <para><filename>/etc/systemd/sleep.conf.d/*.conf</filename></para>
27    <para><filename>/run/systemd/sleep.conf.d/*.conf</filename></para>
28    <para><filename>/usr/lib/systemd/sleep.conf.d/*.conf</filename></para>
29  </refsynopsisdiv>
30
31  <refsect1>
32    <title>Description</title>
33
34    <para><command>systemd</command> supports four general
35    power-saving modes:</para>
36
37    <variablelist>
38      <varlistentry>
39        <term>suspend</term>
40
41        <listitem><para>a low-power state
42        where execution of the OS is paused,
43        and complete power loss might result
44        in lost data, and which is fast to
45        enter and exit. This corresponds to
46        suspend, standby, or freeze states as
47        understood by the kernel.
48        </para></listitem>
49      </varlistentry>
50
51      <varlistentry>
52        <term>hibernate</term>
53
54        <listitem><para>a low-power state
55        where execution of the OS is paused,
56        and complete power loss does not
57        result in lost data, and which might
58        be slow to enter and exit. This
59        corresponds to the hibernation as
60        understood by the kernel.
61        </para></listitem>
62      </varlistentry>
63
64      <varlistentry>
65        <term>hybrid-sleep</term>
66
67        <listitem><para>a low-power state
68        where execution of the OS is paused,
69        which might be slow to enter, and on
70        complete power loss does not result in
71        lost data but might be slower to exit
72        in that case. This mode is called
73        suspend-to-both by the kernel.
74        </para></listitem>
75      </varlistentry>
76
77      <varlistentry>
78        <term>suspend-then-hibernate</term>
79
80        <listitem><para>A low power state where the system is initially suspended
81        (the state is stored in RAM). If not interrupted within the delay specified by
82        <command>HibernateDelaySec=</command>, the system will be woken using an RTC
83        alarm and hibernated (the state is then stored on disk).
84        </para></listitem>
85      </varlistentry>
86
87    </variablelist>
88
89    <para>Settings in these files determine what strings
90    will be written to
91    <filename>/sys/power/disk</filename> and
92    <filename>/sys/power/state</filename> by
93    <citerefentry><refentrytitle>systemd-sleep</refentrytitle><manvolnum>8</manvolnum></citerefentry>
94    when
95    <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>
96    attempts to suspend or hibernate the machine.
97    See
98    <citerefentry><refentrytitle>systemd.syntax</refentrytitle><manvolnum>7</manvolnum></citerefentry>
99    for a general description of the syntax.</para>
100  </refsect1>
101
102  <xi:include href="standard-conf.xml" xpointer="main-conf" />
103
104  <refsect1>
105    <title>Options</title>
106
107    <para>The following options can be configured in the
108    [Sleep] section of
109    <filename>/etc/systemd/sleep.conf</filename> or a
110    <filename>sleep.conf.d</filename> file:</para>
111
112    <variablelist class='config-directives'>
113      <varlistentry>
114        <term><varname>AllowSuspend=</varname></term>
115        <term><varname>AllowHibernation=</varname></term>
116        <term><varname>AllowSuspendThenHibernate=</varname></term>
117        <term><varname>AllowHybridSleep=</varname></term>
118
119        <listitem><para>By default any power-saving mode is advertised if possible (i.e.
120        the kernel supports that mode, the necessary resources are available). Those
121        switches can be used to disable specific modes.</para>
122
123        <para>If <varname>AllowHibernation=no</varname> or <varname>AllowSuspend=no</varname> is
124        used, this implies <varname>AllowSuspendThenHibernate=no</varname> and
125        <varname>AllowHybridSleep=no</varname>, since those methods use both suspend and hibernation
126        internally. <varname>AllowSuspendThenHibernate=yes</varname> and
127        <varname>AllowHybridSleep=yes</varname> can be used to override and enable those specific
128        modes.</para></listitem>
129      </varlistentry>
130
131      <varlistentry>
132        <term><varname>SuspendMode=</varname></term>
133        <term><varname>HibernateMode=</varname></term>
134        <term><varname>HybridSleepMode=</varname></term>
135
136        <listitem><para>The string to be written to
137        <filename>/sys/power/disk</filename> by,
138        respectively,
139        <citerefentry><refentrytitle>systemd-suspend.service</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
140        <citerefentry><refentrytitle>systemd-hibernate.service</refentrytitle><manvolnum>8</manvolnum></citerefentry>, or
141        <citerefentry><refentrytitle>systemd-hybrid-sleep.service</refentrytitle><manvolnum>8</manvolnum></citerefentry>.
142        More than one value can be specified by separating
143        multiple values with whitespace. They will be tried
144        in turn, until one is written without error. If
145        neither succeeds, the operation will be aborted.
146        </para>
147
148        <para><citerefentry><refentrytitle>systemd-suspend-then-hibernate.service</refentrytitle><manvolnum>8</manvolnum></citerefentry>
149        uses the value of <varname>SuspendMode=</varname> when suspending and the value of <varname>HibernateMode=</varname> when hibernating.
150        </para></listitem>
151      </varlistentry>
152
153      <varlistentry>
154        <term><varname>SuspendState=</varname></term>
155        <term><varname>HibernateState=</varname></term>
156        <term><varname>HybridSleepState=</varname></term>
157
158        <listitem><para>The string to be written to
159        <filename>/sys/power/state</filename> by,
160        respectively,
161        <citerefentry><refentrytitle>systemd-suspend.service</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
162        <citerefentry><refentrytitle>systemd-hibernate.service</refentrytitle><manvolnum>8</manvolnum></citerefentry>, or
163        <citerefentry><refentrytitle>systemd-hybrid-sleep.service</refentrytitle><manvolnum>8</manvolnum></citerefentry>.
164        More than one value can be specified by separating
165        multiple values with whitespace. They will be tried
166        in turn, until one is written without error. If
167        neither succeeds, the operation will be aborted.
168        </para>
169
170        <para><citerefentry><refentrytitle>systemd-suspend-then-hibernate.service</refentrytitle><manvolnum>8</manvolnum></citerefentry>
171        uses the value of <varname>SuspendState=</varname> when suspending and the value of <varname>HibernateState=</varname> when hibernating.
172        </para></listitem>
173      </varlistentry>
174      <varlistentry>
175        <term><varname>HibernateDelaySec=</varname></term>
176
177        <listitem><para>The amount of time the system spends in suspend mode before the system is
178        automatically put into hibernate mode, when using
179        <citerefentry><refentrytitle>systemd-suspend-then-hibernate.service</refentrytitle><manvolnum>8</manvolnum></citerefentry>. Defaults
180        to 2h.</para></listitem>
181      </varlistentry>
182    </variablelist>
183  </refsect1>
184
185  <refsect1>
186    <title>Example: freeze</title>
187
188    <para>Example: to exploit the <quote>freeze</quote> mode added
189    in Linux 3.9, one can use <command>systemctl suspend</command>
190    with
191    <programlisting>[Sleep]
192SuspendState=freeze</programlisting></para>
193  </refsect1>
194
195  <refsect1>
196    <title>See Also</title>
197    <para>
198      <citerefentry><refentrytitle>systemd-sleep</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
199      <citerefentry><refentrytitle>systemd-suspend.service</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
200      <citerefentry><refentrytitle>systemd-hibernate.service</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
201      <citerefentry><refentrytitle>systemd-hybrid-sleep.service</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
202      <citerefentry><refentrytitle>systemd-suspend-then-hibernate.service</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
203      <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
204      <citerefentry><refentrytitle>systemd.directives</refentrytitle><manvolnum>7</manvolnum></citerefentry>
205    </para>
206  </refsect1>
207
208</refentry>
209