Debian Codegraph @

upstream/debian-unstable/man1/systemd-inhibit.1

raw
1 '\" t
2 .TH "SYSTEMD\-INHIBIT" "1" "" "systemd 261~rc3" "systemd-inhibit"
3 .\" -----------------------------------------------------------------
4 .\" * Define some portability stuff
5 .\" -----------------------------------------------------------------
6 .\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
7 .\" http://bugs.debian.org/507673
8 .\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html
9 .\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
10 .ie \n(.g .ds Aq \(aq
11 .el .ds Aq '
12 .\" -----------------------------------------------------------------
13 .\" * set default formatting
14 .\" -----------------------------------------------------------------
15 .\" disable hyphenation
16 .nh
17 .\" disable justification (adjust text to left margin only)
18 .ad l
19 .\" -----------------------------------------------------------------
20 .\" * MAIN CONTENT STARTS HERE *
21 .\" -----------------------------------------------------------------
22 .SH "NAME"
23 systemd-inhibit \- Execute a program with an inhibition lock taken
24 .SH "SYNOPSIS"
25 .HP \w'\fBsystemd\-inhibit\fR\ 'u
26 \fBsystemd\-inhibit\fR [OPTIONS...] [COMMAND] [ARGUMENTS...]
27 .HP \w'\fBsystemd\-inhibit\fR\ 'u
28 \fBsystemd\-inhibit\fR [OPTIONS...] [\-\-list]
29 .SH "DESCRIPTION"
30 .PP
31 \fBsystemd\-inhibit\fR
32 may be used to execute a program with a shutdown, sleep, or idle inhibitor lock taken\&. The lock will be acquired before the specified command line is executed and released afterwards\&.
33 .PP
34 Inhibitor locks may be used to block or delay system sleep and shutdown requests from the user, as well as automatic idle handling of the OS\&. This is useful to avoid system suspends while an optical disc is being recorded, or similar operations that should not be interrupted\&.
35 .PP
36 For more information see
37 \m[blue]\fBInhibitor Locks\fR\m[]\&\s-2\u[1]\d\s+2\&.
38 .SH "OPTIONS"
39 .PP
40 The following options are understood:
41 .PP
42 \fB\-\-what=\fR
43 .RS 4
44 Takes a colon\-separated list of one or more operations to inhibit:
45 "shutdown",
46 "sleep",
47 "idle",
48 "handle\-power\-key",
49 "handle\-reboot\-key",
50 "handle\-suspend\-key",
51 "handle\-hibernate\-key",
52 "handle\-lid\-switch", for inhibiting reboot/power\-off/halt/kexec/soft\-reboot, suspending/hibernating, the automatic idle detection, or the low\-level handling of the power/reboot/sleep key and the lid switch, respectively\&. If omitted, defaults to
53 "idle:sleep:shutdown"\&.
54 .RE
55 .PP
56 \fB\-\-who=\fR
57 .RS 4
58 Takes a short, human\-readable descriptive string for the program taking the lock\&. If not passed, defaults to the command line string\&.
59 .RE
60 .PP
61 \fB\-\-why=\fR
62 .RS 4
63 Takes a short, human\-readable descriptive string for the reason for taking the lock\&. Defaults to "Unknown reason"\&.
64 .RE
65 .PP
66 \fB\-\-mode=\fR
67 .RS 4
68 Takes
69 "block",
70 "delay", or
71 "block\-weak"
72 and describes how the lock is applied\&. If
73 "block"
74 is used (the default), the lock prohibits any of the requested operations without time limit, and only privileged users may override it\&. The
75 "block\-weak"
76 inhibitor lock type is similar to
77 "block"
78 but is not enforced against operations initiated by privileged clients or those owned by the user that also owns the inhibitor lock\&. If
79 "delay"
80 is used, the lock can only delay the requested operations for a limited time\&. If the time elapses, the lock is ignored and the operation executed\&. The time limit may be specified in
81 \fBlogind.conf\fR(5)\&. Note that
82 "delay"
83 is only available for
84 "sleep"
85 and
86 "shutdown"\&.
87 .RE
88 .PP
89 \fB\-\-list\fR
90 .RS 4
91 Lists all active inhibition locks instead of acquiring one\&. It can be filtered using
92 \fB\-\-what=\fR,
93 \fB\-\-who=\fR,
94 \fB\-\-why=\fR, or
95 \fB\-\-mode=\fR\&.
96 .RE
97 .PP
98 \fB\-\-no\-ask\-password\fR
99 .RS 4
100 Do not query the user for authentication for privileged operations\&.
101 .RE
102 .PP
103 \fB\-\-no\-pager\fR
104 .RS 4
105 Do not pipe output into a pager\&.
106 .RE
107 .PP
108 \fB\-\-no\-legend\fR
109 .RS 4
110 Do not print the legend, i\&.e\&. column headers and the footer with hints\&.
111 .RE
112 .PP
113 \fB\-\-json=\fR\fB\fIMODE\fR\fR
114 .RS 4
115 Shows output formatted as JSON\&. Expects one of
116 "short"
117 (for the shortest possible output without any redundant whitespace or line breaks),
118 "pretty"
119 (for a pretty version of the same, with indentation and line breaks) or
120 "off"
121 (to turn off JSON output, the default)\&.
122 .RE
123 .PP
124 \fB\-h\fR, \fB\-\-help\fR
125 .RS 4
126 Print a short help text and exit\&.
127 .RE
128 .PP
129 \fB\-\-version\fR
130 .RS 4
131 Print a short version string and exit\&.
132 .RE
133 .SH "EXIT STATUS"
134 .PP
135 Returns the exit status of the executed program\&.
136 .SH "EXAMPLE"
137 .sp
138 .if n \{\
139 .RS 4
140 .\}
141 .nf
142 # systemd\-inhibit wodim foobar\&.iso
143 .fi
144 .if n \{\
145 .RE
146 .\}
147 .PP
148 This burns the ISO image
149 foobar\&.iso
150 on a CD using
151 \fBwodim\fR(1), and inhibits system sleeping, shutdown and idle while doing so\&.
152 .SH "ENVIRONMENT"
153 .PP
154 \fI$SYSTEMD_LOG_LEVEL\fR
155 .RS 4
156 The maximum log level of emitted messages (messages with a higher log level, i\&.e\&. less important ones, will be suppressed)\&. Takes a comma\-separated list of values\&. A value may be either one of (in order of decreasing importance)
157 \fBemerg\fR,
158 \fBalert\fR,
159 \fBcrit\fR,
160 \fBerr\fR,
161 \fBwarning\fR,
162 \fBnotice\fR,
163 \fBinfo\fR,
164 \fBdebug\fR, or an integer in the range 0\&...7\&. See
165 \fBsyslog\fR(3)
166 for more information\&. Each value may optionally be prefixed with one of
167 \fBconsole\fR,
168 \fBsyslog\fR,
169 \fBkmsg\fR
170 or
171 \fBjournal\fR
172 followed by a colon to set the maximum log level for that specific log target (e\&.g\&.
173 \fBSYSTEMD_LOG_LEVEL=debug,console:info\fR
174 specifies to log at debug level except when logging to the console which should be at info level)\&. Note that the global maximum log level takes priority over any per target maximum log levels\&.
175 .RE
176 .PP
177 \fI$SYSTEMD_LOG_COLOR\fR
178 .RS 4
179 A boolean\&. If true, messages written to the tty will be colored according to priority\&.
180 .sp
181 This setting is only useful when messages are written directly to the terminal, because
182 \fBjournalctl\fR(1)
183 and other tools that display logs will color messages based on the log level on their own\&.
184 .RE
185 .PP
186 \fI$SYSTEMD_LOG_TIME\fR
187 .RS 4
188 A boolean\&. If true, console log messages will be prefixed with a timestamp\&.
189 .sp
190 This setting is only useful when messages are written directly to the terminal or a file, because
191 \fBjournalctl\fR(1)
192 and other tools that display logs will attach timestamps based on the entry metadata on their own\&.
193 .RE
194 .PP
195 \fI$SYSTEMD_LOG_LOCATION\fR
196 .RS 4
197 A boolean\&. If true, messages will be prefixed with a filename and line number in the source code where the message originates\&.
198 .sp
199 Note that the log location is often attached as metadata to journal entries anyway\&. Including it directly in the message text can nevertheless be convenient when debugging programs\&.
200 .RE
201 .PP
202 \fI$SYSTEMD_LOG_TID\fR
203 .RS 4
204 A boolean\&. If true, messages will be prefixed with the current numerical thread ID (TID)\&.
205 .sp
206 Note that the this information is attached as metadata to journal entries anyway\&. Including it directly in the message text can nevertheless be convenient when debugging programs\&.
207 .RE
208 .PP
209 \fI$SYSTEMD_LOG_TARGET\fR
210 .RS 4
211 The destination for log messages\&. One of
212 \fBconsole\fR
213 (log to the attached tty),
214 \fBconsole\-prefixed\fR
215 (log to the attached tty but with prefixes encoding the log level and "facility", see
216 \fBsyslog\fR(3),
217 \fBkmsg\fR
218 (log to the kernel circular log buffer),
219 \fBjournal\fR
220 (log to the journal),
221 \fBjournal\-or\-kmsg\fR
222 (log to the journal if available, and to kmsg otherwise),
223 \fBauto\fR
224 (determine the appropriate log target automatically, the default),
225 \fBnull\fR
226 (disable log output)\&.
227 .RE
228 .PP
229 \fI$SYSTEMD_LOG_RATELIMIT_KMSG\fR
230 .RS 4
231 Whether to ratelimit kmsg or not\&. Takes a boolean\&. Defaults to
232 "true"\&. If disabled, systemd will not ratelimit messages written to kmsg\&.
233 .RE
234 .PP
235 \fI$SYSTEMD_PAGER\fR, \fI$PAGER\fR
236 .RS 4
237 Pager to use when
238 \fB\-\-no\-pager\fR
239 is not given\&.
240 \fI$SYSTEMD_PAGER\fR
241 is used if set; otherwise
242 \fI$PAGER\fR
243 is used\&. If neither
244 \fI$SYSTEMD_PAGER\fR
245 nor
246 \fI$PAGER\fR
247 are set, a set of well\-known pager implementations is tried in turn, including
248 \fBless\fR(1)
249 and
250 \fBmore\fR(1), until one is found\&. If no pager implementation is discovered, no pager is invoked\&. Setting those environment variables to an empty string or the value
251 "cat"
252 is equivalent to passing
253 \fB\-\-no\-pager\fR\&.
254 .sp
255 Note: if
256 \fI$SYSTEMD_PAGERSECURE\fR
257 is not set,
258 \fI$SYSTEMD_PAGER\fR
259 and
260 \fI$PAGER\fR
261 can only be used to disable the pager (with
262 "cat"
263 or
264 ""), and are otherwise ignored\&.
265 .RE
266 .PP
267 \fI$SYSTEMD_LESS\fR
268 .RS 4
269 Override the options passed to
270 \fBless\fR
271 (by default
272 "FRSXMK")\&.
273 .sp
274 Users might want to change two options in particular:
275 .PP
276 \fBK\fR
277 .RS 4
278 This option instructs the pager to exit immediately when
279 Ctrl+C
280 is pressed\&. To allow
281 \fBless\fR
282 to handle
283 Ctrl+C
284 itself to switch back to the pager command prompt, unset this option\&.
285 .sp
286 If the value of
287 \fI$SYSTEMD_LESS\fR
288 does not include
289 "K", and the pager that is invoked is
290 \fBless\fR,
291 Ctrl+C
292 will be ignored by the executable, and needs to be handled by the pager\&.
293 .RE
294 .PP
295 \fBX\fR
296 .RS 4
297 This option instructs the pager to not send termcap initialization and deinitialization strings to the terminal\&. It is set by default to allow command output to remain visible in the terminal even after the pager exits\&. Nevertheless, this prevents some pager functionality from working, in particular paged output cannot be scrolled with the mouse\&.
298 .RE
299 .sp
300 Note that setting the regular
301 \fI$LESS\fR
302 environment variable has no effect for
303 \fBless\fR
304 invocations by systemd tools\&.
305 .sp
306 See
307 \fBless\fR(1)
308 for more discussion\&.
309 .RE
310 .PP
311 \fI$SYSTEMD_LESSCHARSET\fR
312 .RS 4
313 Override the charset passed to
314 \fBless\fR
315 (by default
316 "utf\-8", if the invoking terminal is determined to be UTF\-8 compatible)\&.
317 .sp
318 Note that setting the regular
319 \fI$LESSCHARSET\fR
320 environment variable has no effect for
321 \fBless\fR
322 invocations by systemd tools\&.
323 .RE
324 .PP
325 \fI$SYSTEMD_PAGERSECURE\fR
326 .RS 4
327 Common pager commands like
328 \fBless\fR(1), in addition to "paging", i\&.e\&. scrolling through the output, support opening of or writing to other files and running arbitrary shell commands\&. When commands are invoked with elevated privileges, for example under
329 \fBsudo\fR(8)
330 or
331 \fBpkexec\fR(1), the pager becomes a security boundary\&. Care must be taken that only programs with strictly limited functionality are used as pagers, and unintended interactive features like opening or creation of new files or starting of subprocesses are not allowed\&. "Secure mode" for the pager may be enabled as described below,
332 \fIif the pager supports that\fR
333 (most pagers are not written in a way that takes this into consideration)\&. It is recommended to either explicitly enable "secure mode" or to completely disable the pager using
334 \fB\-\-no\-pager\fR
335 or
336 \fIPAGER=cat\fR
337 when allowing untrusted users to execute commands with elevated privileges\&.
338 .sp
339 This option takes a boolean argument\&. When set to true, the "secure mode" of the pager is enabled\&. In "secure mode",
340 \fBLESSSECURE=1\fR
341 will be set when invoking the pager, which instructs the pager to disable commands that open or create new files or start new subprocesses\&. Currently only
342 \fBless\fR(1)
343 is known to understand this variable and implement "secure mode"\&.
344 .sp
345 When set to false, no limitation is placed on the pager\&. Setting
346 \fISYSTEMD_PAGERSECURE=0\fR
347 or not removing it from the inherited environment may allow the user to invoke arbitrary commands\&.
348 .sp
349 When
350 \fI$SYSTEMD_PAGERSECURE\fR
351 is not set, systemd tools attempt to automatically figure out if "secure mode" should be enabled and whether the pager supports it\&. "Secure mode" is enabled if the effective UID is not the same as the owner of the login session, see
352 \fBgeteuid\fR(2)
353 and
354 \fBsd_pid_get_owner_uid\fR(3), or when running under
355 \fBsudo\fR(8)
356 or similar tools (\fI$SUDO_UID\fR
357 is set
358 \&\s-2\u[2]\d\s+2)\&. In those cases,
359 \fISYSTEMD_PAGERSECURE=1\fR
360 will be set and pagers which are not known to implement "secure mode" will not be used at all\&. Note that this autodetection only covers the most common mechanisms to elevate privileges and is intended as convenience\&. It is recommended to explicitly set
361 \fI$SYSTEMD_PAGERSECURE\fR
362 or disable the pager\&.
363 .sp
364 Note that if the
365 \fI$SYSTEMD_PAGER\fR
366 or
367 \fI$PAGER\fR
368 variables are to be honoured, other than to disable the pager,
369 \fI$SYSTEMD_PAGERSECURE\fR
370 must be set too\&.
371 .RE
372 .PP
373 \fI$SYSTEMD_COLORS\fR
374 .RS 4
375 Takes a boolean argument, or a special value\&. By default (unset),
376 \fBsystemd\fR
377 and related utilities will use colors in their output if possible\&. If
378 \fI$COLORTERM\fR
379 is set to
380 "truecolor"
381 or
382 "24bit", 24\-bit colors will be enabled, 256 colors otherwise, unless
383 \fI$NO_COLOR\fR
384 or
385 \fI$TERM\fR
386 indicates colors are disabled\&.
387 .PP
388 \fBtrue\fR
389 .RS 4
390 Same as unset, except that
391 \fI$NO_COLOR\fR
392 is ignored\&.
393 .RE
394 .PP
395 \fBfalse\fR
396 .RS 4
397 The output will be monochrome\&.
398 .RE
399 .PP
400 "16", "256", "24bit"
401 .RS 4
402 Always use the base 16 ANSI colors, 256 colors, or 24 bit color, respectively\&.
403 .RE
404 .PP
405 "auto\-16", "auto\-256", "auto\-24bit"
406 .RS 4
407 Use the given quantity of colours, subject to
408 \fI$TERM\fR, and what the console is connected to\&.
409 .RE
410 .RE
411 .PP
412 \fI$SYSTEMD_URLIFY\fR
413 .RS 4
414 The value must be a boolean\&. Controls whether clickable links should be generated in the output for terminal emulators supporting this\&. This can be specified to override the decision that
415 \fBsystemd\fR
416 makes based on
417 \fI$TERM\fR
418 and other conditions\&.
419 .RE
420 .SH "SEE ALSO"
421 .PP
422 \fBsystemd\fR(1), \fBlogind.conf\fR(5)
423 .SH "NOTES"
424 .IP " 1." 4
425 Inhibitor Locks
426 .RS 4
427 \%https://systemd.io/INHIBITOR_LOCKS
428 .RE
429 .IP " 2." 4
430 It is recommended for other tools to set and check
431 \fI$SUDO_UID\fR
432 as appropriate, treating it is a common interface.
433