Debian Codegraph @

upstream/opensuse-leap-16-1/man1/systemd-vmspawn.1

raw
1 '\" t
2 .TH "SYSTEMD\-VMSPAWN" "1" "" "systemd 257.13" "systemd-vmspawn"
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-vmspawn \- Spawn an OS in a virtual machine
24 .SH "SYNOPSIS"
25 .HP \w'\fBsystemd\-vmspawn\fR\ 'u
26 \fBsystemd\-vmspawn\fR [OPTIONS...] [ARGS...]
27 .SH "DESCRIPTION"
28 .PP
29 \fBsystemd\-vmspawn\fR
30 may be used to start a virtual machine from an OS image\&. In many ways it is similar to
31 \fBsystemd-nspawn\fR(1), but launches a full virtual machine instead of using namespaces\&.
32 .PP
33 File descriptors for
34 /dev/kvm
35 and
36 /dev/vhost\-vsock
37 can be passed to
38 \fBsystemd\-vmspawn\fR
39 via systemd\*(Aqs native socket passing interface (see
40 \fBsd_listen_fds\fR(3)
41 for details about the precise protocol used and the order in which the file descriptors are passed), these file descriptors must be passed with the names
42 "kvm"
43 and
44 "vhost\-vsock"
45 respectively\&.
46 .PP
47 Note: on Ubuntu/Debian derivatives
48 \fBsystemd\-vmspawn\fR
49 requires the user to be in the
50 "kvm"
51 group to use the VSOCK options\&.
52 .SH "OPTIONS"
53 .PP
54 The excess arguments are passed as extra kernel command line arguments using SMBIOS\&.
55 .PP
56 The following options are understood:
57 .PP
58 \fB\-q\fR, \fB\-\-quiet\fR
59 .RS 4
60 Turns off any status output by the tool itself\&. When this switch is used, the only output from vmspawn will be the console output of the Virtual Machine OS itself\&.
61 .sp
62 Added in version 256\&.
63 .RE
64 .SS "Image Options"
65 .PP
66 \fB\-D\fR, \fB\-\-directory=\fR
67 .RS 4
68 Directory to use as file system root for the virtual machine\&.
69 .sp
70 One of either
71 \fB\-\-directory=\fR
72 or
73 \fB\-\-image=\fR
74 must be specified\&. If neither are specified
75 \fB\-\-directory=\&.\fR
76 is assumed\&.
77 .sp
78 Note: If mounting a non\-root owned directory you may require
79 \fB\-\-private\-users=\fR
80 to map into the user\*(Aqs subuid namespace\&. An example of how to use
81 \fB/etc/subuid\fR
82 for this is given later\&.
83 .sp
84 Added in version 256\&.
85 .RE
86 .PP
87 \fB\-i\fR, \fB\-\-image=\fR
88 .RS 4
89 Root file system disk image (or device node) for the virtual machine\&.
90 .sp
91 Added in version 255\&.
92 .RE
93 .SS "Host Configuration"
94 .PP
95 \fB\-\-cpus=\fR\fB\fICPUS\fR\fR
96 .RS 4
97 The number of CPUs to start the virtual machine with\&. Defaults to 1\&.
98 .sp
99 Added in version 255\&.
100 .RE
101 .PP
102 \fB\-\-ram=\fR\fB\fIBYTES\fR\fR
103 .RS 4
104 The amount of memory to start the virtual machine with\&. Defaults to 2G\&.
105 .sp
106 Added in version 255\&.
107 .RE
108 .PP
109 \fB\-\-kvm=\fR\fB\fIBOOL\fR\fR
110 .RS 4
111 If
112 \fB\-\-kvm=\fR
113 is not specified, KVM support will be detected automatically\&. If true, KVM is always used, and if false, KVM is never used\&.
114 .sp
115 Added in version 255\&.
116 .RE
117 .PP
118 \fB\-\-vsock=\fR\fB\fIBOOL\fR\fR
119 .RS 4
120 If
121 \fB\-\-vsock=\fR
122 is not specified, VSOCK networking support will be detected automatically\&. If true, VSOCK networking is always used, and if false, VSOCK networking is never used\&.
123 .sp
124 Added in version 255\&.
125 .RE
126 .PP
127 \fB\-\-vsock\-cid=\fR\fB\fICID\fR\fR
128 .RS 4
129 Sets the specific CID to use for the guest\&. Valid CIDs are in the range
130 \fB3\fR
131 to
132 \fB4294967294\fR
133 (\fB0xFFFF_FFFE\fR)\&. CIDs outside of this range are reserved\&. By default, vmspawn will attempt to derive a CID for the guest derived from the machine name, falling back to a random CID if this CID is taken\&.
134 .sp
135 Added in version 255\&.
136 .RE
137 .PP
138 \fB\-\-tpm=\fR\fB\fIBOOL\fR\fR
139 .RS 4
140 If
141 \fB\-\-tpm=\fR
142 is not specified, vmspawn will detect the presence of
143 \fBswtpm\fR(8)
144 and use it if available\&. If yes is specified
145 \fBswtpm\fR(8)
146 is always used, and if no is set
147 \fBswtpm\fR(8)
148 is never used\&.
149 .sp
150 Note: the virtual TPM used may change in future\&.
151 .sp
152 Added in version 256\&.
153 .RE
154 .PP
155 \fB\-\-linux=\fR\fB\fIPATH\fR\fR
156 .RS 4
157 Set the linux kernel image to use for direct kernel boot\&. If a directory type image is used and
158 \fB\-\-linux=\fR
159 was omitted, vmspawn will search for boot loader entries according to the
160 \m[blue]\fBBoot Loader Specification\fR\m[]\&\s-2\u[1]\d\s+2
161 assuming XBOOTLDR to be located at /boot and ESP to be /efi respectively\&. If no kernel was installed into the image then the image will fail to boot\&.
162 .sp
163 Added in version 256\&.
164 .RE
165 .PP
166 \fB\-\-initrd=\fR\fB\fIPATH\fR\fR
167 .RS 4
168 Set the initrd to use for direct kernel boot\&. If the
169 \fB\-\-linux=\fR
170 supplied is a
171 \m[blue]\fBBoot Loader Specification\fR\m[]\&\s-2\u[1]\d\s+2
172 Type #2 entry, then this argument is not required\&. If no initrd was installed into the image then the image will fail to boot\&.
173 .sp
174 \fB\-\-initrd=\fR
175 can be specified multiple times and vmspawn will merge them together\&.
176 .sp
177 Added in version 256\&.
178 .RE
179 .PP
180 \fB\-n\fR, \fB\-\-network\-tap\fR
181 .RS 4
182 Create a TAP device to network with the virtual machine\&.
183 .sp
184 Note: root privileges are required to use TAP networking\&. Additionally,
185 \fBsystemd-networkd\fR(8)
186 must be running and correctly set up on the host to provision the host interface\&. The relevant
187 "\&.network"
188 file can be found at
189 /usr/lib/systemd/network/80\-vm\-vt\&.network\&.
190 .sp
191 Added in version 255\&.
192 .RE
193 .PP
194 \fB\-\-network\-user\-mode\fR
195 .RS 4
196 Use user mode networking\&.
197 .sp
198 Added in version 255\&.
199 .RE
200 .PP
201 \fB\-\-firmware=\fR\fB\fIPATH\fR\fR
202 .RS 4
203 Takes an absolute path, or a relative path beginning with
204 \&./\&. Specifies a JSON firmware definition file, which allows selecting the firmware to boot in the VM\&. If not specified, a suitable firmware is automatically discovered\&. If the special string
205 "list"
206 is specified lists all discovered firmwares\&.
207 .sp
208 Added in version 256\&.
209 .RE
210 .PP
211 \fB\-\-discard\-disk=\fR\fB\fIBOOL\fR\fR
212 .RS 4
213 Controls whether qemu processes discard requests from the VM\&. This prevents long running VMs from using more disk space than required\&. This is enabled by default\&.
214 .sp
215 Added in version 256\&.
216 .RE
217 .PP
218 \fB\-\-secure\-boot=\fR\fB\fIBOOL\fR\fR
219 .RS 4
220 Configure whether to search for firmware which supports Secure Boot\&.
221 .sp
222 If the option is not specified, the first firmware which is detected will be used\&. If the option is set to yes, then the first firmware with Secure Boot support will be selected\&. If no is specified, then the first firmware without Secure Boot will be selected\&.
223 .sp
224 Added in version 255\&.
225 .RE
226 .SS "System Identity Options"
227 .PP
228 \fB\-M\fR, \fB\-\-machine=\fR
229 .RS 4
230 Sets the machine name for this virtual machine\&. This name may be used to identify this virtual machine during its runtime (for example in tools like
231 \fBmachinectl\fR(1)
232 and similar)\&.
233 .sp
234 Added in version 255\&.
235 .RE
236 .PP
237 \fB\-\-uuid=\fR
238 .RS 4
239 Set the specified UUID for the virtual machine\&. The init system will initialize
240 /etc/machine\-id
241 from this if this file is not set yet\&. Note that this option takes effect only if
242 /etc/machine\-id
243 in the virtual machine is unpopulated\&.
244 .sp
245 Added in version 256\&.
246 .RE
247 .SS "Property Options"
248 .PP
249 \fB\-\-register=\fR
250 .RS 4
251 Controls whether the virtual machine is registered with
252 \fBsystemd-machined\fR(8)\&. Takes a boolean argument, which defaults to
253 "yes"
254 when running as root, and
255 "no"
256 when running as a regular user\&. This ensures that the virtual machine is accessible via
257 \fBmachinectl\fR(1)\&.
258 .sp
259 Note: root privileges are required to use this option as registering with
260 \fBsystemd-machined\fR(8)
261 requires privileged D\-Bus method calls\&.
262 .sp
263 Added in version 256\&.
264 .RE
265 .SS "User Namespacing Options"
266 .PP
267 \fB\-\-private\-users=\fR\fB\fIUID_SHIFT[:UID_RANGE]\fR\fR
268 .RS 4
269 Controls user namespacing under
270 \fB\-\-directory=\fR\&. If enabled,
271 \fBvirtiofsd\fR(1)
272 is instructed to map user and group ids (UIDs and GIDs)\&. This involves mapping the private UIDs/GIDs used in the virtual machine (starting with the virtual machine\*(Aqs root user 0 and up) to a range of UIDs/GIDs on the host that are not used for other purposes (usually in the range beyond the host\*(Aqs UID/GID 65536)\&.
273 .sp
274 If one or two colon\-separated numbers are specified, user namespacing is turned on\&.
275 \fIUID_SHIFT\fR
276 specifies the first host UID/GID to map,
277 \fIUID_RANGE\fR
278 is optional and specifies number of host UIDs/GIDs to assign to the virtual machine\&. If
279 \fIUID_RANGE\fR
280 is omitted, 65536 UIDs/GIDs are assigned\&.
281 .sp
282 When user namespaces are used, the GID range assigned to each virtual machine is always chosen identical to the UID range\&.
283 .sp
284 Added in version 256\&.
285 .RE
286 .SS "Mount Options"
287 .PP
288 \fB\-\-bind=\fR\fB\fIPATH\fR\fR, \fB\-\-bind\-ro=\fR\fB\fIPATH\fR\fR
289 .RS 4
290 Mount a directory from the host into the virtual machine\&. Takes one of: a path argument\ \&\(em in which case the specified path will be mounted from the host to the same path in the virtual machine, or a colon\-separated pair of paths\ \&\(em in which case the first specified path is the source in the host, and the second path is the destination in the virtual machine\&. If the source path is not absolute, it is resolved relative to the current working directory\&. The
291 \fB\-\-bind\-ro=\fR
292 option creates read\-only bind mounts\&. Backslash escapes are interpreted, so
293 "\e:"
294 may be used to embed colons in either path\&. This option may be specified multiple times for creating multiple independent bind mount points\&.
295 .sp
296 Added in version 256\&.
297 .RE
298 .PP
299 \fB\-\-extra\-drive=\fR\fB\fIPATH\fR\fR
300 .RS 4
301 Takes a disk image or block device on the host and supplies it to the virtual machine as another drive\&.
302 .sp
303 Added in version 256\&.
304 .RE
305 .SS "Integration Options"
306 .PP
307 \fB\-\-forward\-journal=\fR\fB\fIFILE|DIR\fR\fR
308 .RS 4
309 Forward the virtual machine\*(Aqs journal to the host\&.
310 \fBsystemd-journal-remote\fR(8)
311 is currently used to receive the guest VM\*(Aqs forwarded journal entries\&. This option determines where this journal is saved on the host and has the same semantics as
312 \fB\-o\fR/\fB\-\-output\fR
313 described in
314 \fBsystemd-journal-remote\fR(8)\&.
315 .sp
316 Added in version 256\&.
317 .RE
318 .PP
319 \fB\-\-pass\-ssh\-key=\fR\fB\fIBOOL\fR\fR
320 .RS 4
321 By default, an SSH key is generated to allow
322 \fBsystemd\-vmspawn\fR
323 to open a D\-Bus connection to the VM\*(Aqs systemd bus\&. Setting this to "no" will disable SSH key generation\&.
324 .sp
325 The generated keys are ephemeral\&. That is they are valid only for the current invocation of
326 \fBsystemd\-vmspawn\fR, and are typically not persisted\&.
327 .sp
328 Added in version 256\&.
329 .RE
330 .PP
331 \fB\-\-ssh\-key\-type=\fR\fB\fITYPE\fR\fR
332 .RS 4
333 Configures the type of SSH key to generate, see
334 \fBssh-keygen\fR(1)
335 for more information\&.
336 .sp
337 By default,
338 "ed25519"
339 keys are generated, however
340 "rsa"
341 keys may also be useful if the VM has a particularly old version of
342 \fBsshd\fR(8)\&.
343 .sp
344 Added in version 256\&.
345 .RE
346 .SS "Input/Output Options"
347 .PP
348 \fB\-\-console=\fR\fB\fIMODE\fR\fR
349 .RS 4
350 Configures how to set up the console of the VM\&. Takes one of
351 "interactive",
352 "read\-only",
353 "native",
354 "gui"\&. Defaults to
355 "interactive"\&.
356 "interactive"
357 provides an interactive terminal interface to the VM\&.
358 "read\-only"
359 is similar, but is strictly read\-only, i\&.e\&. does not accept any input from the user\&.
360 "native"
361 also provides a TTY\-based interface, but uses qemu native implementation (which means the qemu monitor is available)\&.
362 "gui"
363 shows the qemu graphical UI\&.
364 .sp
365 Added in version 256\&.
366 .RE
367 .PP
368 \fB\-\-background=\fR\fB\fICOLOR\fR\fR
369 .RS 4
370 Change the terminal background color to the specified ANSI color as long as the VM runs\&. The color specified should be an ANSI X3\&.64 SGR background color, i\&.e\&. strings such as
371 "40",
372 "41", \&...,
373 "47",
374 "48;2;\&...",
375 "48;5;\&..."\&. See
376 \m[blue]\fBANSI Escape Code (Wikipedia)\fR\m[]\&\s-2\u[2]\d\s+2
377 for details\&. Assign an empty string to disable any coloring\&. This only has an effect in
378 \fB\-\-console=interactive\fR
379 and
380 \fB\-\-console=read\-only\fR
381 modes\&.
382 .sp
383 Added in version 256\&.
384 .RE
385 .SS "Credentials"
386 .PP
387 \fB\-\-load\-credential=\fR\fB\fIID\fR\fR\fB:\fR\fB\fIPATH\fR\fR, \fB\-\-set\-credential=\fR\fB\fIID\fR\fR\fB:\fR\fB\fIVALUE\fR\fR
388 .RS 4
389 Pass a credential to the virtual machine\&. These two options correspond to the
390 \fILoadCredential=\fR
391 and
392 \fISetCredential=\fR
393 settings in unit files\&. See
394 \fBsystemd.exec\fR(5)
395 for details about these concepts, as well as the syntax of the option\*(Aqs arguments\&.
396 .sp
397 In order to embed binary data into the credential data for
398 \fB\-\-set\-credential=\fR, use C\-style escaping (i\&.e\&.
399 "\en"
400 to embed a newline, or
401 "\ex00"
402 to embed a
403 \fBNUL\fR
404 byte)\&. Note that the invoking shell might already apply unescaping once, hence this might require double escaping!
405 .sp
406 Added in version 255\&.
407 .RE
408 .SS "Other"
409 .PP
410 \fB\-\-no\-pager\fR
411 .RS 4
412 Do not pipe output into a pager\&.
413 .RE
414 .PP
415 \fB\-h\fR, \fB\-\-help\fR
416 .RS 4
417 Print a short help text and exit\&.
418 .RE
419 .PP
420 \fB\-\-version\fR
421 .RS 4
422 Print a short version string and exit\&.
423 .RE
424 .SH "ENVIRONMENT"
425 .PP
426 \fI$SYSTEMD_LOG_LEVEL\fR
427 .RS 4
428 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)
429 \fBemerg\fR,
430 \fBalert\fR,
431 \fBcrit\fR,
432 \fBerr\fR,
433 \fBwarning\fR,
434 \fBnotice\fR,
435 \fBinfo\fR,
436 \fBdebug\fR, or an integer in the range 0\&...7\&. See
437 \fBsyslog\fR(3)
438 for more information\&. Each value may optionally be prefixed with one of
439 \fBconsole\fR,
440 \fBsyslog\fR,
441 \fBkmsg\fR
442 or
443 \fBjournal\fR
444 followed by a colon to set the maximum log level for that specific log target (e\&.g\&.
445 \fBSYSTEMD_LOG_LEVEL=debug,console:info\fR
446 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\&.
447 .RE
448 .PP
449 \fI$SYSTEMD_LOG_COLOR\fR
450 .RS 4
451 A boolean\&. If true, messages written to the tty will be colored according to priority\&.
452 .sp
453 This setting is only useful when messages are written directly to the terminal, because
454 \fBjournalctl\fR(1)
455 and other tools that display logs will color messages based on the log level on their own\&.
456 .RE
457 .PP
458 \fI$SYSTEMD_LOG_TIME\fR
459 .RS 4
460 A boolean\&. If true, console log messages will be prefixed with a timestamp\&.
461 .sp
462 This setting is only useful when messages are written directly to the terminal or a file, because
463 \fBjournalctl\fR(1)
464 and other tools that display logs will attach timestamps based on the entry metadata on their own\&.
465 .RE
466 .PP
467 \fI$SYSTEMD_LOG_LOCATION\fR
468 .RS 4
469 A boolean\&. If true, messages will be prefixed with a filename and line number in the source code where the message originates\&.
470 .sp
471 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\&.
472 .RE
473 .PP
474 \fI$SYSTEMD_LOG_TID\fR
475 .RS 4
476 A boolean\&. If true, messages will be prefixed with the current numerical thread ID (TID)\&.
477 .sp
478 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\&.
479 .RE
480 .PP
481 \fI$SYSTEMD_LOG_TARGET\fR
482 .RS 4
483 The destination for log messages\&. One of
484 \fBconsole\fR
485 (log to the attached tty),
486 \fBconsole\-prefixed\fR
487 (log to the attached tty but with prefixes encoding the log level and "facility", see
488 \fBsyslog\fR(3),
489 \fBkmsg\fR
490 (log to the kernel circular log buffer),
491 \fBjournal\fR
492 (log to the journal),
493 \fBjournal\-or\-kmsg\fR
494 (log to the journal if available, and to kmsg otherwise),
495 \fBauto\fR
496 (determine the appropriate log target automatically, the default),
497 \fBnull\fR
498 (disable log output)\&.
499 .RE
500 .PP
501 \fI$SYSTEMD_LOG_RATELIMIT_KMSG\fR
502 .RS 4
503 Whether to ratelimit kmsg or not\&. Takes a boolean\&. Defaults to
504 "true"\&. If disabled, systemd will not ratelimit messages written to kmsg\&.
505 .RE
506 .PP
507 \fI$SYSTEMD_PAGER\fR, \fI$PAGER\fR
508 .RS 4
509 Pager to use when
510 \fB\-\-no\-pager\fR
511 is not given\&.
512 \fI$SYSTEMD_PAGER\fR
513 is used if set; otherwise
514 \fI$PAGER\fR
515 is used\&. If neither
516 \fI$SYSTEMD_PAGER\fR
517 nor
518 \fI$PAGER\fR
519 are set, a set of well\-known pager implementations is tried in turn, including
520 \fBless\fR(1)
521 and
522 \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
523 "cat"
524 is equivalent to passing
525 \fB\-\-no\-pager\fR\&.
526 .sp
527 Note: if
528 \fI$SYSTEMD_PAGERSECURE\fR
529 is not set,
530 \fI$SYSTEMD_PAGER\fR
531 and
532 \fI$PAGER\fR
533 can only be used to disable the pager (with
534 "cat"
535 or
536 ""), and are otherwise ignored\&.
537 .RE
538 .PP
539 \fI$SYSTEMD_LESS\fR
540 .RS 4
541 Override the options passed to
542 \fBless\fR
543 (by default
544 "FRSXMK")\&.
545 .sp
546 Users might want to change two options in particular:
547 .PP
548 \fBK\fR
549 .RS 4
550 This option instructs the pager to exit immediately when
551 Ctrl+C
552 is pressed\&. To allow
553 \fBless\fR
554 to handle
555 Ctrl+C
556 itself to switch back to the pager command prompt, unset this option\&.
557 .sp
558 If the value of
559 \fI$SYSTEMD_LESS\fR
560 does not include
561 "K", and the pager that is invoked is
562 \fBless\fR,
563 Ctrl+C
564 will be ignored by the executable, and needs to be handled by the pager\&.
565 .RE
566 .PP
567 \fBX\fR
568 .RS 4
569 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\&.
570 .RE
571 .sp
572 Note that setting the regular
573 \fI$LESS\fR
574 environment variable has no effect for
575 \fBless\fR
576 invocations by systemd tools\&.
577 .sp
578 See
579 \fBless\fR(1)
580 for more discussion\&.
581 .RE
582 .PP
583 \fI$SYSTEMD_LESSCHARSET\fR
584 .RS 4
585 Override the charset passed to
586 \fBless\fR
587 (by default
588 "utf\-8", if the invoking terminal is determined to be UTF\-8 compatible)\&.
589 .sp
590 Note that setting the regular
591 \fI$LESSCHARSET\fR
592 environment variable has no effect for
593 \fBless\fR
594 invocations by systemd tools\&.
595 .RE
596 .PP
597 \fI$SYSTEMD_PAGERSECURE\fR
598 .RS 4
599 Common pager commands like
600 \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
601 \fBsudo\fR(8)
602 or
603 \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,
604 \fIif the pager supports that\fR
605 (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
606 \fB\-\-no\-pager\fR
607 or
608 \fIPAGER=cat\fR
609 when allowing untrusted users to execute commands with elevated privileges\&.
610 .sp
611 This option takes a boolean argument\&. When set to true, the "secure mode" of the pager is enabled\&. In "secure mode",
612 \fBLESSSECURE=1\fR
613 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
614 \fBless\fR(1)
615 is known to understand this variable and implement "secure mode"\&.
616 .sp
617 When set to false, no limitation is placed on the pager\&. Setting
618 \fISYSTEMD_PAGERSECURE=0\fR
619 or not removing it from the inherited environment may allow the user to invoke arbitrary commands\&.
620 .sp
621 When
622 \fI$SYSTEMD_PAGERSECURE\fR
623 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
624 \fBgeteuid\fR(2)
625 and
626 \fBsd_pid_get_owner_uid\fR(3), or when running under
627 \fBsudo\fR(8)
628 or similar tools (\fI$SUDO_UID\fR
629 is set
630 \&\s-2\u[3]\d\s+2)\&. In those cases,
631 \fISYSTEMD_PAGERSECURE=1\fR
632 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
633 \fI$SYSTEMD_PAGERSECURE\fR
634 or disable the pager\&.
635 .sp
636 Note that if the
637 \fI$SYSTEMD_PAGER\fR
638 or
639 \fI$PAGER\fR
640 variables are to be honoured, other than to disable the pager,
641 \fI$SYSTEMD_PAGERSECURE\fR
642 must be set too\&.
643 .RE
644 .PP
645 \fI$SYSTEMD_COLORS\fR
646 .RS 4
647 Takes a boolean argument\&. When true,
648 \fBsystemd\fR
649 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:
650 "16",
651 "256"
652 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
653 \fI$TERM\fR
654 and what the console is connected to\&.
655 .RE
656 .PP
657 \fI$SYSTEMD_URLIFY\fR
658 .RS 4
659 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
660 \fBsystemd\fR
661 makes based on
662 \fI$TERM\fR
663 and other conditions\&.
664 .RE
665 .SH "EXAMPLES"
666 .PP
667 \fBExample\ \&1.\ \&Run an Arch Linux VM image generated by mkosi\fR
668 .sp
669 .if n \{\
670 .RS 4
671 .\}
672 .nf
673 $ mkosi \-d arch \-p systemd \-p linux \-\-autologin \-o image\&.raw \-f build
674 $ systemd\-vmspawn \-\-image=image\&.raw
675 .fi
676 .if n \{\
677 .RE
678 .\}
679 .PP
680 \fBExample\ \&2.\ \&Import and run a Fedora 43 Cloud image using machinectl\fR
681 .sp
682 .if n \{\
683 .RS 4
684 .\}
685 .nf
686 $ curl \-L \e
687 \-O https://download\&.fedoraproject\&.org/pub/fedora/linux/releases/43/Cloud/x86_64/images/Fedora\-Cloud\-Base\-43\-1\&.6\&.x86_64\&.raw\&.xz \e
688 \-O https://download\&.fedoraproject\&.org/pub/fedora/linux/releases/43/Cloud/x86_64/images/Fedora\-Cloud\-43\-1\&.6\-x86_64\-CHECKSUM \e
689 \-O https://fedoraproject\&.org/fedora\&.gpg
690 $ gpgv \-\-keyring \&./fedora\&.gpg Fedora\-Cloud\-43\-1\&.6\-x86_64\-CHECKSUM
691 $ sha256sum \-c Fedora\-Cloud\-43\-1\&.6\-x86_64\-CHECKSUM
692 # machinectl import\-raw Fedora\-Cloud\-Base\-43\-1\&.6\&.x86_64\&.raw\&.xz fedora\-43\-cloud
693 # systemd\-vmspawn \-M fedora\-43\-cloud
694 .fi
695 .if n \{\
696 .RE
697 .\}
698 .PP
699 \fBExample\ \&3.\ \&Build and run systemd\*(Aqs system image and forward the VM\*(Aqs journal to a local file\fR
700 .sp
701 .if n \{\
702 .RS 4
703 .\}
704 .nf
705 $ mkosi build
706 $ systemd\-vmspawn \e
707 \-D mkosi\&.output/system \e
708 \-\-private\-users $(grep $(whoami) /etc/subuid | cut \-d: \-f2) \e
709 \-\-linux mkosi\&.output/system\&.efi \e
710 \-\-forward\-journal=vm\&.journal \e
711 enforcing=0
712 .fi
713 .if n \{\
714 .RE
715 .\}
716 .PP
717 Note: this example also uses a kernel command line argument to ensure SELinux is not started in enforcing mode\&.
718 .PP
719 \fBExample\ \&4.\ \&SSH into a running VM using systemd\-ssh\-proxy\fR
720 .sp
721 .if n \{\
722 .RS 4
723 .\}
724 .nf
725 $ mkosi build
726 $ my_vsock_cid=3735928559
727 $ systemd\-vmspawn \e
728 \-D mkosi\&.output/system \e
729 \-\-private\-users $(grep $(whoami) /etc/subuid | cut \-d: \-f2) \e
730 \-\-linux mkosi\&.output/system\&.efi \e
731 \-\-vsock\-cid $my_vsock_cid \e
732 enforcing=0
733 $ ssh root@vsock/$my_vsock_cid \-i /run/user/$UID/systemd/vmspawn/machine\-*\-system\-ed25519
734 .fi
735 .if n \{\
736 .RE
737 .\}
738 .SH "EXIT STATUS"
739 .PP
740 If an error occurred the value errno is propagated to the return code\&. If EXIT_STATUS is supplied by the running image that is returned\&. Otherwise, EXIT_SUCCESS is returned\&.
741 .SH "SEE ALSO"
742 .PP
743 \fBsystemd\fR(1), \fBmkosi\fR(1), \fBmachinectl\fR(1), \fBimportctl\fR(1), \m[blue]\fBBoot Loader Specification\fR\m[]\&\s-2\u[1]\d\s+2
744 .SH "NOTES"
745 .IP " 1." 4
746 Boot Loader Specification
747 .RS 4
748 \%https://uapi-group.org/specifications/specs/boot_loader_specification
749 .RE
750 .IP " 2." 4
751 ANSI Escape Code (Wikipedia)
752 .RS 4
753 \%https://en.wikipedia.org/wiki/ANSI_escape_code#SGR_(Select_Graphic_Rendition)_parameters
754 .RE
755 .IP " 3." 4
756 It is recommended for other tools to set and check
757 \fI$SUDO_UID\fR
758 as appropriate, treating it is a common interface.
759