Debian Codegraph @

upstream/debian-trixie/man1/portablectl.1

raw
1 '\" t
2 .TH "PORTABLECTL" "1" "" "systemd 257.13" "portablectl"
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 portablectl \- Attach, detach or inspect portable service images
24 .SH "SYNOPSIS"
25 .HP \w'\fBportablectl\fR\ 'u
26 \fBportablectl\fR [OPTIONS...] {COMMAND} [NAME...]
27 .SH "DESCRIPTION"
28 .PP
29 \fBportablectl\fR
30 may be used to attach, detach or inspect portable service images\&. It\*(Aqs primarily a command interfacing with
31 \fBsystemd-portabled.service\fR(8)\&.
32 .PP
33 Portable service images contain an OS file system tree along with
34 \fBsystemd\fR(1)
35 unit file information\&. A service image may be "attached" to the local system\&. If attached, a set of unit files are copied from the image to the host, and extended with
36 \fIRootDirectory=\fR
37 or
38 \fIRootImage=\fR
39 assignments (in case of service units) pointing to the image file or directory, ensuring the services will run within the file system context of the image\&.
40 .PP
41 Portable service images are an efficient way to bundle multiple related services and other units together, and transfer them as a whole between systems\&. When these images are attached to the local system, the contained units may run in most ways like regular system\-provided units, either with full privileges or inside strict sandboxing, depending on the selected configuration\&. For more details, see
42 \m[blue]\fBPortable Services\fR\m[]\&\s-2\u[1]\d\s+2\&.
43 .PP
44 Portable service images may be of the following kinds:
45 .sp
46 .RS 4
47 .ie n \{\
48 \h'-04'\(bu\h'+03'\c
49 .\}
50 .el \{\
51 .sp -1
52 .IP \(bu 2.3
53 .\}
54 Directory trees containing an OS, including the top\-level directories
55 /usr/,
56 /etc/, and so on\&.
57 .RE
58 .sp
59 .RS 4
60 .ie n \{\
61 \h'-04'\(bu\h'+03'\c
62 .\}
63 .el \{\
64 .sp -1
65 .IP \(bu 2.3
66 .\}
67 btrfs subvolumes containing OS trees, similar to normal directory trees\&.
68 .RE
69 .sp
70 .RS 4
71 .ie n \{\
72 \h'-04'\(bu\h'+03'\c
73 .\}
74 .el \{\
75 .sp -1
76 .IP \(bu 2.3
77 .\}
78 Binary "raw" disk images containing MBR or GPT partition tables and Linux file system partitions\&. (These must be regular files, with the
79 \&.raw
80 suffix\&.)
81 .RE
82 .SH "COMMANDS"
83 .PP
84 The following commands are understood:
85 .PP
86 \fBlist\fR
87 .RS 4
88 List available portable service images\&. This will list all portable service images discovered in the portable image search paths (see below), along with brief metadata and state information\&. Note that many of the commands below may both operate on images inside and outside of the search paths\&. This command is hence mostly a convenience option, the commands are generally not restricted to what this list shows\&.
89 .sp
90 Added in version 239\&.
91 .RE
92 .PP
93 \fBattach\fR \fIIMAGE\fR [\fIPREFIX\&...\fR]
94 .RS 4
95 Attach a portable service image to the host system\&. Expects a file system path to a portable service image file or directory as first argument\&. If the specified path contains no slash character ("/") it is understood as image filename that is searched for in the portable service image search paths (see below)\&. To reference a file in the current working directory prefix the filename with
96 "\&./"
97 to avoid this search path logic\&.
98 .sp
99 When a portable service is attached four operations are executed:
100 .sp
101 .RS 4
102 .ie n \{\
103 \h'-04' 1.\h'+01'\c
104 .\}
105 .el \{\
106 .sp -1
107 .IP " 1." 4.2
108 .\}
109 All unit files of types
110 \&.service,
111 \&.socket,
112 \&.target,
113 \&.timer
114 and
115 \&.path
116 which match the indicated unit file name prefix are copied from the image to the host\*(Aqs
117 /etc/systemd/system\&.attached/
118 directory (or
119 /run/systemd/system\&.attached/
120 \(em depending whether
121 \fB\-\-runtime\fR
122 is specified, see below), which is included in the built\-in unit search path of the system service manager\&.
123 .RE
124 .sp
125 .RS 4
126 .ie n \{\
127 \h'-04' 2.\h'+01'\c
128 .\}
129 .el \{\
130 .sp -1
131 .IP " 2." 4.2
132 .\}
133 For unit files of type
134 \&.service
135 a drop\-in is added to these copies that adds
136 \fIRootDirectory=\fR
137 or
138 \fIRootImage=\fR
139 settings (see
140 \fBsystemd.unit\fR(5)
141 for details), that ensures these services are run within the file system of the originating portable service image\&.
142 .RE
143 .sp
144 .RS 4
145 .ie n \{\
146 \h'-04' 3.\h'+01'\c
147 .\}
148 .el \{\
149 .sp -1
150 .IP " 3." 4.2
151 .\}
152 A second drop\-in is created: the "profile" drop\-in, that may contain additional security settings (and other settings)\&. A number of profiles are available by default but administrators may define their own ones\&. See below\&.
153 .RE
154 .sp
155 .RS 4
156 .ie n \{\
157 \h'-04' 4.\h'+01'\c
158 .\}
159 .el \{\
160 .sp -1
161 .IP " 4." 4.2
162 .\}
163 If the portable service image file is not already in the search path (see below), a symbolic link to it is created in
164 /etc/portables/
165 or
166 /run/portables/, to make sure it is included in it\&.
167 .RE
168 .sp
169 By default, all unit files whose names start with a prefix generated from the image\*(Aqs file name are copied out\&. Specifically, the prefix is determined from the image file name with any suffix such as
170 \&.raw
171 removed, truncated at the first occurrence of an underscore character ("_"), if there is one\&. The underscore logic is supposed to be used to versioning so that the an image file
172 foobar_47\&.11\&.raw
173 will result in a unit file matching prefix of
174 foobar\&. This prefix is then compared with all unit files names contained in the image in the usual directories, but only unit file names where the prefix is followed by
175 "\-",
176 "\&."
177 or
178 "@"
179 are considered\&. Example: if a portable service image file is named
180 foobar_47\&.11\&.raw
181 then by default all its unit files with names such as
182 foobar\-quux\-waldi\&.service,
183 foobar\&.service
184 or
185 foobar@\&.service
186 will be considered\&. It\*(Aqs possible to override the matching prefix: all strings listed on the command line after the image file name are considered prefixes, overriding the implicit logic where the prefix is derived from the image file name\&.
187 .sp
188 By default, after the unit files are attached the service manager\*(Aqs configuration is reloaded, except when
189 \fB\-\-no\-reload\fR
190 is specified (see below)\&. This ensures that the new units made available to the service manager are seen by it\&.
191 .sp
192 If
193 \fB\-\-now\fR
194 and/or
195 \fB\-\-enable\fR
196 are passed, the portable services are immediately started (blocking operation unless
197 \fB\-\-no\-block\fR
198 is passed) and/or enabled after attaching the image\&.
199 .sp
200 In place of the image path a
201 "\&.v/"
202 versioned directory may be specified, see
203 \fBsystemd.v\fR(7)
204 for details\&.
205 .sp
206 In place of the directory path a
207 "\&.v/"
208 versioned directory may be specified, see
209 \fBsystemd.v\fR(7)
210 for details\&.
211 .sp
212 Added in version 239\&.
213 .RE
214 .PP
215 \fBdetach\fR \fIIMAGE\fR [\fIPREFIX\&...\fR]
216 .RS 4
217 Detaches a portable service image from the host\&. This undoes the operations executed by the
218 \fBattach\fR
219 command above, and removes the unit file copies, drop\-ins and image symlink again\&. This command expects an image name or path as parameter\&. Note that if a path is specified only the last component of it (i\&.e\&. the file or directory name itself, not the path to it) is used for finding matching unit files\&. This is a convenience feature to allow all arguments passed as
220 \fBattach\fR
221 also to
222 \fBdetach\fR\&.
223 .sp
224 If
225 \fB\-\-now\fR
226 and/or
227 \fB\-\-enable\fR
228 are passed, the portable services are immediately stopped (blocking operation) and/or disabled before detaching the image\&. Prefix(es) are also accepted, to be used in case the unit names do not match the image name as described in the
229 \fBattach\fR\&.
230 .sp
231 Added in version 239\&.
232 .RE
233 .PP
234 \fBreattach\fR \fIIMAGE\fR [\fIPREFIX\&...\fR]
235 .RS 4
236 Detaches an existing portable service image from the host, and immediately attaches it again\&. This is useful in case the image was replaced\&. Running units are not stopped during the process\&. Partial matching, to allow for different versions in the image name, is allowed: only the part before the first
237 "_"
238 character has to match\&. If the new image does not exist, the existing one will not be detached\&. The parameters follow the same syntax as the
239 \fBattach\fR
240 command\&.
241 .sp
242 If
243 \fB\-\-now\fR
244 and/or
245 \fB\-\-enable\fR
246 are passed, the portable services are immediately stopped if removed, started and/or enabled if added, or restarted if updated\&. Prefixes are also accepted, in the same way as described in the
247 \fBattach\fR
248 case\&.
249 .sp
250 Added in version 248\&.
251 .RE
252 .PP
253 \fBinspect\fR \fIIMAGE\fR [\fIPREFIX\&...\fR]
254 .RS 4
255 Extracts various metadata from a portable service image and presents it to the caller\&. Specifically, the
256 \fBos-release\fR(5)
257 file of the image is retrieved as well as all matching unit files\&. By default, a short summary showing the most relevant metadata in combination with a list of matching unit files is shown (that is the unit files
258 \fBattach\fR
259 would install to the host system)\&. If combined with
260 \fB\-\-cat\fR
261 (see above), the
262 os\-release
263 data and the units files\*(Aq contents is displayed unprocessed\&. This command is useful to determine whether an image qualifies as portable service image, and which unit files are included\&. This command expects the path to the image as parameter, optionally followed by a list of unit file prefixes to consider, similar to the
264 \fBattach\fR
265 command described above\&.
266 .sp
267 Added in version 239\&.
268 .RE
269 .PP
270 \fBis\-attached\fR \fIIMAGE\fR
271 .RS 4
272 Determines whether the specified image is currently attached or not\&. Unless combined with the
273 \fB\-\-quiet\fR
274 switch this will show a short state identifier for the image\&. Specifically:
275 .sp
276 .it 1 an-trap
277 .nr an-no-space-flag 1
278 .nr an-break-flag 1
279 .br
280 .B Table\ \&1.\ \&Image attachment states
281 .TS
282 allbox tab(:);
283 lB lB.
284 T{
285 State
286 T}:T{
287 Description
288 T}
289 .T&
290 l l
291 l l
292 l l
293 l l
294 l l
295 l l
296 l l.
297 T{
298 \fBdetached\fR
299 T}:T{
300 The image is currently not attached\&.
301 T}
302 T{
303 \fBattached\fR
304 T}:T{
305 The image is currently attached, i\&.e\&. its unit files have been made available to the host system\&.
306 T}
307 T{
308 \fBattached\-runtime\fR
309 T}:T{
310 Like \fBattached\fR, but the unit files have been made available transiently only, i\&.e\&. the \fBattach\fR command has been invoked with the \fB\-\-runtime\fR option\&.
311 T}
312 T{
313 \fBenabled\fR
314 T}:T{
315 The image is currently attached, and at least one unit file associated with it has been enabled\&.
316 T}
317 T{
318 \fBenabled\-runtime\fR
319 T}:T{
320 Like \fBenabled\fR, but the unit files have been made available transiently only, i\&.e\&. the \fBattach\fR command has been invoked with the \fB\-\-runtime\fR option\&.
321 T}
322 T{
323 \fBrunning\fR
324 T}:T{
325 The image is currently attached, and at least one unit file associated with it is running\&.
326 T}
327 T{
328 \fBrunning\-runtime\fR
329 T}:T{
330 The image is currently attached transiently, and at least one unit file associated with it is running\&.
331 T}
332 .TE
333 .sp 1
334 Added in version 239\&.
335 .RE
336 .PP
337 \fBread\-only\fR \fIIMAGE\fR [\fIBOOL\fR]
338 .RS 4
339 Marks or (unmarks) a portable service image read\-only\&. Takes an image name, followed by a boolean as arguments\&. If the boolean is omitted, positive is implied, i\&.e\&. the image is marked read\-only\&.
340 .sp
341 Added in version 239\&.
342 .RE
343 .PP
344 \fBremove\fR \fIIMAGE\fR\&...
345 .RS 4
346 Removes one or more portable service images\&. Note that this command will only remove the specified image path itself \(em it refers to a symbolic link then the symbolic link is removed and not the image it points to\&.
347 .sp
348 Added in version 239\&.
349 .RE
350 .PP
351 \fBset\-limit\fR [\fIIMAGE\fR] \fIBYTES\fR
352 .RS 4
353 Sets the maximum size in bytes that a specific portable service image, or all images, may grow up to on disk (disk quota)\&. Takes either one or two parameters\&. The first, optional parameter refers to a portable service image name\&. If specified, the size limit of the specified image is changed\&. If omitted, the overall size limit of the sum of all images stored locally is changed\&. The final argument specifies the size limit in bytes, possibly suffixed by the usual K, M, G, T units\&. If the size limit shall be disabled, specify
354 "\-"
355 as size\&.
356 .sp
357 Note that per\-image size limits are only supported on btrfs file systems\&. Also, depending on
358 \fIBindPaths=\fR
359 settings in the portable service\*(Aqs unit files directories from the host might be visible in the image environment during runtime which are not affected by this setting, as only the image itself is counted against this limit\&.
360 .sp
361 Added in version 239\&.
362 .RE
363 .SH "OPTIONS"
364 .PP
365 The following options are understood:
366 .PP
367 \fB\-q\fR, \fB\-\-quiet\fR
368 .RS 4
369 Suppresses additional informational output while running\&.
370 .sp
371 Added in version 239\&.
372 .RE
373 .PP
374 \fB\-p\fR \fIPROFILE\fR, \fB\-\-profile=\fR\fB\fIPROFILE\fR\fR
375 .RS 4
376 When attaching an image, select the profile to use\&. By default, the
377 "default"
378 profile is used\&. For details about profiles, see below\&.
379 .sp
380 Added in version 239\&.
381 .RE
382 .PP
383 \fB\-\-copy=\fR
384 .RS 4
385 When attaching an image, select whether to prefer copying or symlinking of files installed into the host system\&. Takes one of
386 "copy"
387 (files will be copied),
388 "symlink"
389 (to prefer creation of symbolic links),
390 "auto"
391 for an intermediary mode where security profile drop\-ins and images are symlinked while unit files are copied, or
392 "mixed"
393 (since v256) where security profile drop\-ins are symlinked while unit files and images are copied\&. Note that this option expresses a preference only, in cases where symbolic links cannot be created \(em for example when the image operated on is a raw disk image, and hence not directly referentiable from the host file system \(em copying of files is used unconditionally\&.
394 .sp
395 Added in version 239\&.
396 .RE
397 .PP
398 \fB\-\-runtime\fR
399 .RS 4
400 When specified the unit and drop\-in files are placed in
401 /run/systemd/system\&.attached/
402 instead of
403 /etc/systemd/system\&.attached/\&. Images attached with this option set hence remain attached only until the next reboot, while they are normally attached persistently\&.
404 .sp
405 Added in version 239\&.
406 .RE
407 .PP
408 \fB\-\-no\-reload\fR
409 .RS 4
410 Do not reload the service manager after attaching or detaching a portable service image\&. Normally the service manager is reloaded to ensure it is aware of added or removed unit files\&.
411 .sp
412 Added in version 239\&.
413 .RE
414 .PP
415 \fB\-\-cat\fR
416 .RS 4
417 When inspecting portable service images, show the (unprocessed) contents of the metadata files pulled from the image, instead of brief summaries\&. Specifically, this will show the
418 \fBos-release\fR(5)
419 and unit file contents of the image\&.
420 .sp
421 Added in version 239\&.
422 .RE
423 .PP
424 \fB\-\-enable\fR
425 .RS 4
426 Immediately enable/disable the portable service after attaching/detaching\&.
427 .sp
428 Added in version 245\&.
429 .RE
430 .PP
431 \fB\-\-now\fR
432 .RS 4
433 Immediately start/stop/restart the portable service after attaching/before detaching/after upgrading\&.
434 .sp
435 Added in version 245\&.
436 .RE
437 .PP
438 \fB\-\-no\-block\fR
439 .RS 4
440 Do not block waiting for attach \-\-now to complete\&.
441 .sp
442 Added in version 245\&.
443 .RE
444 .PP
445 \fB\-\-clean\fR
446 .RS 4
447 When detaching ensure the configuration, state, logs, cache, and runtime data directories of the portable service are removed from the host system\&.
448 .sp
449 Added in version 256\&.
450 .RE
451 .PP
452 \fB\-\-extension=\fR\fB\fIPATH\fR\fR
453 .RS 4
454 Add an additional image
455 \fIPATH\fR
456 as an overlay on top of
457 \fIIMAGE\fR
458 when attaching/detaching\&. This argument can be specified multiple times, in which case the order in which images are laid down follows the rules specified in
459 \fBsystemd.exec\fR(5)
460 for the
461 \fIExtensionImages=\fR
462 directive and for the
463 \fBsystemd-sysext\fR(8)
464 and
465 \fBsystemd-confext\fR(8)
466 tools\&. The images must contain an
467 extension\-release
468 file with metadata that matches what is defined in the
469 os\-release
470 of
471 \fIIMAGE\fR\&. See:
472 \fBos-release\fR(5)\&. Images can be block images, btrfs subvolumes or directories\&. For more information on portable services with extensions, see the
473 "Extension Images"
474 paragraph on
475 \m[blue]\fBPortable Services\fR\m[]\&\s-2\u[1]\d\s+2\&.
476 .sp
477 Note that the same extensions have to be specified, in the same order, when attaching and detaching\&.
478 .sp
479 In place of the image path a
480 "\&.v/"
481 versioned directory may be specified, see
482 \fBsystemd.v\fR(7)
483 for details\&.
484 .sp
485 In place of the directory path a
486 "\&.v/"
487 versioned directory may be specified, see
488 \fBsystemd.v\fR(7)
489 for details\&.
490 .sp
491 Added in version 249\&.
492 .RE
493 .PP
494 \fB\-\-force\fR
495 .RS 4
496 Skip safety checks and attach or detach images (with extensions) without first ensuring that the units are not running, and do not insist that the
497 extension\-release\&.\fINAME\fR
498 file in the extension image has to match the image filename\&.
499 .sp
500 Added in version 252\&.
501 .RE
502 .PP
503 \fB\-H\fR, \fB\-\-host=\fR
504 .RS 4
505 Execute the operation remotely\&. Specify a hostname, or a username and hostname separated by
506 "@", to connect to\&. The hostname may optionally be suffixed by a port ssh is listening on, separated by
507 ":", and then a container name, separated by
508 "/", which connects directly to a specific container on the specified host\&. This will use SSH to talk to the remote machine manager instance\&. Container names may be enumerated with
509 \fBmachinectl \-H \fR\fB\fIHOST\fR\fR\&. Put IPv6 addresses in brackets\&.
510 .RE
511 .PP
512 \fB\-M\fR, \fB\-\-machine=\fR
513 .RS 4
514 Execute operation on a local container\&. Specify a container name to connect to, optionally prefixed by a user name to connect as and a separating
515 "@"
516 character\&. If the special string
517 "\&.host"
518 is used in place of the container name, a connection to the local system is made (which is useful to connect to a specific user\*(Aqs user bus:
519 "\-\-user \-\-machine=lennart@\&.host")\&. If the
520 "@"
521 syntax is not used, the connection is made as root user\&. If the
522 "@"
523 syntax is used either the left hand side or the right hand side may be omitted (but not both) in which case the local user name and
524 "\&.host"
525 are implied\&.
526 .RE
527 .PP
528 \fB\-\-no\-pager\fR
529 .RS 4
530 Do not pipe output into a pager\&.
531 .RE
532 .PP
533 \fB\-\-no\-legend\fR
534 .RS 4
535 Do not print the legend, i\&.e\&. column headers and the footer with hints\&.
536 .RE
537 .PP
538 \fB\-\-no\-ask\-password\fR
539 .RS 4
540 Do not query the user for authentication for privileged operations\&.
541 .RE
542 .PP
543 \fB\-h\fR, \fB\-\-help\fR
544 .RS 4
545 Print a short help text and exit\&.
546 .RE
547 .PP
548 \fB\-\-version\fR
549 .RS 4
550 Print a short version string and exit\&.
551 .RE
552 .SH "FILES AND DIRECTORIES"
553 .PP
554 Portable service images are preferably stored in
555 /var/lib/portables/, but are also searched for in
556 /etc/portables/,
557 /run/systemd/portables/,
558 /usr/local/lib/portables/
559 and
560 /usr/lib/portables/\&. It\*(Aqs recommended not to place image files directly in
561 /etc/portables/
562 or
563 /run/systemd/portables/
564 (as these are generally not suitable for storing large or non\-textual data), but use these directories only for linking images located elsewhere into the image search path\&.
565 .PP
566 When a portable service image is attached, matching unit files are copied onto the host into the
567 /etc/systemd/system\&.attached/
568 and
569 /run/systemd/system\&.attached/
570 directories\&. When an image is detached, the unit files are removed again from these directories\&.
571 .SH "PROFILES"
572 .PP
573 When portable service images are attached a "profile" drop\-in is linked in, which may be used to enforce additional security (and other) restrictions locally\&. Four profile drop\-ins are defined by default, and shipped in
574 /usr/lib/systemd/portable/profile/\&. Additional, local profiles may be defined by placing them in
575 /etc/systemd/portable/profile/\&. The default profiles are:
576 .sp
577 .it 1 an-trap
578 .nr an-no-space-flag 1
579 .nr an-break-flag 1
580 .br
581 .B Table\ \&2.\ \&Profiles
582 .TS
583 allbox tab(:);
584 lB lB.
585 T{
586 Name
587 T}:T{
588 Description
589 T}
590 .T&
591 l l
592 l l
593 l l
594 l l.
595 T{
596 default
597 T}:T{
598 This is the default profile if no other profile name is set via the \fB\-\-profile=\fR (see above)\&. It\*(Aqs fairly restrictive, but should be useful for common, unprivileged system workloads\&. This includes write access to the logging framework, as well as IPC access to the D\-Bus system\&.
599 T}
600 T{
601 nonetwork
602 T}:T{
603 Very similar to default, but networking is turned off for any services of the portable service image\&.
604 T}
605 T{
606 strict
607 T}:T{
608 A profile with very strict settings\&. This profile excludes IPC (D\-Bus) and network access\&.
609 T}
610 T{
611 trusted
612 T}:T{
613 A profile with very relaxed settings\&. In this profile the services run with full privileges\&.
614 T}
615 .TE
616 .sp 1
617 .PP
618 For details on these profiles and their effects see their precise definitions, e\&.g\&.
619 /usr/lib/systemd/portable/profile/default/service\&.conf
620 and similar\&.
621 .SH "EXIT STATUS"
622 .PP
623 On success, 0 is returned, a non\-zero failure code otherwise\&.
624 .SH "ENVIRONMENT"
625 .PP
626 \fI$SYSTEMD_LOG_LEVEL\fR
627 .RS 4
628 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)
629 \fBemerg\fR,
630 \fBalert\fR,
631 \fBcrit\fR,
632 \fBerr\fR,
633 \fBwarning\fR,
634 \fBnotice\fR,
635 \fBinfo\fR,
636 \fBdebug\fR, or an integer in the range 0\&...7\&. See
637 \fBsyslog\fR(3)
638 for more information\&. Each value may optionally be prefixed with one of
639 \fBconsole\fR,
640 \fBsyslog\fR,
641 \fBkmsg\fR
642 or
643 \fBjournal\fR
644 followed by a colon to set the maximum log level for that specific log target (e\&.g\&.
645 \fBSYSTEMD_LOG_LEVEL=debug,console:info\fR
646 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\&.
647 .RE
648 .PP
649 \fI$SYSTEMD_LOG_COLOR\fR
650 .RS 4
651 A boolean\&. If true, messages written to the tty will be colored according to priority\&.
652 .sp
653 This setting is only useful when messages are written directly to the terminal, because
654 \fBjournalctl\fR(1)
655 and other tools that display logs will color messages based on the log level on their own\&.
656 .RE
657 .PP
658 \fI$SYSTEMD_LOG_TIME\fR
659 .RS 4
660 A boolean\&. If true, console log messages will be prefixed with a timestamp\&.
661 .sp
662 This setting is only useful when messages are written directly to the terminal or a file, because
663 \fBjournalctl\fR(1)
664 and other tools that display logs will attach timestamps based on the entry metadata on their own\&.
665 .RE
666 .PP
667 \fI$SYSTEMD_LOG_LOCATION\fR
668 .RS 4
669 A boolean\&. If true, messages will be prefixed with a filename and line number in the source code where the message originates\&.
670 .sp
671 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\&.
672 .RE
673 .PP
674 \fI$SYSTEMD_LOG_TID\fR
675 .RS 4
676 A boolean\&. If true, messages will be prefixed with the current numerical thread ID (TID)\&.
677 .sp
678 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\&.
679 .RE
680 .PP
681 \fI$SYSTEMD_LOG_TARGET\fR
682 .RS 4
683 The destination for log messages\&. One of
684 \fBconsole\fR
685 (log to the attached tty),
686 \fBconsole\-prefixed\fR
687 (log to the attached tty but with prefixes encoding the log level and "facility", see
688 \fBsyslog\fR(3),
689 \fBkmsg\fR
690 (log to the kernel circular log buffer),
691 \fBjournal\fR
692 (log to the journal),
693 \fBjournal\-or\-kmsg\fR
694 (log to the journal if available, and to kmsg otherwise),
695 \fBauto\fR
696 (determine the appropriate log target automatically, the default),
697 \fBnull\fR
698 (disable log output)\&.
699 .RE
700 .PP
701 \fI$SYSTEMD_LOG_RATELIMIT_KMSG\fR
702 .RS 4
703 Whether to ratelimit kmsg or not\&. Takes a boolean\&. Defaults to
704 "true"\&. If disabled, systemd will not ratelimit messages written to kmsg\&.
705 .RE
706 .PP
707 \fI$SYSTEMD_PAGER\fR, \fI$PAGER\fR
708 .RS 4
709 Pager to use when
710 \fB\-\-no\-pager\fR
711 is not given\&.
712 \fI$SYSTEMD_PAGER\fR
713 is used if set; otherwise
714 \fI$PAGER\fR
715 is used\&. If neither
716 \fI$SYSTEMD_PAGER\fR
717 nor
718 \fI$PAGER\fR
719 are set, a set of well\-known pager implementations is tried in turn, including
720 \fBless\fR(1)
721 and
722 \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
723 "cat"
724 is equivalent to passing
725 \fB\-\-no\-pager\fR\&.
726 .sp
727 Note: if
728 \fI$SYSTEMD_PAGERSECURE\fR
729 is not set,
730 \fI$SYSTEMD_PAGER\fR
731 and
732 \fI$PAGER\fR
733 can only be used to disable the pager (with
734 "cat"
735 or
736 ""), and are otherwise ignored\&.
737 .RE
738 .PP
739 \fI$SYSTEMD_LESS\fR
740 .RS 4
741 Override the options passed to
742 \fBless\fR
743 (by default
744 "FRSXMK")\&.
745 .sp
746 Users might want to change two options in particular:
747 .PP
748 \fBK\fR
749 .RS 4
750 This option instructs the pager to exit immediately when
751 Ctrl+C
752 is pressed\&. To allow
753 \fBless\fR
754 to handle
755 Ctrl+C
756 itself to switch back to the pager command prompt, unset this option\&.
757 .sp
758 If the value of
759 \fI$SYSTEMD_LESS\fR
760 does not include
761 "K", and the pager that is invoked is
762 \fBless\fR,
763 Ctrl+C
764 will be ignored by the executable, and needs to be handled by the pager\&.
765 .RE
766 .PP
767 \fBX\fR
768 .RS 4
769 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\&.
770 .RE
771 .sp
772 Note that setting the regular
773 \fI$LESS\fR
774 environment variable has no effect for
775 \fBless\fR
776 invocations by systemd tools\&.
777 .sp
778 See
779 \fBless\fR(1)
780 for more discussion\&.
781 .RE
782 .PP
783 \fI$SYSTEMD_LESSCHARSET\fR
784 .RS 4
785 Override the charset passed to
786 \fBless\fR
787 (by default
788 "utf\-8", if the invoking terminal is determined to be UTF\-8 compatible)\&.
789 .sp
790 Note that setting the regular
791 \fI$LESSCHARSET\fR
792 environment variable has no effect for
793 \fBless\fR
794 invocations by systemd tools\&.
795 .RE
796 .PP
797 \fI$SYSTEMD_PAGERSECURE\fR
798 .RS 4
799 Common pager commands like
800 \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
801 \fBsudo\fR(8)
802 or
803 \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,
804 \fIif the pager supports that\fR
805 (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
806 \fB\-\-no\-pager\fR
807 or
808 \fIPAGER=cat\fR
809 when allowing untrusted users to execute commands with elevated privileges\&.
810 .sp
811 This option takes a boolean argument\&. When set to true, the "secure mode" of the pager is enabled\&. In "secure mode",
812 \fBLESSSECURE=1\fR
813 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
814 \fBless\fR(1)
815 is known to understand this variable and implement "secure mode"\&.
816 .sp
817 When set to false, no limitation is placed on the pager\&. Setting
818 \fISYSTEMD_PAGERSECURE=0\fR
819 or not removing it from the inherited environment may allow the user to invoke arbitrary commands\&.
820 .sp
821 When
822 \fI$SYSTEMD_PAGERSECURE\fR
823 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
824 \fBgeteuid\fR(2)
825 and
826 \fBsd_pid_get_owner_uid\fR(3), or when running under
827 \fBsudo\fR(8)
828 or similar tools (\fI$SUDO_UID\fR
829 is set
830 \&\s-2\u[2]\d\s+2)\&. In those cases,
831 \fISYSTEMD_PAGERSECURE=1\fR
832 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
833 \fI$SYSTEMD_PAGERSECURE\fR
834 or disable the pager\&.
835 .sp
836 Note that if the
837 \fI$SYSTEMD_PAGER\fR
838 or
839 \fI$PAGER\fR
840 variables are to be honoured, other than to disable the pager,
841 \fI$SYSTEMD_PAGERSECURE\fR
842 must be set too\&.
843 .RE
844 .PP
845 \fI$SYSTEMD_COLORS\fR
846 .RS 4
847 Takes a boolean argument\&. When true,
848 \fBsystemd\fR
849 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:
850 "16",
851 "256"
852 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
853 \fI$TERM\fR
854 and what the console is connected to\&.
855 .RE
856 .PP
857 \fI$SYSTEMD_URLIFY\fR
858 .RS 4
859 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
860 \fBsystemd\fR
861 makes based on
862 \fI$TERM\fR
863 and other conditions\&.
864 .RE
865 .SH "SEE ALSO"
866 .PP
867 \fBsystemd\fR(1), \fBsystemd-sysext\fR(8), \fBorg.freedesktop.portable1\fR(5), \fBsystemd-portabled.service\fR(8), \fBimportctl\fR(1)
868 .SH "NOTES"
869 .IP " 1." 4
870 Portable Services
871 .RS 4
872 \%https://systemd.io/PORTABLE_SERVICES
873 .RE
874 .IP " 2." 4
875 It is recommended for other tools to set and check
876 \fI$SUDO_UID\fR
877 as appropriate, treating it is a common interface.
878