Debian Codegraph @

upstream/mageia-cauldron/man1/systemd-inhibit.1

raw
1 '\" t
2 .TH "SYSTEMD\-INHIBIT" "1" "" "systemd 258.7" "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\&.
92 .RE
93 .PP
94 \fB\-\-no\-ask\-password\fR
95 .RS 4
96 Do not query the user for authentication for privileged operations\&.
97 .RE
98 .PP
99 \fB\-\-no\-pager\fR
100 .RS 4
101 Do not pipe output into a pager\&.
102 .RE
103 .PP
104 \fB\-\-no\-legend\fR
105 .RS 4
106 Do not print the legend, i\&.e\&. column headers and the footer with hints\&.
107 .RE
108 .PP
109 \fB\-h\fR, \fB\-\-help\fR
110 .RS 4
111 Print a short help text and exit\&.
112 .RE
113 .PP
114 \fB\-\-version\fR
115 .RS 4
116 Print a short version string and exit\&.
117 .RE
118 .SH "EXIT STATUS"
119 .PP
120 Returns the exit status of the executed program\&.
121 .SH "EXAMPLE"
122 .sp
123 .if n \{\
124 .RS 4
125 .\}
126 .nf
127 # systemd\-inhibit wodim foobar\&.iso
128 .fi
129 .if n \{\
130 .RE
131 .\}
132 .PP
133 This burns the ISO image
134 foobar\&.iso
135 on a CD using
136 \fBwodim\fR(1), and inhibits system sleeping, shutdown and idle while doing so\&.
137 .SH "ENVIRONMENT"
138 .PP
139 \fI$SYSTEMD_LOG_LEVEL\fR
140 .RS 4
141 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)
142 \fBemerg\fR,
143 \fBalert\fR,
144 \fBcrit\fR,
145 \fBerr\fR,
146 \fBwarning\fR,
147 \fBnotice\fR,
148 \fBinfo\fR,
149 \fBdebug\fR, or an integer in the range 0\&...7\&. See
150 \fBsyslog\fR(3)
151 for more information\&. Each value may optionally be prefixed with one of
152 \fBconsole\fR,
153 \fBsyslog\fR,
154 \fBkmsg\fR
155 or
156 \fBjournal\fR
157 followed by a colon to set the maximum log level for that specific log target (e\&.g\&.
158 \fBSYSTEMD_LOG_LEVEL=debug,console:info\fR
159 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\&.
160 .RE
161 .PP
162 \fI$SYSTEMD_LOG_COLOR\fR
163 .RS 4
164 A boolean\&. If true, messages written to the tty will be colored according to priority\&.
165 .sp
166 This setting is only useful when messages are written directly to the terminal, because
167 \fBjournalctl\fR(1)
168 and other tools that display logs will color messages based on the log level on their own\&.
169 .RE
170 .PP
171 \fI$SYSTEMD_LOG_TIME\fR
172 .RS 4
173 A boolean\&. If true, console log messages will be prefixed with a timestamp\&.
174 .sp
175 This setting is only useful when messages are written directly to the terminal or a file, because
176 \fBjournalctl\fR(1)
177 and other tools that display logs will attach timestamps based on the entry metadata on their own\&.
178 .RE
179 .PP
180 \fI$SYSTEMD_LOG_LOCATION\fR
181 .RS 4
182 A boolean\&. If true, messages will be prefixed with a filename and line number in the source code where the message originates\&.
183 .sp
184 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\&.
185 .RE
186 .PP
187 \fI$SYSTEMD_LOG_TID\fR
188 .RS 4
189 A boolean\&. If true, messages will be prefixed with the current numerical thread ID (TID)\&.
190 .sp
191 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\&.
192 .RE
193 .PP
194 \fI$SYSTEMD_LOG_TARGET\fR
195 .RS 4
196 The destination for log messages\&. One of
197 \fBconsole\fR
198 (log to the attached tty),
199 \fBconsole\-prefixed\fR
200 (log to the attached tty but with prefixes encoding the log level and "facility", see
201 \fBsyslog\fR(3),
202 \fBkmsg\fR
203 (log to the kernel circular log buffer),
204 \fBjournal\fR
205 (log to the journal),
206 \fBjournal\-or\-kmsg\fR
207 (log to the journal if available, and to kmsg otherwise),
208 \fBauto\fR
209 (determine the appropriate log target automatically, the default),
210 \fBnull\fR
211 (disable log output)\&.
212 .RE
213 .PP
214 \fI$SYSTEMD_LOG_RATELIMIT_KMSG\fR
215 .RS 4
216 Whether to ratelimit kmsg or not\&. Takes a boolean\&. Defaults to
217 "true"\&. If disabled, systemd will not ratelimit messages written to kmsg\&.
218 .RE
219 .PP
220 \fI$SYSTEMD_PAGER\fR, \fI$PAGER\fR
221 .RS 4
222 Pager to use when
223 \fB\-\-no\-pager\fR
224 is not given\&.
225 \fI$SYSTEMD_PAGER\fR
226 is used if set; otherwise
227 \fI$PAGER\fR
228 is used\&. If neither
229 \fI$SYSTEMD_PAGER\fR
230 nor
231 \fI$PAGER\fR
232 are set, a set of well\-known pager implementations is tried in turn, including
233 \fBless\fR(1)
234 and
235 \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
236 "cat"
237 is equivalent to passing
238 \fB\-\-no\-pager\fR\&.
239 .sp
240 Note: if
241 \fI$SYSTEMD_PAGERSECURE\fR
242 is not set,
243 \fI$SYSTEMD_PAGER\fR
244 and
245 \fI$PAGER\fR
246 can only be used to disable the pager (with
247 "cat"
248 or
249 ""), and are otherwise ignored\&.
250 .RE
251 .PP
252 \fI$SYSTEMD_LESS\fR
253 .RS 4
254 Override the options passed to
255 \fBless\fR
256 (by default
257 "FRSXMK")\&.
258 .sp
259 Users might want to change two options in particular:
260 .PP
261 \fBK\fR
262 .RS 4
263 This option instructs the pager to exit immediately when
264 Ctrl+C
265 is pressed\&. To allow
266 \fBless\fR
267 to handle
268 Ctrl+C
269 itself to switch back to the pager command prompt, unset this option\&.
270 .sp
271 If the value of
272 \fI$SYSTEMD_LESS\fR
273 does not include
274 "K", and the pager that is invoked is
275 \fBless\fR,
276 Ctrl+C
277 will be ignored by the executable, and needs to be handled by the pager\&.
278 .RE
279 .PP
280 \fBX\fR
281 .RS 4
282 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\&.
283 .RE
284 .sp
285 Note that setting the regular
286 \fI$LESS\fR
287 environment variable has no effect for
288 \fBless\fR
289 invocations by systemd tools\&.
290 .sp
291 See
292 \fBless\fR(1)
293 for more discussion\&.
294 .RE
295 .PP
296 \fI$SYSTEMD_LESSCHARSET\fR
297 .RS 4
298 Override the charset passed to
299 \fBless\fR
300 (by default
301 "utf\-8", if the invoking terminal is determined to be UTF\-8 compatible)\&.
302 .sp
303 Note that setting the regular
304 \fI$LESSCHARSET\fR
305 environment variable has no effect for
306 \fBless\fR
307 invocations by systemd tools\&.
308 .RE
309 .PP
310 \fI$SYSTEMD_PAGERSECURE\fR
311 .RS 4
312 Common pager commands like
313 \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
314 \fBsudo\fR(8)
315 or
316 \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,
317 \fIif the pager supports that\fR
318 (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
319 \fB\-\-no\-pager\fR
320 or
321 \fIPAGER=cat\fR
322 when allowing untrusted users to execute commands with elevated privileges\&.
323 .sp
324 This option takes a boolean argument\&. When set to true, the "secure mode" of the pager is enabled\&. In "secure mode",
325 \fBLESSSECURE=1\fR
326 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
327 \fBless\fR(1)
328 is known to understand this variable and implement "secure mode"\&.
329 .sp
330 When set to false, no limitation is placed on the pager\&. Setting
331 \fISYSTEMD_PAGERSECURE=0\fR
332 or not removing it from the inherited environment may allow the user to invoke arbitrary commands\&.
333 .sp
334 When
335 \fI$SYSTEMD_PAGERSECURE\fR
336 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
337 \fBgeteuid\fR(2)
338 and
339 \fBsd_pid_get_owner_uid\fR(3), or when running under
340 \fBsudo\fR(8)
341 or similar tools (\fI$SUDO_UID\fR
342 is set
343 \&\s-2\u[2]\d\s+2)\&. In those cases,
344 \fISYSTEMD_PAGERSECURE=1\fR
345 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
346 \fI$SYSTEMD_PAGERSECURE\fR
347 or disable the pager\&.
348 .sp
349 Note that if the
350 \fI$SYSTEMD_PAGER\fR
351 or
352 \fI$PAGER\fR
353 variables are to be honoured, other than to disable the pager,
354 \fI$SYSTEMD_PAGERSECURE\fR
355 must be set too\&.
356 .RE
357 .PP
358 \fI$SYSTEMD_COLORS\fR
359 .RS 4
360 Takes a boolean argument\&. When true,
361 \fBsystemd\fR
362 and related utilities will use colors in their output, otherwise the output will be monochrome\&. Additionally, the variable can take one of the following special values:
363 "16",
364 "256"
365 to restrict the use of colors to the base 16 or 256 ANSI colors, respectively\&. This can be specified to override the automatic decision based on
366 \fI$TERM\fR
367 and what the console is connected to\&.
368 .RE
369 .PP
370 \fI$SYSTEMD_URLIFY\fR
371 .RS 4
372 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
373 \fBsystemd\fR
374 makes based on
375 \fI$TERM\fR
376 and other conditions\&.
377 .RE
378 .SH "SEE ALSO"
379 .PP
380 \fBsystemd\fR(1), \fBlogind.conf\fR(5)
381 .SH "NOTES"
382 .IP " 1." 4
383 Inhibitor Locks
384 .RS 4
385 \%https://systemd.io/INHIBITOR_LOCKS
386 .RE
387 .IP " 2." 4
388 It is recommended for other tools to set and check
389 \fI$SUDO_UID\fR
390 as appropriate, treating it is a common interface.
391