Debian Codegraph @

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

raw
1 '\" t
2 .TH "SYSTEMD\-VMSPAWN" "1" "" "systemd 258.7" "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 Added in version 256\&.
151 .RE
152 .PP
153 \fB\-\-tpm\-state=\fR\fB\fIPATH\fR\fR\fB|auto|off\fR
154 .RS 4
155 Configures where to place TPM state, in case TPM support is enabled (see
156 \fB\-\-tpm=\fR
157 above)\&. This takes an absolute file system path to a directory to persistently place the state in\&. If the directory is missing it is created as needed\&. If set to the special string
158 "auto"
159 a persistent path is automatically derived from the VM image path or directory path, with the
160 "\&.tpmstate"
161 suffix appended\&. If set to the special string
162 "off"
163 the TPM state is only maintained transiently and flushed out when the VM shuts down\&. This mode is not suitable for VMs which lock disk encryption keys to the TPM, as these keys will be lost on every reboot\&. Defaults to
164 "auto"\&.
165 .sp
166 Added in version 258\&.
167 .RE
168 .PP
169 \fB\-\-linux=\fR\fB\fIPATH\fR\fR
170 .RS 4
171 Set the linux kernel image to use for direct kernel boot\&. If a directory type image is used and
172 \fB\-\-linux=\fR
173 was omitted, vmspawn will search for boot loader entries according to the
174 \m[blue]\fBBoot Loader Specification\fR\m[]\&\s-2\u[1]\d\s+2
175 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\&.
176 .sp
177 Added in version 256\&.
178 .RE
179 .PP
180 \fB\-\-initrd=\fR\fB\fIPATH\fR\fR
181 .RS 4
182 Set the initrd to use for direct kernel boot\&. If the
183 \fB\-\-linux=\fR
184 supplied is a
185 \m[blue]\fBBoot Loader Specification\fR\m[]\&\s-2\u[1]\d\s+2
186 Type #2 entry, then this argument is not required\&. If no initrd was installed into the image then the image will fail to boot\&.
187 .sp
188 \fB\-\-initrd=\fR
189 can be specified multiple times and vmspawn will merge them together\&.
190 .sp
191 Added in version 256\&.
192 .RE
193 .PP
194 \fB\-n\fR, \fB\-\-network\-tap\fR
195 .RS 4
196 Create a TAP device to network with the virtual machine\&.
197 .sp
198 Note: root privileges are required to use TAP networking\&. Additionally,
199 \fBsystemd-networkd\fR(8)
200 must be running and correctly set up on the host to provision the host interface\&. The relevant
201 "\&.network"
202 file can be found at
203 /usr/lib/systemd/network/80\-vm\-vt\&.network\&.
204 .sp
205 Added in version 255\&.
206 .RE
207 .PP
208 \fB\-\-network\-user\-mode\fR
209 .RS 4
210 Use user mode networking\&.
211 .sp
212 Added in version 255\&.
213 .RE
214 .PP
215 \fB\-\-firmware=\fR\fB\fIPATH\fR\fR
216 .RS 4
217 Takes an absolute path, or a relative path beginning with
218 \&./\&. 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
219 "list"
220 is specified lists all discovered firmwares\&.
221 .sp
222 Added in version 256\&.
223 .RE
224 .PP
225 \fB\-\-discard\-disk=\fR\fB\fIBOOL\fR\fR
226 .RS 4
227 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\&.
228 .sp
229 Added in version 256\&.
230 .RE
231 .PP
232 \fB\-\-secure\-boot=\fR\fB\fIBOOL\fR\fR
233 .RS 4
234 Configure whether to search for firmware which supports Secure Boot\&.
235 .sp
236 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\&.
237 .sp
238 Added in version 255\&.
239 .RE
240 .PP
241 \fB\-\-grow\-image=\fR\fB\fIBYTES\fR\fR, \fB\-G \fR\fB\fIBYTES\fR\fR
242 .RS 4
243 Grows the image file specified by
244 \fB\-\-image=\fR
245 to the specified size in bytes if it is smaller\&. Executes no operation if no image file is used or the image file is already as large or larger than requested\&. The specified size accepts the usual K, M, G suffixes (to the base of 1024)\&. Specified values are rounded up to multiples of 4096\&.
246 .sp
247 Added in version 258\&.
248 .RE
249 .PP
250 \fB\-\-smbios11=\fR\fB\fISTRING\fR\fR, \fB\-s \fR\fB\fISTRING\fR\fR
251 .RS 4
252 Passes the specified string into the VM as an SMBIOS Type #11 vendor string\&. This is useful to parameterize the invoked VM in various ways\&. See
253 \fBsmbios-type-11\fR(7)
254 for details\&.
255 .sp
256 Added in version 258\&.
257 .RE
258 .PP
259 \fB\-\-notify\-ready=\fR
260 .RS 4
261 Configures support for notifications from the VM\*(Aqs init process to
262 \fBsystemd\-vmspawn\fR\&. If true,
263 \fBsystemd\-vmspawn\fR
264 will consider the machine as ready only when it has received a
265 "READY=1"
266 message from the init process in the VM\&. If false,
267 \fBsystemd\-vmspawn\fR
268 will consider the machine as ready immediately after creation\&. In either case,
269 \fBsystemd\-vmspawn\fR
270 sends its own readiness notification to its manager after the spawned VM is ready\&. For more details about notifications see
271 \fBsd_notify\fR(3)\&.
272 .sp
273 Defaults to true\&. (Note that this is unlike the option of the same name to
274 \fBsystemd-nspawn\fR(1)
275 that defaults to false\&.)
276 .sp
277 Added in version 258\&.
278 .RE
279 .SS "System Identity Options"
280 .PP
281 \fB\-M\fR, \fB\-\-machine=\fR
282 .RS 4
283 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
284 \fBmachinectl\fR(1)
285 and similar)\&.
286 .sp
287 Added in version 255\&.
288 .RE
289 .PP
290 \fB\-\-uuid=\fR
291 .RS 4
292 Set the specified UUID for the virtual machine\&. The init system will initialize
293 /etc/machine\-id
294 from this if this file is not set yet\&. Note that this option takes effect only if
295 /etc/machine\-id
296 in the virtual machine is unpopulated\&.
297 .sp
298 Added in version 256\&.
299 .RE
300 .SS "Property Options"
301 .PP
302 \fB\-S\fR, \fB\-\-slice=\fR
303 .RS 4
304 Make the VM part of the specified slice, instead of the default
305 machine\&.slice\&. This applies only if the machine is run in its own scope unit, i\&.e\&. if
306 \fB\-\-keep\-unit\fR
307 is not used\&.
308 .sp
309 Added in version 258\&.
310 .RE
311 .PP
312 \fB\-\-property=\fR
313 .RS 4
314 Set a unit property on the scope unit to register for the machine\&. This applies only if the machine is run in its own scope unit, i\&.e\&. if
315 \fB\-\-keep\-unit\fR
316 is not used\&. Takes unit property assignments in the same format as
317 \fBsystemctl set\-property\fR\&. This is useful to set memory limits and similar for the VM\&.
318 .sp
319 Added in version 258\&.
320 .RE
321 .PP
322 \fB\-\-register=\fR
323 .RS 4
324 Controls whether the virtual machine is registered with
325 \fBsystemd-machined\fR(8)\&. Takes a boolean argument, which defaults to
326 "yes"
327 when running as root, and
328 "no"
329 when running as a regular user\&. This ensures that the virtual machine is accessible via
330 \fBmachinectl\fR(1)\&.
331 .sp
332 Note: root privileges are required to use this option as registering with
333 \fBsystemd-machined\fR(8)
334 requires privileged D\-Bus method calls\&.
335 .sp
336 Added in version 256\&.
337 .RE
338 .SS "User Namespacing Options"
339 .PP
340 \fB\-\-private\-users=\fR\fB\fIUID_SHIFT[:UID_RANGE]\fR\fR
341 .RS 4
342 Controls user namespacing under
343 \fB\-\-directory=\fR\&. If enabled,
344 \fBvirtiofsd\fR(1)
345 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)\&.
346 .sp
347 If one or two colon\-separated numbers are specified, user namespacing is turned on\&.
348 \fIUID_SHIFT\fR
349 specifies the first host UID/GID to map,
350 \fIUID_RANGE\fR
351 is optional and specifies number of host UIDs/GIDs to assign to the virtual machine\&. If
352 \fIUID_RANGE\fR
353 is omitted, 65536 UIDs/GIDs are assigned\&.
354 .sp
355 When user namespaces are used, the GID range assigned to each virtual machine is always chosen identical to the UID range\&.
356 .sp
357 Added in version 256\&.
358 .RE
359 .SS "Mount Options"
360 .PP
361 \fB\-\-bind=\fR\fB\fIPATH\fR\fR, \fB\-\-bind\-ro=\fR\fB\fIPATH\fR\fR
362 .RS 4
363 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
364 \fB\-\-bind\-ro=\fR
365 option creates read\-only bind mounts\&. Backslash escapes are interpreted, so
366 "\e:"
367 may be used to embed colons in either path\&. This option may be specified multiple times for creating multiple independent bind mount points\&.
368 .sp
369 Added in version 256\&.
370 .RE
371 .PP
372 \fB\-\-extra\-drive=\fR\fB\fIPATH\fR\fR
373 .RS 4
374 Takes a disk image or block device on the host and supplies it to the virtual machine as another drive\&.
375 .sp
376 Added in version 256\&.
377 .RE
378 .SS "Integration Options"
379 .PP
380 \fB\-\-forward\-journal=\fR\fB\fIFILE|DIR\fR\fR
381 .RS 4
382 Forward the virtual machine\*(Aqs journal to the host\&.
383 \fBsystemd-journal-remote\fR(8)
384 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
385 \fB\-o\fR/\fB\-\-output\fR
386 described in
387 \fBsystemd-journal-remote\fR(8)\&.
388 .sp
389 Added in version 256\&.
390 .RE
391 .PP
392 \fB\-\-pass\-ssh\-key=\fR\fB\fIBOOL\fR\fR
393 .RS 4
394 By default, an SSH key is generated to allow
395 \fBsystemd\-vmspawn\fR
396 to open a D\-Bus connection to the VM\*(Aqs systemd bus\&. Setting this to "no" will disable SSH key generation\&.
397 .sp
398 The generated keys are ephemeral\&. That is they are valid only for the current invocation of
399 \fBsystemd\-vmspawn\fR, and are typically not persisted\&.
400 .sp
401 Added in version 256\&.
402 .RE
403 .PP
404 \fB\-\-ssh\-key\-type=\fR\fB\fITYPE\fR\fR
405 .RS 4
406 Configures the type of SSH key to generate, see
407 \fBssh-keygen\fR(1)
408 for more information\&.
409 .sp
410 By default,
411 "ed25519"
412 keys are generated, however
413 "rsa"
414 keys may also be useful if the VM has a particularly old version of
415 \fBsshd\fR(8)\&.
416 .sp
417 Added in version 256\&.
418 .RE
419 .SS "Input/Output Options"
420 .PP
421 \fB\-\-console=\fR\fB\fIMODE\fR\fR
422 .RS 4
423 Configures how to set up the console of the VM\&. Takes one of
424 "interactive",
425 "read\-only",
426 "native",
427 "gui"\&. Defaults to
428 "interactive"\&.
429 "interactive"
430 provides an interactive terminal interface to the VM\&.
431 "read\-only"
432 is similar, but is strictly read\-only, i\&.e\&. does not accept any input from the user\&.
433 "native"
434 also provides a TTY\-based interface, but uses qemu native implementation (which means the qemu monitor is available)\&.
435 "gui"
436 shows the qemu graphical UI\&.
437 .sp
438 Added in version 256\&.
439 .RE
440 .PP
441 \fB\-\-background=\fR\fB\fICOLOR\fR\fR
442 .RS 4
443 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
444 "40",
445 "41", \&...,
446 "47",
447 "48;2;\&...",
448 "48;5;\&..."\&. See
449 \m[blue]\fBANSI Escape Code (Wikipedia)\fR\m[]\&\s-2\u[2]\d\s+2
450 for details\&. Assign an empty string to disable any coloring\&. This only has an effect in
451 \fB\-\-console=interactive\fR
452 and
453 \fB\-\-console=read\-only\fR
454 modes\&.
455 .sp
456 Added in version 256\&.
457 .RE
458 .SS "Credentials"
459 .PP
460 \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
461 .RS 4
462 Pass a credential to the virtual machine\&. These two options correspond to the
463 \fILoadCredential=\fR
464 and
465 \fISetCredential=\fR
466 settings in unit files\&. See
467 \fBsystemd.exec\fR(5)
468 for details about these concepts, as well as the syntax of the option\*(Aqs arguments\&.
469 .sp
470 In order to embed binary data into the credential data for
471 \fB\-\-set\-credential=\fR, use C\-style escaping (i\&.e\&.
472 "\en"
473 to embed a newline, or
474 "\ex00"
475 to embed a
476 \fBNUL\fR
477 byte)\&. Note that the invoking shell might already apply unescaping once, hence this might require double escaping!
478 .sp
479 Added in version 255\&.
480 .RE
481 .SS "Other"
482 .PP
483 \fB\-\-no\-pager\fR
484 .RS 4
485 Do not pipe output into a pager\&.
486 .RE
487 .PP
488 \fB\-h\fR, \fB\-\-help\fR
489 .RS 4
490 Print a short help text and exit\&.
491 .RE
492 .PP
493 \fB\-\-version\fR
494 .RS 4
495 Print a short version string and exit\&.
496 .RE
497 .PP
498 \fB\-\-no\-ask\-password\fR
499 .RS 4
500 Do not query the user for authentication for privileged operations\&.
501 .RE
502 .SH "ENVIRONMENT"
503 .PP
504 \fI$SYSTEMD_LOG_LEVEL\fR
505 .RS 4
506 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)
507 \fBemerg\fR,
508 \fBalert\fR,
509 \fBcrit\fR,
510 \fBerr\fR,
511 \fBwarning\fR,
512 \fBnotice\fR,
513 \fBinfo\fR,
514 \fBdebug\fR, or an integer in the range 0\&...7\&. See
515 \fBsyslog\fR(3)
516 for more information\&. Each value may optionally be prefixed with one of
517 \fBconsole\fR,
518 \fBsyslog\fR,
519 \fBkmsg\fR
520 or
521 \fBjournal\fR
522 followed by a colon to set the maximum log level for that specific log target (e\&.g\&.
523 \fBSYSTEMD_LOG_LEVEL=debug,console:info\fR
524 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\&.
525 .RE
526 .PP
527 \fI$SYSTEMD_LOG_COLOR\fR
528 .RS 4
529 A boolean\&. If true, messages written to the tty will be colored according to priority\&.
530 .sp
531 This setting is only useful when messages are written directly to the terminal, because
532 \fBjournalctl\fR(1)
533 and other tools that display logs will color messages based on the log level on their own\&.
534 .RE
535 .PP
536 \fI$SYSTEMD_LOG_TIME\fR
537 .RS 4
538 A boolean\&. If true, console log messages will be prefixed with a timestamp\&.
539 .sp
540 This setting is only useful when messages are written directly to the terminal or a file, because
541 \fBjournalctl\fR(1)
542 and other tools that display logs will attach timestamps based on the entry metadata on their own\&.
543 .RE
544 .PP
545 \fI$SYSTEMD_LOG_LOCATION\fR
546 .RS 4
547 A boolean\&. If true, messages will be prefixed with a filename and line number in the source code where the message originates\&.
548 .sp
549 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\&.
550 .RE
551 .PP
552 \fI$SYSTEMD_LOG_TID\fR
553 .RS 4
554 A boolean\&. If true, messages will be prefixed with the current numerical thread ID (TID)\&.
555 .sp
556 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\&.
557 .RE
558 .PP
559 \fI$SYSTEMD_LOG_TARGET\fR
560 .RS 4
561 The destination for log messages\&. One of
562 \fBconsole\fR
563 (log to the attached tty),
564 \fBconsole\-prefixed\fR
565 (log to the attached tty but with prefixes encoding the log level and "facility", see
566 \fBsyslog\fR(3),
567 \fBkmsg\fR
568 (log to the kernel circular log buffer),
569 \fBjournal\fR
570 (log to the journal),
571 \fBjournal\-or\-kmsg\fR
572 (log to the journal if available, and to kmsg otherwise),
573 \fBauto\fR
574 (determine the appropriate log target automatically, the default),
575 \fBnull\fR
576 (disable log output)\&.
577 .RE
578 .PP
579 \fI$SYSTEMD_LOG_RATELIMIT_KMSG\fR
580 .RS 4
581 Whether to ratelimit kmsg or not\&. Takes a boolean\&. Defaults to
582 "true"\&. If disabled, systemd will not ratelimit messages written to kmsg\&.
583 .RE
584 .PP
585 \fI$SYSTEMD_PAGER\fR, \fI$PAGER\fR
586 .RS 4
587 Pager to use when
588 \fB\-\-no\-pager\fR
589 is not given\&.
590 \fI$SYSTEMD_PAGER\fR
591 is used if set; otherwise
592 \fI$PAGER\fR
593 is used\&. If neither
594 \fI$SYSTEMD_PAGER\fR
595 nor
596 \fI$PAGER\fR
597 are set, a set of well\-known pager implementations is tried in turn, including
598 \fBless\fR(1)
599 and
600 \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
601 "cat"
602 is equivalent to passing
603 \fB\-\-no\-pager\fR\&.
604 .sp
605 Note: if
606 \fI$SYSTEMD_PAGERSECURE\fR
607 is not set,
608 \fI$SYSTEMD_PAGER\fR
609 and
610 \fI$PAGER\fR
611 can only be used to disable the pager (with
612 "cat"
613 or
614 ""), and are otherwise ignored\&.
615 .RE
616 .PP
617 \fI$SYSTEMD_LESS\fR
618 .RS 4
619 Override the options passed to
620 \fBless\fR
621 (by default
622 "FRSXMK")\&.
623 .sp
624 Users might want to change two options in particular:
625 .PP
626 \fBK\fR
627 .RS 4
628 This option instructs the pager to exit immediately when
629 Ctrl+C
630 is pressed\&. To allow
631 \fBless\fR
632 to handle
633 Ctrl+C
634 itself to switch back to the pager command prompt, unset this option\&.
635 .sp
636 If the value of
637 \fI$SYSTEMD_LESS\fR
638 does not include
639 "K", and the pager that is invoked is
640 \fBless\fR,
641 Ctrl+C
642 will be ignored by the executable, and needs to be handled by the pager\&.
643 .RE
644 .PP
645 \fBX\fR
646 .RS 4
647 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\&.
648 .RE
649 .sp
650 Note that setting the regular
651 \fI$LESS\fR
652 environment variable has no effect for
653 \fBless\fR
654 invocations by systemd tools\&.
655 .sp
656 See
657 \fBless\fR(1)
658 for more discussion\&.
659 .RE
660 .PP
661 \fI$SYSTEMD_LESSCHARSET\fR
662 .RS 4
663 Override the charset passed to
664 \fBless\fR
665 (by default
666 "utf\-8", if the invoking terminal is determined to be UTF\-8 compatible)\&.
667 .sp
668 Note that setting the regular
669 \fI$LESSCHARSET\fR
670 environment variable has no effect for
671 \fBless\fR
672 invocations by systemd tools\&.
673 .RE
674 .PP
675 \fI$SYSTEMD_PAGERSECURE\fR
676 .RS 4
677 Common pager commands like
678 \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
679 \fBsudo\fR(8)
680 or
681 \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,
682 \fIif the pager supports that\fR
683 (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
684 \fB\-\-no\-pager\fR
685 or
686 \fIPAGER=cat\fR
687 when allowing untrusted users to execute commands with elevated privileges\&.
688 .sp
689 This option takes a boolean argument\&. When set to true, the "secure mode" of the pager is enabled\&. In "secure mode",
690 \fBLESSSECURE=1\fR
691 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
692 \fBless\fR(1)
693 is known to understand this variable and implement "secure mode"\&.
694 .sp
695 When set to false, no limitation is placed on the pager\&. Setting
696 \fISYSTEMD_PAGERSECURE=0\fR
697 or not removing it from the inherited environment may allow the user to invoke arbitrary commands\&.
698 .sp
699 When
700 \fI$SYSTEMD_PAGERSECURE\fR
701 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
702 \fBgeteuid\fR(2)
703 and
704 \fBsd_pid_get_owner_uid\fR(3), or when running under
705 \fBsudo\fR(8)
706 or similar tools (\fI$SUDO_UID\fR
707 is set
708 \&\s-2\u[3]\d\s+2)\&. In those cases,
709 \fISYSTEMD_PAGERSECURE=1\fR
710 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
711 \fI$SYSTEMD_PAGERSECURE\fR
712 or disable the pager\&.
713 .sp
714 Note that if the
715 \fI$SYSTEMD_PAGER\fR
716 or
717 \fI$PAGER\fR
718 variables are to be honoured, other than to disable the pager,
719 \fI$SYSTEMD_PAGERSECURE\fR
720 must be set too\&.
721 .RE
722 .PP
723 \fI$SYSTEMD_COLORS\fR
724 .RS 4
725 Takes a boolean argument\&. When true,
726 \fBsystemd\fR
727 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:
728 "16",
729 "256"
730 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
731 \fI$TERM\fR
732 and what the console is connected to\&.
733 .RE
734 .PP
735 \fI$SYSTEMD_URLIFY\fR
736 .RS 4
737 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
738 \fBsystemd\fR
739 makes based on
740 \fI$TERM\fR
741 and other conditions\&.
742 .RE
743 .SH "EXAMPLES"
744 .PP
745 \fBExample\ \&1.\ \&Run an Arch Linux VM image generated by mkosi\fR
746 .sp
747 .if n \{\
748 .RS 4
749 .\}
750 .nf
751 $ mkosi \-d arch \-p systemd \-p linux \-\-autologin \-o image\&.raw \-f build
752 $ systemd\-vmspawn \-\-image=image\&.raw
753 .fi
754 .if n \{\
755 .RE
756 .\}
757 .PP
758 \fBExample\ \&2.\ \&Import and run a Fedora 43 Cloud image using machinectl\fR
759 .sp
760 .if n \{\
761 .RS 4
762 .\}
763 .nf
764 $ curl \-L \e
765 \-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
766 \-O https://download\&.fedoraproject\&.org/pub/fedora/linux/releases/43/Cloud/x86_64/images/Fedora\-Cloud\-43\-1\&.6\-x86_64\-CHECKSUM \e
767 \-O https://fedoraproject\&.org/fedora\&.gpg
768 $ gpgv \-\-keyring \&./fedora\&.gpg Fedora\-Cloud\-43\-1\&.6\-x86_64\-CHECKSUM
769 $ sha256sum \-c Fedora\-Cloud\-43\-1\&.6\-x86_64\-CHECKSUM
770 # machinectl import\-raw Fedora\-Cloud\-Base\-43\-1\&.6\&.x86_64\&.raw\&.xz fedora\-43\-cloud
771 # systemd\-vmspawn \-M fedora\-43\-cloud
772 .fi
773 .if n \{\
774 .RE
775 .\}
776 .PP
777 \fBExample\ \&3.\ \&Build and run systemd\*(Aqs system image and forward the VM\*(Aqs journal to a local file\fR
778 .sp
779 .if n \{\
780 .RS 4
781 .\}
782 .nf
783 $ mkosi build
784 $ systemd\-vmspawn \e
785 \-D mkosi\&.output/system \e
786 \-\-private\-users $(grep $(whoami) /etc/subuid | cut \-d: \-f2) \e
787 \-\-linux mkosi\&.output/system\&.efi \e
788 \-\-forward\-journal=vm\&.journal \e
789 enforcing=0
790 .fi
791 .if n \{\
792 .RE
793 .\}
794 .PP
795 Note: this example also uses a kernel command line argument to ensure SELinux is not started in enforcing mode\&.
796 .PP
797 \fBExample\ \&4.\ \&SSH into a running VM using systemd\-ssh\-proxy\fR
798 .sp
799 .if n \{\
800 .RS 4
801 .\}
802 .nf
803 $ mkosi build
804 $ my_vsock_cid=3735928559
805 $ systemd\-vmspawn \e
806 \-D mkosi\&.output/system \e
807 \-\-private\-users $(grep $(whoami) /etc/subuid | cut \-d: \-f2) \e
808 \-\-linux mkosi\&.output/system\&.efi \e
809 \-\-vsock\-cid $my_vsock_cid \e
810 enforcing=0
811 $ ssh root@vsock/$my_vsock_cid \-i /run/user/$UID/systemd/vmspawn/machine\-*\-system\-ed25519
812 .fi
813 .if n \{\
814 .RE
815 .\}
816 .SH "EXIT STATUS"
817 .PP
818 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\&.
819 .SH "SEE ALSO"
820 .PP
821 \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
822 .SH "NOTES"
823 .IP " 1." 4
824 Boot Loader Specification
825 .RS 4
826 \%https://uapi-group.org/specifications/specs/boot_loader_specification
827 .RE
828 .IP " 2." 4
829 ANSI Escape Code (Wikipedia)
830 .RS 4
831 \%https://en.wikipedia.org/wiki/ANSI_escape_code#SGR_(Select_Graphic_Rendition)_parameters
832 .RE
833 .IP " 3." 4
834 It is recommended for other tools to set and check
835 \fI$SUDO_UID\fR
836 as appropriate, treating it is a common interface.
837