chiark / gitweb /
Suspend on lid close based on power status. (#8016)
[elogind.git] / man / logind.conf.xml
1 <?xml version='1.0'?> <!--*- Mode: nxml; nxml-child-indent: 2; indent-tabs-mode: nil -*-->
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   This file is part of elogind.
9
10   Copyright 2010 Lennart Poettering
11
12   elogind is free software; you can redistribute it and/or modify it
13   under the terms of the GNU Lesser General Public License as published by
14   the Free Software Foundation; either version 2.1 of the License, or
15   (at your option) any later version.
16
17   elogind is distributed in the hope that it will be useful, but
18   WITHOUT ANY WARRANTY; without even the implied warranty of
19   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
20   Lesser General Public License for more details.
21
22   You should have received a copy of the GNU Lesser General Public License
23   along with elogind; If not, see <http://www.gnu.org/licenses/>.
24 -->
25
26 <!-- 0 /// elogind does not have to enable itself in configure
27 <refentry id="logind.conf" conditional='ENABLE_LOGIND'
28     xmlns:xi="http://www.w3.org/2001/XInclude">
29     <productname>systemd</productname>
30 --><!-- else -->
31 <refentry id="logind.conf" xmlns:xi="http://www.w3.org/2001/XInclude">
32 <!-- // 0 -->
33   <refentryinfo>
34     <title>logind.conf</title>
35
36     <authorgroup>
37       <author>
38         <contrib>Developer</contrib>
39         <firstname>Lennart</firstname>
40         <surname>Poettering</surname>
41         <email>lennart@poettering.net</email>
42       </author>
43     </authorgroup>
44   </refentryinfo>
45
46   <refmeta>
47     <refentrytitle>logind.conf</refentrytitle>
48     <manvolnum>5</manvolnum>
49   </refmeta>
50
51   <refnamediv>
52     <refname>logind.conf</refname>
53     <!-- 0 /// not supported by elogind
54     <refname>logind.conf.d</refname>
55     // 0 -->
56     <refpurpose>Login manager configuration files</refpurpose>
57   </refnamediv>
58
59   <refsynopsisdiv>
60     <para><filename>/etc/elogind/logind.conf</filename></para>
61     <!-- 0 /// not supported by elogind
62     <para><filename>/etc/systemd/logind.conf.d/*.conf</filename></para>
63     <para><filename>/run/systemd/logind.conf.d/*.conf</filename></para>
64     <para><filename>/usr/lib/systemd/logind.conf.d/*.conf</filename></para>
65     // 0 -->
66   </refsynopsisdiv>
67
68   <refsect1>
69     <title>Description</title>
70
71     <para>These files configure various parameters of the elogind
72     <!-- 0 /// elogind does not need a service file.
73     login manager,
74     <citerefentry><refentrytitle>elogind.service</refentrytitle><manvolnum>8</manvolnum></citerefentry>.
75     </para>
76     --><!-- else -->
77     login manager.</para>
78     <!-- // 0 -->
79   </refsect1>
80
81   <!-- 0 /// elogind has only this configuration
82   <xi:include href="standard-conf.xml" xpointer="main-conf" />
83   // 0 -->
84
85   <refsect1>
86     <title>Options</title>
87
88     <!-- 0 /// elogind also supports a few system commands
89     <para>All options are configured in the
90     <literal>[Login]</literal> section:</para>
91     --><!-- else -->
92     <para>All login options are configured in the
93     <literal>[Login]</literal> section, system sleep options are
94     configured in the <literal>[Sleep]</literal> section.</para>
95     <!-- // 0 -->
96
97     <!-- 1 /// elogind needs a second level, as we use two sections. -->
98     <refsect2><title>[Login] section:</title>
99     <!-- // 1 -->
100
101     <variablelist>
102       <!-- 0 /// elogind has no support for AutoVT
103
104       <varlistentry>
105         <term><varname>NAutoVTs=</varname></term>
106
107         <listitem><para>Takes a positive integer. Configures how many
108         virtual terminals (VTs) to allocate by default that, when
109         switched to and are previously unused,
110         <literal>autovt</literal> services are automatically spawned
111         on. These services are instantiated from the template unit
112         <filename>autovt@.service</filename> for the respective VT TTY
113         name, for example, <filename>autovt@tty4.service</filename>.
114         By default, <filename>autovt@.service</filename> is linked to
115         <filename>getty@.service</filename>. In other words, login
116         prompts are started dynamically as the user switches to unused
117         virtual terminals. Hence, this parameter controls how many
118         login <literal>gettys</literal> are available on the VTs. If a
119         VT is already used by some other subsystem (for example, a
120         graphical login), this kind of activation will not be
121         attempted. Note that the VT configured in
122         <varname>ReserveVT=</varname> is always subject to this kind
123         of activation, even if it is not one of the VTs configured
124         with the <varname>NAutoVTs=</varname> directive. Defaults to
125         6. When set to 0, automatic spawning of
126         <literal>autovt</literal> services is
127         disabled.</para></listitem>
128       </varlistentry>
129
130       <varlistentry>
131         <term><varname>ReserveVT=</varname></term>
132
133         <listitem><para>Takes a positive integer. Identifies one
134         virtual terminal that shall unconditionally be reserved for
135         <filename>autovt@.service</filename> activation (see above).
136         The VT selected with this option will be marked busy
137         unconditionally, so that no other subsystem will allocate it.
138         This functionality is useful to ensure that, regardless of how
139         many VTs are allocated by other subsystems, one login
140         <literal>getty</literal> is always available. Defaults to 6
141         (in other words, there will always be a
142         <literal>getty</literal> available on Alt-F6.). When set to 0,
143         VT reservation is disabled.</para></listitem>
144       </varlistentry>
145       // 0 -->
146
147       <varlistentry>
148         <term><varname>KillUserProcesses=</varname></term>
149
150         <listitem><para>Takes a boolean argument. Configures whether the processes of a
151         <!-- 0 /// elogind has no scope unit, and goes for cgroups only
152         user should be killed when the user logs out. If true, the scope unit
153         corresponding to the session and all processes inside that scope will be
154         terminated. If false, the scope is "abandoned", see
155         <citerefentry><refentrytitle>systemd.scope</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
156         --><!-- else -->
157         user should be killed when the user logs out. If true, the processes
158         listed in their session cgroup will be terminated. If false, the session cgroup
159         is ignored
160         <!-- // 0 -->
161         and processes are not killed. Defaults to <literal>yes</literal>,
162         but see the options <varname>KillOnlyUsers=</varname> and
163         <varname>KillExcludeUsers=</varname> below.</para>
164
165         <!-- 0 /// elogind has no user manager unit, and lingering isn't clarified, yet.
166         <para>In addition to session processes, user process may run under the user
167         manager unit <filename>user@.service</filename>. Depending on the linger
168         settings, this may allow users to run processes independent of their login
169         sessions. See the description of <command>enable-linger</command> in
170         <citerefentry><refentrytitle>loginctl</refentrytitle><manvolnum>1</manvolnum></citerefentry>.
171         </para>
172         // 0 -->
173
174         <para>Note that setting <varname>KillUserProcesses=yes</varname>
175         will break tools like
176         <citerefentry project='die-net'><refentrytitle>screen</refentrytitle><manvolnum>1</manvolnum></citerefentry>
177         and
178         <citerefentry project='die-net'><refentrytitle>tmux</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
179         <!-- 0 /// elogind does not provide systemd-run or any equivalent, yet.
180         unless they are moved out of the session scope. See example in
181         <citerefentry><refentrytitle>systemd-run</refentrytitle><manvolnum>1</manvolnum></citerefentry>.
182         --><!-- else -->
183         unless they are moved out of the session scope.
184         <!-- // 0 -->
185         </para></listitem>
186       </varlistentry>
187
188       <varlistentry>
189         <term><varname>KillOnlyUsers=</varname></term>
190         <term><varname>KillExcludeUsers=</varname></term>
191
192         <listitem><para>These settings take space-separated lists of usernames that override
193         the <varname>KillUserProcesses=</varname> setting. A user name may be added to
194         <varname>KillExcludeUsers=</varname> to exclude the processes in the session scopes of
195         that user from being killed even if <varname>KillUserProcesses=yes</varname> is set. If
196         <varname>KillExcludeUsers=</varname> is not set, the <literal>root</literal> user is
197         excluded by default. <varname>KillExcludeUsers=</varname> may be set to an empty value
198         to override this default. If a user is not excluded, <varname>KillOnlyUsers=</varname>
199         is checked next. If this setting is specified, only the session scopes of those users
200         will be killed. Otherwise, users are subject to the
201         <varname>KillUserProcesses=yes</varname> setting.</para></listitem>
202       </varlistentry>
203
204       <varlistentry>
205         <term><varname>IdleAction=</varname></term>
206
207         <listitem><para>Configures the action to take when the system
208         is idle. Takes one of
209         <literal>ignore</literal>,
210         <literal>poweroff</literal>,
211         <literal>reboot</literal>,
212         <literal>halt</literal>,
213         <literal>kexec</literal>,
214         <literal>suspend</literal>,
215         <literal>hibernate</literal>,
216         <literal>hybrid-sleep</literal>, and
217         <literal>lock</literal>.
218         Defaults to <literal>ignore</literal>.</para>
219
220         <para>Note that this requires that user sessions correctly
221         report the idle status to the system. The system will execute
222         the action after all sessions report that they are idle, no
223         idle inhibitor lock is active, and subsequently, the time
224         configured with <varname>IdleActionSec=</varname> (see below)
225         has expired.</para>
226         </listitem>
227       </varlistentry>
228
229       <varlistentry>
230         <term><varname>IdleActionSec=</varname></term>
231
232         <listitem><para>Configures the delay after which the action
233         configured in <varname>IdleAction=</varname> (see above) is
234         taken after the system is idle.</para></listitem>
235       </varlistentry>
236
237       <varlistentry>
238         <term><varname>InhibitDelayMaxSec=</varname></term>
239
240         <listitem><para>Specifies the maximum time a system shutdown
241         or sleep request is delayed due to an inhibitor lock of type
242         <literal>delay</literal> being active before the inhibitor is
243         ignored and the operation executes anyway. Defaults to
244         5.</para></listitem>
245       </varlistentry>
246
247       <varlistentry>
248         <term><varname>HandlePowerKey=</varname></term>
249         <term><varname>HandleSuspendKey=</varname></term>
250         <term><varname>HandleHibernateKey=</varname></term>
251         <term><varname>HandleLidSwitch=</varname></term>
252         <term><varname>HandleLidSwitchExternalPower=</varname></term>
253         <term><varname>HandleLidSwitchDocked=</varname></term>
254
255         <listitem><para>Controls how logind shall handle the
256         system power and sleep keys and the lid switch to trigger
257         actions such as system power-off or suspend. Can be one of
258         <literal>ignore</literal>,
259         <literal>poweroff</literal>,
260         <literal>reboot</literal>,
261         <literal>halt</literal>,
262         <literal>kexec</literal>,
263         <literal>suspend</literal>,
264         <literal>hibernate</literal>,
265         <literal>hybrid-sleep</literal>, and
266         <literal>lock</literal>.
267         If <literal>ignore</literal>, logind will never handle these
268         keys. If <literal>lock</literal>, all running sessions will be
269         screen-locked; otherwise, the specified action will be taken
270         in the respective event. Only input devices with the
271         <literal>power-switch</literal> udev tag will be watched for
272         key/lid switch events. <varname>HandlePowerKey=</varname>
273         defaults to <literal>poweroff</literal>.
274         <varname>HandleSuspendKey=</varname> and
275         <varname>HandleLidSwitch=</varname> default to
276         <literal>suspend</literal>.
277         <varname>HandleLidSwitchExternalPower=</varname> is completely
278         ignored by default (for backwards compatibility) &#x2014; an explicit
279         value must be set before it will be used to determine
280         behaviour.  <varname>HandleLidSwitchDocked=</varname> defaults
281         to <literal>ignore</literal>.
282         <varname>HandleHibernateKey=</varname> defaults to
283         <literal>hibernate</literal>. If the system is inserted in a
284         docking station, or if more than one display is connected, the
285         action specified by <varname>HandleLidSwitchDocked=</varname>
286         occurs; if the system is on external power the action (if any)
287         specified by <varname>HandleLidSwitchExternalPower=</varname>
288         occurs; otherwise the <varname>HandleLidSwitch=</varname>
289         action occurs.</para>
290
291         <para>A different application may disable logind's handling of system power and
292         sleep keys and the lid switch by taking a low-level inhibitor lock
293         (<literal>handle-power-key</literal>, <literal>handle-suspend-key</literal>,
294         <literal>handle-hibernate-key</literal>, <literal>handle-lid-switch</literal>).
295         This is most commonly used by graphical desktop environments
296         to take over suspend and hibernation handling, and to use their own configuration
297         mechanisms. If a low-level inhibitor lock is taken, logind will not take any
298         action when that key or switch is triggered and the <varname>Handle*=</varname>
299         settings are irrelevant.</para></listitem>
300       </varlistentry>
301
302       <varlistentry>
303         <term><varname>PowerKeyIgnoreInhibited=</varname></term>
304         <term><varname>SuspendKeyIgnoreInhibited=</varname></term>
305         <term><varname>HibernateKeyIgnoreInhibited=</varname></term>
306         <term><varname>LidSwitchIgnoreInhibited=</varname></term>
307
308         <listitem><para>Controls whether actions that <command>systemd-logind</command>
309         takes when the power and sleep keys and the lid switch are triggered are subject
310         to high-level inhibitor locks ("shutdown", "sleep", "idle"). Low level inhibitor
311         locks (<literal>handle-power-key</literal>, <literal>handle-suspend-key</literal>,
312         <literal>handle-hibernate-key</literal>, <literal>handle-lid-switch</literal>),
313         are always honored, irrespective of this setting.</para>
314
315         <para>These settings take boolean arguments. If <literal>no</literal>, the
316         inhibitor locks taken by applications are respected. If <literal>yes</literal>,
317         "shutdown", "sleep", and "idle" inhibitor locks are ignored.
318         <varname>PowerKeyIgnoreInhibited=</varname>,
319         <varname>SuspendKeyIgnoreInhibited=</varname>, and
320         <varname>HibernateKeyIgnoreInhibited=</varname> default to <literal>no</literal>.
321         <varname>LidSwitchIgnoreInhibited=</varname> defaults to <literal>yes</literal>.
322         This means that when <command>systemd-logind</command> is handling events by
323         itself (no low level inhibitor locks are taken by another application), the lid
324         switch does not respect suspend blockers by default, but the power and sleep keys
325         do.</para></listitem>
326       </varlistentry>
327
328       <varlistentry>
329         <term><varname>HoldoffTimeoutSec=</varname></term>
330
331         <listitem><para>Specifies the timeout after system startup or
332         system resume in which systemd will hold off on reacting to
333         lid events. This is required for the system to properly
334         detect any hotplugged devices so systemd can ignore lid events
335         if external monitors, or docks, are connected. If set to 0,
336         systemd will always react immediately, possibly before the
337         kernel fully probed all hotplugged devices. This is safe, as
338         long as you do not care for systemd to account for devices
339         that have been plugged or unplugged while the system was off.
340         Defaults to 30s.</para></listitem>
341       </varlistentry>
342
343       <varlistentry>
344         <term><varname>RuntimeDirectorySize=</varname></term>
345
346         <listitem><para>Sets the size limit on the
347         <varname>$XDG_RUNTIME_DIR</varname> runtime directory for each
348         user who logs in. Takes a size in bytes, optionally suffixed
349         with the usual K, G, M, and T suffixes, to the base 1024
350         (IEC). Alternatively, a numerical percentage suffixed by
351         <literal>%</literal> may be specified, which sets the size
352         limit relative to the amount of physical RAM. Defaults to 10%.
353         Note that this size is a safety limit only. As each runtime
354         directory is a tmpfs file system, it will only consume as much
355         memory as is needed.</para></listitem>
356       </varlistentry>
357
358       <varlistentry>
359         <term><varname>InhibitorsMax=</varname></term>
360
361         <listitem><para>Controls the maximum number of concurrent inhibitors to permit. Defaults to 8192
362         (8K).</para></listitem>
363       </varlistentry>
364
365       <varlistentry>
366         <term><varname>SessionsMax=</varname></term>
367
368         <listitem><para>Controls the maximum number of concurrent user sessions to manage. Defaults to 8192
369         (8K). Depending on how the <filename>pam_systemd.so</filename> module is included in the PAM stack
370         configuration, further login sessions will either be refused, or permitted but not tracked by
371         <filename>systemd-logind</filename>.</para></listitem>
372       </varlistentry>
373
374       <varlistentry>
375         <term><varname>UserTasksMax=</varname></term>
376
377         <listitem><para>Sets the maximum number of OS tasks each user may run concurrently. This controls the
378         <varname>TasksMax=</varname> setting of the per-user slice unit, see
379         <citerefentry><refentrytitle>systemd.resource-control</refentrytitle><manvolnum>5</manvolnum></citerefentry>
380         for details. If assigned the special value <literal>infinity</literal>, no tasks limit is applied.
381         Defaults to 33%, which equals 10813 with the kernel's defaults on the host, but might be smaller in
382         OS containers.</para></listitem>
383       </varlistentry>
384
385       <varlistentry>
386         <term><varname>RemoveIPC=</varname></term>
387
388         <listitem><para>Controls whether System V and POSIX IPC objects belonging to the user shall be removed when the
389         user fully logs out. Takes a boolean argument. If enabled, the user may not consume IPC resources after the
390         last of the user's sessions terminated. This covers System V semaphores, shared memory and message queues, as
391         well as POSIX shared memory and message queues. Note that IPC objects of the root user and other system users
392         are excluded from the effect of this setting. Defaults to <literal>yes</literal>.</para></listitem>
393       </varlistentry>
394
395     </variablelist>
396     <!-- 1 /// elogind has an additional section for system commands. -->
397     </refsect2>
398
399     <refsect2><title>[Sleep] section:</title>
400       <para><command>elogind</command> supports three general
401       power-saving modes:</para>
402
403       <variablelist>
404         <varlistentry>
405           <term>suspend</term>
406
407           <listitem><para>a low-power state
408           where execution of the OS is paused,
409           and complete power loss might result
410           in lost data, and which is fast to
411           enter and exit. This corresponds to
412           suspend, standby, or freeze states as
413           understood by the kernel.
414           </para></listitem>
415         </varlistentry>
416
417         <varlistentry>
418           <term>hibernate</term>
419
420           <listitem><para>a low-power state
421           where execution of the OS is paused,
422           and complete power loss does not
423           result in lost data, and which might
424           be slow to enter and exit. This
425           corresponds to the hibernation as
426           understood by the kernel.
427           </para></listitem>
428         </varlistentry>
429
430         <varlistentry>
431           <term>hybrid-sleep</term>
432
433           <listitem><para>a low-power state
434           where execution of the OS is paused,
435           which might be slow to enter, and on
436           complete power loss does not result in
437           lost data but might be slower to exit
438           in that case. This mode is called
439           suspend-to-both by the kernel.
440           </para></listitem>
441         </varlistentry>
442
443         <varlistentry>
444           <term><varname>SuspendMode=</varname></term>
445           <term><varname>HibernateMode=</varname></term>
446           <term><varname>HybridSleepMode=</varname></term>
447
448           <listitem><para>The string to be written to
449           <filename>/sys/power/disk</filename> by elogind.
450           More than one value can be specified by separating
451           multiple values with whitespace. They will be tried
452           in turn, until one is written without error. If
453           neither succeeds, the operation will be aborted.
454           </para></listitem>
455         </varlistentry>
456
457         <varlistentry>
458           <term><varname>SuspendState=</varname></term>
459           <term><varname>HibernateState=</varname></term>
460           <term><varname>HybridSleepState=</varname></term>
461
462           <listitem><para>The string to be written to
463           <filename>/sys/power/state</filename> by elogind.
464           More than one value can be specified by separating
465           multiple values with whitespace. They will be tried
466           in turn, until one is written without error. If
467           neither succeeds, the operation will be aborted.
468           </para></listitem>
469         </varlistentry>
470
471       </variablelist>
472     </refsect2>
473     <!-- // 1 -->
474   </refsect1>
475
476   <refsect1>
477       <title>See Also</title>
478       <para>
479         <!-- 0 /// elogind is in section 8
480         <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
481         <citerefentry><refentrytitle>systemd-logind.service</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
482         --><!-- else -->
483         <citerefentry><refentrytitle>elogind</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
484         <!-- // 0 -->
485         <citerefentry><refentrytitle>loginctl</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
486         <!-- 0 /// UNNEEDED by elogind
487         <citerefentry><refentrytitle>systemd-system.conf</refentrytitle><manvolnum>5</manvolnum></citerefentry>
488         // 0 -->
489       </para>
490   </refsect1>
491
492 </refentry>