Debian Codegraph @

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

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