| 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.5/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><simplelist> |
| 26 |
<member><filename>/etc/systemd/sleep.conf</filename></member> |
| 27 |
<member><filename>/run/systemd/sleep.conf</filename></member> |
| 28 |
<member><filename>/usr/lib/systemd/sleep.conf</filename></member> |
| 29 |
<member><filename>/etc/systemd/sleep.conf.d/*.conf</filename></member> |
| 30 |
<member><filename>/run/systemd/sleep.conf.d/*.conf</filename></member> |
| 31 |
<member><filename>/usr/lib/systemd/sleep.conf.d/*.conf</filename></member> |
| 32 |
</simplelist></para> |
| 33 |
</refsynopsisdiv> |
| 34 |
|
| 35 |
<refsect1> |
| 36 |
<title>Description</title> |
| 37 |
|
| 38 |
<para><command>systemd</command> supports four general |
| 39 |
power-saving modes:</para> |
| 40 |
|
| 41 |
<variablelist> |
| 42 |
<varlistentry> |
| 43 |
<term>suspend</term> |
| 44 |
|
| 45 |
<listitem><para>a low-power state |
| 46 |
where execution of the OS is paused, |
| 47 |
and complete power loss might result |
| 48 |
in lost data, and which is fast to |
| 49 |
enter and exit. This corresponds to |
| 50 |
suspend, standby, or freeze states as |
| 51 |
understood by the kernel. |
| 52 |
</para> |
| 53 |
|
| 54 |
<xi:include href="version-info.xml" xpointer="v203"/></listitem> |
| 55 |
</varlistentry> |
| 56 |
|
| 57 |
<varlistentry> |
| 58 |
<term>hibernate</term> |
| 59 |
|
| 60 |
<listitem><para>a low-power state |
| 61 |
where execution of the OS is paused, |
| 62 |
and complete power loss does not |
| 63 |
result in lost data, and which might |
| 64 |
be slow to enter and exit. This |
| 65 |
corresponds to the hibernation as |
| 66 |
understood by the kernel. |
| 67 |
</para> |
| 68 |
|
| 69 |
<xi:include href="version-info.xml" xpointer="v203"/></listitem> |
| 70 |
</varlistentry> |
| 71 |
|
| 72 |
<varlistentry> |
| 73 |
<term>hybrid-sleep</term> |
| 74 |
|
| 75 |
<listitem><para>a low-power state |
| 76 |
where execution of the OS is paused, |
| 77 |
which might be slow to enter, and on |
| 78 |
complete power loss does not result in |
| 79 |
lost data but might be slower to exit |
| 80 |
in that case. This mode is called |
| 81 |
suspend-to-both by the kernel. |
| 82 |
</para> |
| 83 |
|
| 84 |
<xi:include href="version-info.xml" xpointer="v203"/></listitem> |
| 85 |
</varlistentry> |
| 86 |
|
| 87 |
<varlistentry> |
| 88 |
<term>suspend-then-hibernate</term> |
| 89 |
|
| 90 |
<listitem> |
| 91 |
<para>A low power state where the system is initially suspended (the state is stored in RAM). |
| 92 |
When the battery level is too low (less than 5%) or a certain timespan has passed, whichever |
| 93 |
happens first, the system is automatically woken up and then hibernated. This establishes a balance |
| 94 |
between speed and safety.</para> |
| 95 |
|
| 96 |
<para>If the system has no battery, it would be hibernated after <varname>HibernateDelaySec=</varname> |
| 97 |
has passed. If not set, then defaults to <literal>2h</literal>.</para> |
| 98 |
|
| 99 |
<para>If the system has battery, low-battery alarms (ACPI _BTP) are tried first for detecting |
| 100 |
battery percentage and wake up the system for hibernation. If <varname>HibernateDelaySec=</varname> |
| 101 |
is also set, an additional timer is configured so that the system hibernates on whichever comes |
| 102 |
first: low battery or the configured delay. If ACPI _BTP is not available, the system would |
| 103 |
regularly wake up to check the time and detect the battery percentage/discharging rate. The rate |
| 104 |
is used to schedule the next detection. If that is also not available, |
| 105 |
<varname>SuspendEstimationSec=</varname> is used as last resort.</para> |
| 106 |
|
| 107 |
<xi:include href="version-info.xml" xpointer="v239"/> |
| 108 |
</listitem> |
| 109 |
</varlistentry> |
| 110 |
|
| 111 |
</variablelist> |
| 112 |
|
| 113 |
<para>Settings in these files determine what strings |
| 114 |
will be written to |
| 115 |
<filename>/sys/power/disk</filename> and |
| 116 |
<filename>/sys/power/state</filename> by |
| 117 |
<citerefentry><refentrytitle>systemd-sleep</refentrytitle><manvolnum>8</manvolnum></citerefentry> |
| 118 |
when |
| 119 |
<citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry> |
| 120 |
attempts to suspend or hibernate the machine. |
| 121 |
See |
| 122 |
<citerefentry><refentrytitle>systemd.syntax</refentrytitle><manvolnum>7</manvolnum></citerefentry> |
| 123 |
for a general description of the syntax.</para> |
| 124 |
</refsect1> |
| 125 |
|
| 126 |
<xi:include href="standard-conf.xml" xpointer="main-conf" /> |
| 127 |
|
| 128 |
<refsect1> |
| 129 |
<title>Options</title> |
| 130 |
|
| 131 |
<para>The following options can be configured in the |
| 132 |
[Sleep] section of |
| 133 |
<filename>/etc/systemd/sleep.conf</filename> or a |
| 134 |
<filename>sleep.conf.d</filename> file:</para> |
| 135 |
|
| 136 |
<variablelist class='config-directives'> |
| 137 |
<varlistentry> |
| 138 |
<term><varname>AllowSuspend=</varname></term> |
| 139 |
<term><varname>AllowHibernation=</varname></term> |
| 140 |
<term><varname>AllowHybridSleep=</varname></term> |
| 141 |
<term><varname>AllowSuspendThenHibernate=</varname></term> |
| 142 |
|
| 143 |
<listitem><para>By default, any power-saving mode is advertised if possible (i.e. |
| 144 |
the kernel supports that mode, the necessary resources are available). Those |
| 145 |
switches can be used to disable specific modes.</para> |
| 146 |
|
| 147 |
<para>If <varname>AllowHibernation=no</varname> or <varname>AllowSuspend=no</varname> is |
| 148 |
used, this implies <varname>AllowSuspendThenHibernate=no</varname> and |
| 149 |
<varname>AllowHybridSleep=no</varname>, since those methods use both suspend and hibernation |
| 150 |
internally. <varname>AllowSuspendThenHibernate=yes</varname> and |
| 151 |
<varname>AllowHybridSleep=yes</varname> can be used to override and enable those specific |
| 152 |
modes.</para> |
| 153 |
|
| 154 |
<xi:include href="version-info.xml" xpointer="v240"/></listitem> |
| 155 |
</varlistentry> |
| 156 |
|
| 157 |
<varlistentry> |
| 158 |
<term><varname>SuspendState=</varname></term> |
| 159 |
|
| 160 |
<listitem><para>The string to be written to <filename>/sys/power/state</filename> by <citerefentry> |
| 161 |
<refentrytitle>systemd-suspend.service</refentrytitle><manvolnum>8</manvolnum></citerefentry>. |
| 162 |
More than one value can be specified by separating multiple values with whitespace. They will be |
| 163 |
tried in turn, until one is written without error. If none of the writes succeed, the operation will |
| 164 |
be aborted.</para> |
| 165 |
|
| 166 |
<para>The allowed set of values is determined by the kernel and is shown in the file itself (use |
| 167 |
<command>cat /sys/power/state</command> to display). See <ulink |
| 168 |
url="https://docs.kernel.org/admin-guide/pm/sleep-states.html#basic-sysfs-interfaces-for-system-suspend-and-hibernation"> |
| 169 |
Basic sysfs Interfaces for System Suspend and Hibernation</ulink> for more details.</para> |
| 170 |
|
| 171 |
<para> |
| 172 |
<citerefentry><refentrytitle>systemd-suspend-then-hibernate.service</refentrytitle><manvolnum>8</manvolnum></citerefentry> |
| 173 |
uses this value when suspending.</para> |
| 174 |
|
| 175 |
<xi:include href="version-info.xml" xpointer="v203"/></listitem> |
| 176 |
</varlistentry> |
| 177 |
|
| 178 |
<varlistentry> |
| 179 |
<term><varname>HibernateMode=</varname></term> |
| 180 |
|
| 181 |
<listitem><para>The string to be written to <filename>/sys/power/disk</filename> by <citerefentry> |
| 182 |
<refentrytitle>systemd-hibernate.service</refentrytitle><manvolnum>8</manvolnum></citerefentry>. |
| 183 |
More than one value can be specified by separating multiple values with whitespace. They will be |
| 184 |
tried in turn, until one is written without error. If none of the writes succeed, the operation will |
| 185 |
be aborted.</para> |
| 186 |
|
| 187 |
<para>The allowed set of values is determined by the kernel and is shown in the file itself (use |
| 188 |
<command>cat /sys/power/disk</command> to display). See the kernel documentation page |
| 189 |
<ulink url="https://docs.kernel.org/admin-guide/pm/sleep-states.html#basic-sysfs-interfaces-for-system-suspend-and-hibernation"> |
| 190 |
Basic sysfs Interfaces for System Suspend and Hibernation</ulink> for more details.</para> |
| 191 |
|
| 192 |
<para> |
| 193 |
<citerefentry><refentrytitle>systemd-suspend-then-hibernate.service</refentrytitle><manvolnum>8</manvolnum></citerefentry> |
| 194 |
uses the value of <varname>HibernateMode=</varname> when hibernating.</para> |
| 195 |
|
| 196 |
<xi:include href="version-info.xml" xpointer="v203"/></listitem> |
| 197 |
</varlistentry> |
| 198 |
|
| 199 |
<varlistentry> |
| 200 |
<term><varname>MemorySleepMode=</varname></term> |
| 201 |
|
| 202 |
<listitem><para>The string to be written to <filename>/sys/power/mem_sleep</filename> |
| 203 |
when <option>SuspendState=mem</option> or <command>hybrid-sleep</command> is used. |
| 204 |
More than one value can be specified by separating multiple values with whitespace. They will be |
| 205 |
tried in turn, until one is written without error. If none of the writes succeed, the operation will |
| 206 |
be aborted. Defaults to empty, i.e. the kernel default or kernel command line option |
| 207 |
<varname>mem_sleep_default=</varname> is respected.</para> |
| 208 |
|
| 209 |
<para>The allowed set of values is determined by the kernel and is shown in the file itself (use |
| 210 |
<command>cat /sys/power/mem_sleep</command> to display). See the kernel documentation page |
| 211 |
<ulink url="https://docs.kernel.org/admin-guide/pm/sleep-states.html#basic-sysfs-interfaces-for-system-suspend-and-hibernation"> |
| 212 |
Basic sysfs Interfaces for System Suspend and Hibernation</ulink> for more details.</para> |
| 213 |
|
| 214 |
<xi:include href="version-info.xml" xpointer="v256"/></listitem> |
| 215 |
</varlistentry> |
| 216 |
|
| 217 |
<varlistentry> |
| 218 |
<term><varname>HibernateDelaySec=</varname></term> |
| 219 |
|
| 220 |
<listitem> |
| 221 |
<para>The amount of time the system spends in suspend mode before the system is |
| 222 |
automatically put into hibernate mode. Only used by |
| 223 |
<citerefentry><refentrytitle>systemd-suspend-then-hibernate.service</refentrytitle><manvolnum>8</manvolnum></citerefentry>. |
| 224 |
Refer to <command>suspend-then-hibernate</command> for details on how this option interacts with |
| 225 |
other options/system battery state.</para> |
| 226 |
|
| 227 |
<xi:include href="version-info.xml" xpointer="v239"/> |
| 228 |
</listitem> |
| 229 |
</varlistentry> |
| 230 |
|
| 231 |
<varlistentry> |
| 232 |
<term><varname>HibernateOnACPower=</varname></term> |
| 233 |
|
| 234 |
<listitem> |
| 235 |
<para>Whether to allow hibernation when the system has AC power. Only used by |
| 236 |
<citerefentry><refentrytitle>systemd-suspend-then-hibernate.service</refentrytitle><manvolnum>8</manvolnum></citerefentry> |
| 237 |
when <varname>HibernateDelaySec=</varname> is set.</para> |
| 238 |
|
| 239 |
<para>If this option is disabled, the countdown of <varname>HibernateDelaySec=</varname> starts only |
| 240 |
after AC power is disconnected, keeping the system in the suspend state otherwise.</para> |
| 241 |
|
| 242 |
<para>This option is only effective on systems with a battery.</para> |
| 243 |
|
| 244 |
<xi:include href="version-info.xml" xpointer="v257"/> |
| 245 |
</listitem> |
| 246 |
</varlistentry> |
| 247 |
|
| 248 |
<varlistentry> |
| 249 |
<term><varname>SuspendEstimationSec=</varname></term> |
| 250 |
|
| 251 |
<listitem> |
| 252 |
<para>The RTC alarm will wake the system after the specified timespan to measure the system battery |
| 253 |
capacity level and estimate battery discharging rate. Only used by |
| 254 |
<citerefentry><refentrytitle>systemd-suspend-then-hibernate.service</refentrytitle><manvolnum>8</manvolnum></citerefentry>. |
| 255 |
Refer to <command>suspend-then-hibernate</command> for details on how this option interacts with |
| 256 |
other options/system battery state.</para> |
| 257 |
|
| 258 |
<xi:include href="version-info.xml" xpointer="v253"/></listitem> |
| 259 |
</varlistentry> |
| 260 |
</variablelist> |
| 261 |
</refsect1> |
| 262 |
|
| 263 |
<refsect1> |
| 264 |
<title>Example: freeze</title> |
| 265 |
|
| 266 |
<para>Example: to exploit the <quote>freeze</quote> mode added |
| 267 |
in Linux 3.9, one can use <command>systemctl suspend</command> |
| 268 |
with |
| 269 |
<programlisting>[Sleep] |
| 270 |
SuspendState=freeze</programlisting></para> |
| 271 |
</refsect1> |
| 272 |
|
| 273 |
<refsect1> |
| 274 |
<title>See Also</title> |
| 275 |
<para><simplelist type="inline"> |
| 276 |
<member><citerefentry><refentrytitle>systemd-sleep</refentrytitle><manvolnum>8</manvolnum></citerefentry></member> |
| 277 |
<member><citerefentry><refentrytitle>systemd-suspend.service</refentrytitle><manvolnum>8</manvolnum></citerefentry></member> |
| 278 |
<member><citerefentry><refentrytitle>systemd-hibernate.service</refentrytitle><manvolnum>8</manvolnum></citerefentry></member> |
| 279 |
<member><citerefentry><refentrytitle>systemd-hybrid-sleep.service</refentrytitle><manvolnum>8</manvolnum></citerefentry></member> |
| 280 |
<member><citerefentry><refentrytitle>systemd-suspend-then-hibernate.service</refentrytitle><manvolnum>8</manvolnum></citerefentry></member> |
| 281 |
<member><citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry></member> |
| 282 |
<member><citerefentry><refentrytitle>systemd.directives</refentrytitle><manvolnum>7</manvolnum></citerefentry></member> |
| 283 |
</simplelist></para> |
| 284 |
</refsect1> |
| 285 |
|
| 286 |
</refentry> |