Debian Codegraph @

upstream/debian-unstable/man1/machinectl.1

raw
1 '\" t
2 .TH "MACHINECTL" "1" "" "systemd 261~rc3" "machinectl"
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 machinectl \- Control the systemd machine manager
24 .SH "SYNOPSIS"
25 .HP \w'\fBmachinectl\fR\ 'u
26 \fBmachinectl\fR [OPTIONS...] {COMMAND} [NAME...]
27 .SH "DESCRIPTION"
28 .PP
29 \fBmachinectl\fR
30 may be used to introspect and control the state of the
31 \fBsystemd\fR(1)
32 virtual machine and container registration manager
33 \fBsystemd-machined.service\fR(8)\&.
34 .PP
35 \fBmachinectl\fR
36 may be used to execute operations on machines and images\&. Machines in this sense are considered running instances of:
37 .sp
38 .RS 4
39 .ie n \{\
40 \h'-04'\(bu\h'+03'\c
41 .\}
42 .el \{\
43 .sp -1
44 .IP \(bu 2.3
45 .\}
46 Virtual Machines (VMs) that virtualize hardware to run full operating system (OS) instances (including their kernels) in a virtualized environment on top of the host OS\&.
47 .RE
48 .sp
49 .RS 4
50 .ie n \{\
51 \h'-04'\(bu\h'+03'\c
52 .\}
53 .el \{\
54 .sp -1
55 .IP \(bu 2.3
56 .\}
57 Containers that share the hardware and OS kernel with the host OS, in order to run OS userspace instances on top the host OS\&.
58 .RE
59 .sp
60 .RS 4
61 .ie n \{\
62 \h'-04'\(bu\h'+03'\c
63 .\}
64 .el \{\
65 .sp -1
66 .IP \(bu 2.3
67 .\}
68 The host system itself\&.
69 .RE
70 .PP
71 Machines are identified by names that follow the same rules as UNIX and DNS hostnames\&. For details, see below\&.
72 .PP
73 Machines are instantiated from disk or file system images that frequently\ \&\(em but not necessarily\ \&\(em carry the same name as machines running from them\&. Images in this sense may be:
74 .sp
75 .RS 4
76 .ie n \{\
77 \h'-04'\(bu\h'+03'\c
78 .\}
79 .el \{\
80 .sp -1
81 .IP \(bu 2.3
82 .\}
83 Directory trees containing an OS, including the top\-level directories
84 /usr/,
85 /etc/, and so on\&.
86 .RE
87 .sp
88 .RS 4
89 .ie n \{\
90 \h'-04'\(bu\h'+03'\c
91 .\}
92 .el \{\
93 .sp -1
94 .IP \(bu 2.3
95 .\}
96 btrfs subvolumes containing OS trees, similar to regular directory trees\&.
97 .RE
98 .sp
99 .RS 4
100 .ie n \{\
101 \h'-04'\(bu\h'+03'\c
102 .\}
103 .el \{\
104 .sp -1
105 .IP \(bu 2.3
106 .\}
107 Binary "raw" disk image files containing MBR or GPT partition tables and Linux file systems\&.
108 .RE
109 .sp
110 .RS 4
111 .ie n \{\
112 \h'-04'\(bu\h'+03'\c
113 .\}
114 .el \{\
115 .sp -1
116 .IP \(bu 2.3
117 .\}
118 Similarly, block devices containing MBR or GPT partition tables and file systems\&.
119 .RE
120 .sp
121 .RS 4
122 .ie n \{\
123 \h'-04'\(bu\h'+03'\c
124 .\}
125 .el \{\
126 .sp -1
127 .IP \(bu 2.3
128 .\}
129 The file system tree of the host OS itself\&.
130 .RE
131 .PP
132 Images may be downloaded, imported and exported via the
133 \fBimportctl\fR(1)
134 tool\&.
135 .SH "COMMANDS"
136 .PP
137 The following commands are understood:
138 .SS "Machine Commands"
139 .PP
140 \fBlist\fR
141 .RS 4
142 List currently running (online) virtual machines and containers\&. To enumerate machine images that can be started, use
143 \fBlist\-images\fR
144 (see below)\&. Note that this command hides the special
145 "\&.host"
146 machine by default\&. Use the
147 \fB\-\-all\fR
148 switch to show it\&.
149 .sp
150 Added in version 206\&.
151 .RE
152 .PP
153 \fBstatus\fR \fINAME\fR\&...
154 .RS 4
155 Show runtime status information about one or more virtual machines and containers, followed by the most recent log data from the journal\&. This function is intended to generate human\-readable output\&. If you are looking for computer\-parsable output, use
156 \fBshow\fR
157 instead\&. Note that the log data shown is reported by the virtual machine or container manager, and frequently contains console output of the machine, but not necessarily journal contents of the machine itself\&.
158 .sp
159 Added in version 206\&.
160 .RE
161 .PP
162 \fBshow\fR [\fINAME\fR\&...]
163 .RS 4
164 Show properties of one or more registered virtual machines or containers or the manager itself\&. If no argument is specified, properties of the manager will be shown\&. If a NAME is specified, properties of this virtual machine or container are shown\&. By default, empty properties are suppressed\&. Use
165 \fB\-\-all\fR
166 to show those too\&. To select specific properties to show, use
167 \fB\-\-property=\fR\&. This command is intended to be used whenever computer\-parsable output is required, and does not print the control group tree or journal entries\&. Use
168 \fBstatus\fR
169 if you are looking for formatted human\-readable output\&.
170 .sp
171 Added in version 206\&.
172 .RE
173 .PP
174 \fBstart\fR \fINAME\fR\&...
175 .RS 4
176 Start a container as a system service, using
177 \fBsystemd-nspawn\fR(1)\&. This starts
178 systemd\-nspawn@\&.service, instantiated for the specified machine name, similar to the effect of
179 \fBsystemctl start\fR
180 on the service name\&.
181 \fBsystemd\-nspawn\fR
182 looks for a container image by the specified name in
183 /var/lib/machines/
184 (and other search paths, see below) and runs it\&. Use
185 \fBlist\-images\fR
186 (see below) for listing available container images to start\&.
187 .sp
188 Note that
189 \fBsystemd-machined.service\fR(8)
190 also interfaces with a variety of other container and VM managers,
191 \fBsystemd\-nspawn\fR
192 is just one implementation of it\&. Most of the commands available in
193 \fBmachinectl\fR
194 may be used on containers or VMs controlled by other managers, not just
195 \fBsystemd\-nspawn\fR\&. Starting VMs and container images on those managers requires manager\-specific tools\&.
196 .sp
197 To interactively start a container on the command line with full access to the container\*(Aqs console, please invoke
198 \fBsystemd\-nspawn\fR
199 directly\&. To stop a running container use
200 \fBmachinectl poweroff\fR\&.
201 .sp
202 Added in version 219\&.
203 .RE
204 .PP
205 \fBlogin\fR [\fINAME\fR]
206 .RS 4
207 Open an interactive terminal login session in a container or on the local host\&. If an argument is supplied, it refers to the container machine to connect to\&. If none is specified, or the container name is specified as the empty string, or the special machine name
208 "\&.host"
209 (see below) is specified, the connection is made to the local host instead\&. This will create a TTY connection to a specific container or the local host and asks for the execution of a getty on it\&. Note that this is only supported for containers running
210 \fBsystemd\fR(1)
211 as init system\&.
212 .sp
213 This command will open a full login prompt on the container or the local host, which then asks for username and password\&. Use
214 \fBshell\fR
215 (see below) or
216 \fBsystemd-run\fR(1)
217 with the
218 \fB\-\-machine=\fR
219 switch to directly invoke a single command, either interactively or in the background\&.
220 .sp
221 Added in version 209\&.
222 .RE
223 .PP
224 \fBshell\fR [[\fINAME\fR@]\fINAME\fR [\fIPATH\fR [\fIARGUMENTS\fR\&...]]]
225 .RS 4
226 Open an interactive shell session in a container or on the local host\&. The first argument refers to the container machine to connect to\&. If none is specified, or the machine name is specified as the empty string, or the special machine name
227 "\&.host"
228 (see below) is specified, the connection is made to the local host instead\&. This works similarly to
229 \fBlogin\fR, but immediately invokes a user process\&. This command runs the specified executable with the specified arguments, or the default shell for the user if none is specified, or
230 /bin/sh
231 if no default shell is found\&. By default,
232 \fB\-\-uid=\fR, or by prefixing the machine name with a username and an
233 "@"
234 character, a different user may be selected\&. Use
235 \fB\-\-setenv=\fR
236 to set environment variables for the executed process\&.
237 .sp
238 Note that
239 \fBmachinectl shell\fR
240 does not propagate the exit code/status of the invoked shell process\&. Use
241 \fBsystemd\-run\fR
242 instead if that information is required (see below)\&.
243 .sp
244 Using the
245 \fBshell\fR
246 command without arguments (thus invoking the executed shell or command on the local host), is in many ways similar to a
247 \fBsu\fR(1)
248 session, but, unlike
249 \fBsu\fR, completely isolates the new session from the originating session, so that it shares no process or session properties and is in a clean well\-defined state\&. It will be tracked in a new utmp, login, audit, security, and keyring sessions, and will not inherit any environment variables or resource limits, among other properties\&.
250 .sp
251 Note that
252 \fBsystemd-run\fR(1)
253 with its
254 \fB\-\-machine=\fR
255 switch may be used in place of the
256 \fBmachinectl shell\fR
257 command, and allows non\-interactive operation, more detailed and low\-level configuration of the invoked unit, as well as access to runtime and exit code/status information of the invoked shell process\&. In particular, use
258 \fBsystemd\-run\fR\*(Aqs
259 \fB\-\-wait\fR
260 switch to propagate exit status information of the invoked process\&. Use
261 \fBsystemd\-run\fR\*(Aqs
262 \fB\-\-pty\fR
263 switch to acquire an interactive shell, similarly to
264 \fBmachinectl shell\fR\&. In general,
265 \fBsystemd\-run\fR
266 is preferable for scripting purposes\&. However, note that
267 \fBsystemd\-run\fR
268 might require higher privileges than
269 \fBmachinectl shell\fR\&.
270 .sp
271 Added in version 225\&.
272 .RE
273 .PP
274 \fBenable\fR \fINAME\fR\&..., \fBdisable\fR \fINAME\fR\&...
275 .RS 4
276 Enable or disable a container as a system service to start at system boot, using
277 \fBsystemd-nspawn\fR(1)\&. This enables or disables
278 systemd\-nspawn@\&.service, instantiated for the specified machine name, similarly to the effect of
279 \fBsystemctl enable\fR
280 or
281 \fBsystemctl disable\fR
282 on the service name\&.
283 .sp
284 This command implicitly reloads the system manager configuration after completing the operation\&. Note that this command does not implicitly start or power off the containers that are being operated on\&. If this is desired, combine the command with the
285 \fB\-\-now\fR
286 switch\&.
287 .sp
288 Added in version 219\&.
289 .RE
290 .PP
291 \fBpoweroff\fR \fINAME\fR\&...
292 .RS 4
293 Power off one or more machines\&. For VMs managed by
294 \fBsystemd-vmspawn\fR(1), this sends an ACPI powerdown request via QMP\&. For containers, this sends SIGRTMIN+4 to the container\*(Aqs init process, which causes systemd\-compatible init systems to shut down cleanly\&. This operation does not work on containers that do not run a
295 \fBsystemd\fR(1)\-compatible init system, such as sysvinit\&. Use
296 \fBstop\fR
297 as alias for
298 \fBpoweroff\fR\&. Use
299 \fBterminate\fR
300 (see below) to immediately terminate a machine without cleanly shutting it down\&.
301 .sp
302 Added in version 212\&.
303 .RE
304 .PP
305 \fBreboot\fR \fINAME\fR\&...
306 .RS 4
307 Reboot one or more machines\&. For VMs managed by
308 \fBsystemd-vmspawn\fR(1), this sends a system reset request via QMP\&. For containers, this sends SIGINT to the container\*(Aqs init process, which is roughly equivalent to pressing Ctrl+Alt+Del on a non\-containerized system, and is compatible with containers running any system manager\&. Use
309 \fBrestart\fR
310 as alias for
311 \fBreboot\fR\&.
312 .sp
313 Added in version 209\&.
314 .RE
315 .PP
316 \fBpause\fR \fINAME\fR\&...
317 .RS 4
318 Pause one or more machines\&. For VMs managed by
319 \fBsystemd-vmspawn\fR(1), this freezes vCPU execution at the hypervisor level \(em the guest operating system is not notified and does not observe an ACPI suspend\&. From the guest\*(Aqs perspective time simply stops until the machine is resumed with
320 \fBresume\fR\&.
321 .sp
322 Added in version 261\&.
323 .RE
324 .PP
325 \fBresume\fR \fINAME\fR\&...
326 .RS 4
327 Resume one or more previously paused machines\&. This restarts execution after a
328 \fBpause\fR\&.
329 .sp
330 Added in version 261\&.
331 .RE
332 .PP
333 \fBterminate\fR \fINAME\fR\&...
334 .RS 4
335 Immediately terminates a virtual machine or container, without cleanly shutting it down\&. This kills all processes of the virtual machine or container and deallocates all resources attached to that instance\&. Use
336 \fBpoweroff\fR
337 to issue a clean shutdown request\&.
338 .sp
339 Added in version 206\&.
340 .RE
341 .PP
342 \fBkill\fR \fINAME\fR\&...
343 .RS 4
344 Send a signal to one or more processes of the virtual machine or container\&. This means processes as seen by the host, not the processes inside the virtual machine or container\&. Use
345 \fB\-\-kill\-whom=\fR
346 to select which process to kill\&. Use
347 \fB\-\-signal=\fR
348 to select the signal to send\&.
349 .sp
350 Added in version 206\&.
351 .RE
352 .PP
353 \fBbind\fR \fINAME\fR \fIPATH\fR [\fIPATH\fR]
354 .RS 4
355 Bind mounts a file or directory from the host into the specified container\&. The first path argument is the source file or directory on the host, the second path argument is the destination file or directory in the container\&. When the latter is omitted, the destination path in the container is the same as the source path on the host\&. When combined with the
356 \fB\-\-read\-only\fR
357 switch, a read\-only bind mount is created\&. When combined with the
358 \fB\-\-mkdir\fR
359 switch, the destination path is first created before the mount is applied\&. Note that this option is currently only supported for
360 \fBsystemd-nspawn\fR(1)
361 containers, and only if user namespacing (\fB\-\-private\-users\fR) is not used\&. This command supports bind mounting directories, regular files, device nodes,
362 \fBAF_UNIX\fR
363 socket nodes, as well as FIFOs\&.
364 .sp
365 Added in version 219\&.
366 .RE
367 .PP
368 \fBbind\-volume\fR \fINAME\fR \fISPEC\fR
369 .RS 4
370 Acquire a storage volume from a
371 \fBstoragectl\fR(1)
372 provider and attach it to the running machine\&.
373 \fISPEC\fR
374 is a string of the form
375 "\fIPROVIDER\fR:\fIVOLUME\fR[:\fICONFIG\fR][:\fIK=V\fR,\&...]", identical in grammar to the
376 \fB\-\-bind\-volume=\fR
377 argument of
378 \fBsystemd-vmspawn\fR(1)\&.
379 .sp
380 The attached volume is identified by the name
381 "\fIPROVIDER\fR:\fIVOLUME\fR"
382 and may be detached at runtime via
383 \fBunbind\-volume\fR\&. Currently only supported for
384 \fBsystemd\-vmspawn\fR
385 machines that expose an
386 \fBio\&.systemd\&.MachineInstance\fR
387 control socket\&.
388 .sp
389 Added in version 261\&.
390 .RE
391 .PP
392 \fBunbind\-volume\fR \fINAME\fR \fISTORAGE\-NAME\fR
393 .RS 4
394 Detach a storage volume from the running machine\&.
395 \fISTORAGE\-NAME\fR
396 is the
397 "\fIPROVIDER\fR:\fIVOLUME\fR"
398 identifier that was specified at
399 \fBbind\-volume\fR
400 time\&. Volumes that were attached at machine startup (e\&.g\&. via
401 \fB\-\-bind\-volume=\fR
402 on
403 \fBsystemd-vmspawn\fR(1)) cannot be detached and will fail with
404 \fBio\&.systemd\&.MachineInstance\&.StorageImmutable\fR\&.
405 .sp
406 Added in version 261\&.
407 .RE
408 .PP
409 \fBcopy\-to\fR \fINAME\fR \fIPATH\fR [\fIPATH\fR] \fB\-\-force\fR
410 .RS 4
411 Copies files or directories from the host system into a running container\&. Takes a container name, followed by the source path on the host and the destination path in the container\&. If the destination path is omitted, the same as the source path is used\&.
412 .sp
413 If host and container share the same user and group namespace, file ownership by numeric user ID and group ID is preserved for the copy, otherwise all files and directories in the copy will be owned by the root user and group (UID/GID 0)\&.
414 .sp
415 Added in version 219\&.
416 .RE
417 .PP
418 \fBcopy\-from\fR \fINAME\fR \fIPATH\fR [\fIPATH\fR] \fB\-\-force\fR
419 .RS 4
420 Copies files or directories from a container into the host system\&. Takes a container name, followed by the source path in the container and the destination path on the host\&. If the destination path is omitted, the same as the source path is used\&.
421 .sp
422 If host and container share the same user and group namespace, file ownership by numeric user ID and group ID is preserved for the copy, otherwise all files and directories in the copy will be owned by the root user and group (UID/GID 0)\&.
423 .sp
424 Added in version 219\&.
425 .RE
426 .SS "Image Commands"
427 .PP
428 \fBlist\-images\fR
429 .RS 4
430 Show a list of locally installed container and VM images\&. This enumerates all raw disk images and container directories and subvolumes in
431 /var/lib/machines/
432 (and other search paths, see below)\&. Use
433 \fBstart\fR
434 (see above) to run a container off one of the listed images\&. Note that, by default, containers whose name begins with a dot ("\&.") are not shown\&. To show these too, specify
435 \fB\-\-all\fR\&. Note that a special image
436 "\&.host"
437 always implicitly exists and refers to the image the host itself is booted from\&.
438 .sp
439 Added in version 219\&.
440 .RE
441 .PP
442 \fBimage\-status\fR [\fINAME\fR\&...]
443 .RS 4
444 Show terse status information about one or more container or VM images\&. This function is intended to generate human\-readable output\&. Use
445 \fBshow\-image\fR
446 (see below) to generate computer\-parsable output instead\&.
447 .sp
448 Added in version 219\&.
449 .RE
450 .PP
451 \fBshow\-image\fR [\fINAME\fR\&...]
452 .RS 4
453 Show properties of one or more registered virtual machine or container images, or the manager itself\&. If no argument is specified, properties of the manager will be shown\&. If a NAME is specified, properties of this virtual machine or container image are shown\&. By default, empty properties are suppressed\&. Use
454 \fB\-\-all\fR
455 to show those too\&. To select specific properties to show, use
456 \fB\-\-property=\fR\&. This command is intended to be used whenever computer\-parsable output is required\&. Use
457 \fBimage\-status\fR
458 if you are looking for formatted human\-readable output\&.
459 .sp
460 Added in version 219\&.
461 .RE
462 .PP
463 \fBedit\fR \fINAME|FILE\fR
464 .RS 4
465 Edit the settings file of the specified machines\&. For the format of the settings file, refer to
466 \fBsystemd.nspawn\fR(5)\&. If an existing settings file of the given machine cannot be found,
467 \fBedit\fR
468 automatically create a new settings file from scratch under
469 /etc/systemd/nspawn/\&.
470 .sp
471 Added in version 254\&.
472 .RE
473 .PP
474 \fBcat\fR \fINAME|FILE\fR
475 .RS 4
476 Show the settings file of the specified machines\&.
477 .sp
478 Added in version 254\&.
479 .RE
480 .PP
481 \fBclone\fR \fINAME\fR \fINAME\fR
482 .RS 4
483 Clones a container or VM image\&. The arguments specify the name of the image to clone and the name of the newly cloned image\&. Note that plain directory container images are cloned into btrfs subvolume images with this command, if the underlying file system supports this\&. Note that cloning a container or VM image is optimized for file systems that support copy\-on\-write, and might not be efficient on others, due to file system limitations\&.
484 .sp
485 Note that this command leaves hostname, machine ID and all other settings that could identify the instance unmodified\&. The original image and the cloned copy will hence share these credentials, and it might be necessary to manually change them in the copy\&.
486 .sp
487 If combined with the
488 \fB\-\-read\-only\fR
489 switch a read\-only cloned image is created\&.
490 .sp
491 Added in version 219\&.
492 .RE
493 .PP
494 \fBrename\fR \fINAME\fR \fINAME\fR
495 .RS 4
496 Renames a container or VM image\&. The arguments specify the name of the image to rename and the new name of the image\&.
497 .sp
498 Added in version 219\&.
499 .RE
500 .PP
501 \fBread\-only\fR \fINAME\fR [\fIBOOL\fR]
502 .RS 4
503 Marks or (unmarks) a container or VM image read\-only\&. Takes a VM or container image name, followed by a boolean as arguments\&. If the boolean is omitted, positive is implied, i\&.e\&. the image is marked read\-only\&.
504 .sp
505 Added in version 219\&.
506 .RE
507 .PP
508 \fBremove\fR \fINAME\fR\&...
509 .RS 4
510 Removes one or more container or VM images\&. The special image
511 "\&.host", which refers to the host\*(Aqs own directory tree, may not be removed\&.
512 .sp
513 Added in version 219\&.
514 .RE
515 .PP
516 \fBset\-limit\fR [\fINAME\fR] \fIBYTES\fR
517 .RS 4
518 Sets the maximum size in bytes that a specific container or VM 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 container or VM 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
519 "\-"
520 as size\&.
521 .sp
522 Note that per\-container size limits are only supported on btrfs file systems\&.
523 .sp
524 Added in version 220\&.
525 .RE
526 .PP
527 \fBclean\fR
528 .RS 4
529 Remove hidden VM or container images (or all)\&. This command removes all hidden machine images from
530 /var/lib/machines/, i\&.e\&. those whose name begins with a dot\&. Use
531 \fBmachinectl list\-images \-\-all\fR
532 to see a list of all machine images, including the hidden ones\&.
533 .sp
534 When combined with the
535 \fB\-\-all\fR
536 switch removes all images, not just hidden ones\&. This command effectively empties
537 /var/lib/machines/\&.
538 .sp
539 Note that commands such as
540 \fBimportctl pull\-tar\fR
541 or
542 \fBimportctl pull\-raw\fR
543 usually create hidden, read\-only, unmodified machine images from the downloaded image first, before cloning a writable working copy of it, in order to avoid duplicate downloads in case of images that are reused multiple times\&. Use
544 \fBmachinectl clean\fR
545 to remove old, hidden images created this way\&.
546 .sp
547 Added in version 230\&.
548 .RE
549 .SH "OPTIONS"
550 .PP
551 The following options are understood:
552 .PP
553 \fB\-p\fR, \fB\-\-property=\fR
554 .RS 4
555 When showing machine or image properties, limit the output to certain properties as specified by the argument\&. If not specified, all set properties are shown\&. The argument should be a property name, such as
556 "Name"\&. If specified more than once, all properties with the specified names are shown\&.
557 .sp
558 Added in version 206\&.
559 .RE
560 .PP
561 \fB\-\-value\fR
562 .RS 4
563 When printing properties with
564 \fBshow\fR, only print the value, and skip the property name and
565 "="\&.
566 .sp
567 Added in version 230\&.
568 .RE
569 .PP
570 \fB\-P\fR
571 .RS 4
572 Equivalent to
573 \fB\-\-value\fR
574 \fB\-\-property=\fR, i\&.e\&. shows the value of the property without the property name or
575 "="\&. Note that using
576 \fB\-P\fR
577 once will also affect all properties listed with
578 \fB\-p\fR/\fB\-\-property=\fR\&.
579 .sp
580 Added in version 256\&.
581 .RE
582 .PP
583 \fB\-a\fR, \fB\-\-all\fR
584 .RS 4
585 When showing machine or image properties, show all properties regardless of whether they are set or not\&.
586 .sp
587 When listing VM or container images, do not suppress images beginning in a dot character ("\&.")\&.
588 .sp
589 When cleaning VM or container images, remove all images, not just hidden ones\&.
590 .sp
591 Added in version 206\&.
592 .RE
593 .PP
594 \fB\-l\fR, \fB\-\-full\fR
595 .RS 4
596 Do not ellipsize process tree entries or table\&. This implies
597 \fB\-\-max\-addresses=full\fR\&.
598 .sp
599 Added in version 206\&.
600 .RE
601 .PP
602 \fB\-\-kill\-whom=\fR
603 .RS 4
604 When used with
605 \fBkill\fR, choose which processes to kill\&. Must be one of
606 \fBleader\fR,
607 \fBsupervisor\fR, or
608 \fBall\fR
609 to select whether to kill only the leader process of the machine, the supervisor process of the machine, or all processes of the machine\&. If omitted, defaults to
610 \fBall\fR\&.
611 .sp
612 Added in version 206\&.
613 .RE
614 .PP
615 \fB\-s\fR, \fB\-\-signal=\fR
616 .RS 4
617 When used with
618 \fBkill\fR, choose which signal to send to selected processes\&. Must be one of the well\-known signal specifiers such as
619 \fBSIGTERM\fR,
620 \fBSIGINT\fR
621 or
622 \fBSIGSTOP\fR\&. If omitted, defaults to
623 \fBSIGTERM\fR\&.
624 .sp
625 The special value
626 "help"
627 will list the known values and the program will exit immediately, and the special value
628 "list"
629 will list known values along with the numerical signal numbers and the program will exit immediately\&.
630 .RE
631 .PP
632 \fB\-\-uid=\fR
633 .RS 4
634 When used with the
635 \fBshell\fR
636 command, chooses the user ID to open the interactive shell session as\&. If the argument to the
637 \fBshell\fR
638 command also specifies a user name, this option is ignored\&. If the name is not specified in either way,
639 "root"
640 will be used by default\&. Note that this switch is not supported for the
641 \fBlogin\fR
642 command (see below)\&.
643 .sp
644 Added in version 225\&.
645 .RE
646 .PP
647 \fB\-E \fR\fB\fINAME\fR\fR\fB[=\fR\fB\fIVALUE\fR\fR\fB]\fR, \fB\-\-setenv=\fR\fB\fINAME\fR\fR\fB[=\fR\fB\fIVALUE\fR\fR\fB]\fR
648 .RS 4
649 When used with the
650 \fBshell\fR
651 command, sets an environment variable for the executed shell\&. This option may be used more than once to set multiple variables\&. When
652 "="
653 and
654 \fIVALUE\fR
655 are omitted, the value of the variable with the same name in the program environment will be used\&.
656 .sp
657 Note that this option is not supported for the
658 \fBlogin\fR
659 command\&.
660 .sp
661 Added in version 230\&.
662 .RE
663 .PP
664 \fB\-\-mkdir\fR
665 .RS 4
666 When used with
667 \fBbind\fR, creates the destination file or directory before applying the bind mount\&. Note that even though the name of this option suggests that it is suitable only for directories, this option also creates the destination file node to mount over if the object to mount is not a directory, but a regular file, device node, socket or FIFO\&.
668 .sp
669 Added in version 219\&.
670 .RE
671 .PP
672 \fB\-\-read\-only\fR
673 .RS 4
674 When used with
675 \fBbind\fR, creates a read\-only bind mount\&.
676 .sp
677 When used with
678 \fBclone\fR
679 a read\-only container or VM image is created\&.
680 .sp
681 Added in version 219\&.
682 .RE
683 .PP
684 \fB\-n\fR, \fB\-\-lines=\fR
685 .RS 4
686 When used with
687 \fBstatus\fR, controls the number of journal lines to show, counting from the most recent ones\&. Takes a positive integer argument\&. Defaults to 10\&.
688 .sp
689 Added in version 219\&.
690 .RE
691 .PP
692 \fB\-o\fR, \fB\-\-output=\fR
693 .RS 4
694 When used with
695 \fBstatus\fR, controls the formatting of the journal entries that are shown\&. For the available choices, see
696 \fBjournalctl\fR(1)\&. Defaults to
697 "short"\&.
698 .sp
699 Added in version 219\&.
700 .RE
701 .PP
702 \fB\-\-runner=\fR\fBnspawn\fR|\fBvmspawn\fR
703 .RS 4
704 When operating on machines choose whether to use
705 \fBsystemd-nspawn\fR(1)
706 or
707 \fBsystemd-vmspawn\fR(1)\&. By default
708 \fBsystemd-nspawn\fR(1)
709 is used\&.
710 .sp
711 Added in version 256\&.
712 .RE
713 .PP
714 \fB\-V\fR
715 .RS 4
716 \fB\-V\fR
717 is a shorthand for
718 \fB\-\-runner=vmspawn\fR\&.
719 .sp
720 Added in version 256\&.
721 .RE
722 .PP
723 \fB\-\-now\fR
724 .RS 4
725 When used with
726 \fBenable\fR
727 or
728 \fBdisable\fR, the containers will also be started or powered off\&. The start or poweroff operation is only carried out when the respective enable or disable operation has been successful\&.
729 .sp
730 Added in version 253\&.
731 .RE
732 .PP
733 \fB\-\-force\fR
734 .RS 4
735 Replace target file when copying files\&.
736 .sp
737 Added in version 219\&.
738 .RE
739 .PP
740 \fB\-\-max\-addresses=\fR
741 .RS 4
742 When used with the
743 \fBlist\-machines\fR
744 command, limits the number of IP addresses shown for every machine\&. Defaults to 1\&. All addresses can be requested with
745 "all"\&. If the limit is 0, the address column is not shown\&. Otherwise, if the machine has more addresses than shown,
746 "\&..."
747 follows the last address\&.
748 .sp
749 Added in version 232\&.
750 .RE
751 .PP
752 \fB\-q\fR, \fB\-\-quiet\fR
753 .RS 4
754 Suppresses additional informational output while running\&.
755 .sp
756 Added in version 236\&.
757 .RE
758 .PP
759 \fB\-H\fR, \fB\-\-host=\fR
760 .RS 4
761 Execute the operation remotely\&. Specify a hostname, or a username and hostname separated by
762 "@", to connect to\&. The hostname may optionally be suffixed by a port ssh is listening on, separated by
763 ":", and then a container name, separated by
764 "/", 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
765 \fBmachinectl \-H \fR\fB\fIHOST\fR\fR\&. Put IPv6 addresses in brackets\&.
766 .RE
767 .PP
768 \fB\-M\fR, \fB\-\-machine=\fR
769 .RS 4
770 Connect to
771 \fBsystemd-machined.service\fR(8)
772 running in a local container, to perform the specified operation within the container\&.
773 .sp
774 Added in version 235\&.
775 .RE
776 .PP
777 \fB\-\-no\-pager\fR
778 .RS 4
779 Do not pipe output into a pager\&.
780 .RE
781 .PP
782 \fB\-\-no\-legend\fR
783 .RS 4
784 Do not print the legend, i\&.e\&. column headers and the footer with hints\&.
785 .RE
786 .PP
787 \fB\-\-no\-ask\-password\fR
788 .RS 4
789 Do not query the user for authentication for privileged operations\&.
790 .RE
791 .PP
792 \fB\-h\fR, \fB\-\-help\fR
793 .RS 4
794 Print a short help text and exit\&.
795 .RE
796 .PP
797 \fB\-\-version\fR
798 .RS 4
799 Print a short version string and exit\&.
800 .RE
801 .SH "MACHINE AND IMAGE NAMES"
802 .PP
803 The
804 \fBmachinectl\fR
805 tool operates on machines and images whose names must be chosen following strict rules\&. Machine names must be suitable for use as hostnames following a conservative subset of DNS and UNIX/Linux semantics\&. Specifically, they must consist of one or more non\-empty label strings, separated by dots\&. No leading or trailing dots are allowed\&. No sequences of multiple dots are allowed\&. The label strings may only consist of alphanumeric characters as well as the dash\&. The maximum length of a machine name is 64 characters\&.
806 .PP
807 A special machine with the name
808 "\&.host"
809 refers to the running host system itself\&. This is useful for execution operations or inspecting the host system as well\&. Note that
810 \fBmachinectl list\fR
811 will not show this special machine unless the
812 \fB\-\-all\fR
813 switch is specified\&.
814 .PP
815 Requirements on image names are less strict, however, they must be valid UTF\-8, must be suitable as file names (hence not be the single or double dot, and not include a slash), and may not contain control characters\&. Since many operations search for an image by the name of a requested machine, it is recommended to name images in the same strict fashion as machines\&.
816 .PP
817 A special image with the name
818 "\&.host"
819 refers to the image of the running host system\&. It hence conceptually maps to the special
820 "\&.host"
821 machine name described above\&. Note that
822 \fBmachinectl list\-images\fR
823 will not show this special image either, unless
824 \fB\-\-all\fR
825 is specified\&.
826 .SH "FILES AND DIRECTORIES"
827 .PP
828 Machine images are preferably stored in
829 /var/lib/machines/, but are also searched for in
830 /usr/local/lib/machines/
831 and
832 /usr/lib/machines/\&. For compatibility reasons, the directory
833 /var/lib/container/
834 is searched, too\&. Note that images stored below
835 /usr/
836 are always considered read\-only\&. It is possible to symlink machines images from other directories into
837 /var/lib/machines/
838 to make them available for control with
839 \fBmachinectl\fR\&.
840 .PP
841 Note that some image operations are only supported, efficient or atomic on btrfs file systems\&.
842 .PP
843 Disk images are understood by
844 \fBsystemd-nspawn\fR(1)
845 and
846 \fBmachinectl\fR
847 in three formats:
848 .sp
849 .RS 4
850 .ie n \{\
851 \h'-04'\(bu\h'+03'\c
852 .\}
853 .el \{\
854 .sp -1
855 .IP \(bu 2.3
856 .\}
857 A simple directory tree, containing the files and directories of the container to boot\&.
858 .RE
859 .sp
860 .RS 4
861 .ie n \{\
862 \h'-04'\(bu\h'+03'\c
863 .\}
864 .el \{\
865 .sp -1
866 .IP \(bu 2.3
867 .\}
868 Subvolumes (on btrfs file systems), which are similar to the simple directories, described above\&. However, they have additional benefits, such as efficient cloning and quota reporting\&.
869 .RE
870 .sp
871 .RS 4
872 .ie n \{\
873 \h'-04'\(bu\h'+03'\c
874 .\}
875 .el \{\
876 .sp -1
877 .IP \(bu 2.3
878 .\}
879 "Raw" disk images, i\&.e\&. binary images of disks with a GPT or MBR partition table\&. Images of this type are regular files with the suffix
880 "\&.raw"\&.
881 .RE
882 .PP
883 See
884 \fBsystemd-nspawn\fR(1)
885 for more information on image formats, in particular its
886 \fB\-\-directory=\fR
887 and
888 \fB\-\-image=\fR
889 options\&.
890 .SH "EXAMPLES"
891 .PP
892 \fBExample\ \&1.\ \&Download an Ubuntu RAW image, set a root password in it, start it as a service\fR
893 .sp
894 .if n \{\
895 .RS 4
896 .\}
897 .nf
898 # importctl pull\-raw \-mN \e
899 https://cloud\-images\&.ubuntu\&.com/jammy/current/jammy\-server\-cloudimg\-amd64\-disk\-kvm\&.img \e
900 jammy
901 # systemd\-firstboot \-\-image=/var/lib/machines/jammy\&.raw \-\-prompt\-root\-password \-\-force
902 # machinectl start jammy
903 # machinectl login jammy
904 .fi
905 .if n \{\
906 .RE
907 .\}
908 .PP
909 This downloads the specified
910 \&.raw
911 image and makes it available under the local name
912 "jammy"\&. Then, a root password is set with
913 \fBsystemd-firstboot\fR(1)\&. Afterwards the machine is started as system service\&. With the last command a login prompt into the container is requested\&.
914 .SH "EXIT STATUS"
915 .PP
916 On success, 0 is returned, a non\-zero failure code otherwise\&.
917 .SH "ENVIRONMENT"
918 .PP
919 \fI$SYSTEMD_LOG_LEVEL\fR
920 .RS 4
921 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)
922 \fBemerg\fR,
923 \fBalert\fR,
924 \fBcrit\fR,
925 \fBerr\fR,
926 \fBwarning\fR,
927 \fBnotice\fR,
928 \fBinfo\fR,
929 \fBdebug\fR, or an integer in the range 0\&...7\&. See
930 \fBsyslog\fR(3)
931 for more information\&. Each value may optionally be prefixed with one of
932 \fBconsole\fR,
933 \fBsyslog\fR,
934 \fBkmsg\fR
935 or
936 \fBjournal\fR
937 followed by a colon to set the maximum log level for that specific log target (e\&.g\&.
938 \fBSYSTEMD_LOG_LEVEL=debug,console:info\fR
939 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\&.
940 .RE
941 .PP
942 \fI$SYSTEMD_LOG_COLOR\fR
943 .RS 4
944 A boolean\&. If true, messages written to the tty will be colored according to priority\&.
945 .sp
946 This setting is only useful when messages are written directly to the terminal, because
947 \fBjournalctl\fR(1)
948 and other tools that display logs will color messages based on the log level on their own\&.
949 .RE
950 .PP
951 \fI$SYSTEMD_LOG_TIME\fR
952 .RS 4
953 A boolean\&. If true, console log messages will be prefixed with a timestamp\&.
954 .sp
955 This setting is only useful when messages are written directly to the terminal or a file, because
956 \fBjournalctl\fR(1)
957 and other tools that display logs will attach timestamps based on the entry metadata on their own\&.
958 .RE
959 .PP
960 \fI$SYSTEMD_LOG_LOCATION\fR
961 .RS 4
962 A boolean\&. If true, messages will be prefixed with a filename and line number in the source code where the message originates\&.
963 .sp
964 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\&.
965 .RE
966 .PP
967 \fI$SYSTEMD_LOG_TID\fR
968 .RS 4
969 A boolean\&. If true, messages will be prefixed with the current numerical thread ID (TID)\&.
970 .sp
971 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\&.
972 .RE
973 .PP
974 \fI$SYSTEMD_LOG_TARGET\fR
975 .RS 4
976 The destination for log messages\&. One of
977 \fBconsole\fR
978 (log to the attached tty),
979 \fBconsole\-prefixed\fR
980 (log to the attached tty but with prefixes encoding the log level and "facility", see
981 \fBsyslog\fR(3),
982 \fBkmsg\fR
983 (log to the kernel circular log buffer),
984 \fBjournal\fR
985 (log to the journal),
986 \fBjournal\-or\-kmsg\fR
987 (log to the journal if available, and to kmsg otherwise),
988 \fBauto\fR
989 (determine the appropriate log target automatically, the default),
990 \fBnull\fR
991 (disable log output)\&.
992 .RE
993 .PP
994 \fI$SYSTEMD_LOG_RATELIMIT_KMSG\fR
995 .RS 4
996 Whether to ratelimit kmsg or not\&. Takes a boolean\&. Defaults to
997 "true"\&. If disabled, systemd will not ratelimit messages written to kmsg\&.
998 .RE
999 .PP
1000 \fI$SYSTEMD_PAGER\fR, \fI$PAGER\fR
1001 .RS 4
1002 Pager to use when
1003 \fB\-\-no\-pager\fR
1004 is not given\&.
1005 \fI$SYSTEMD_PAGER\fR
1006 is used if set; otherwise
1007 \fI$PAGER\fR
1008 is used\&. If neither
1009 \fI$SYSTEMD_PAGER\fR
1010 nor
1011 \fI$PAGER\fR
1012 are set, a set of well\-known pager implementations is tried in turn, including
1013 \fBless\fR(1)
1014 and
1015 \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
1016 "cat"
1017 is equivalent to passing
1018 \fB\-\-no\-pager\fR\&.
1019 .sp
1020 Note: if
1021 \fI$SYSTEMD_PAGERSECURE\fR
1022 is not set,
1023 \fI$SYSTEMD_PAGER\fR
1024 and
1025 \fI$PAGER\fR
1026 can only be used to disable the pager (with
1027 "cat"
1028 or
1029 ""), and are otherwise ignored\&.
1030 .RE
1031 .PP
1032 \fI$SYSTEMD_LESS\fR
1033 .RS 4
1034 Override the options passed to
1035 \fBless\fR
1036 (by default
1037 "FRSXMK")\&.
1038 .sp
1039 Users might want to change two options in particular:
1040 .PP
1041 \fBK\fR
1042 .RS 4
1043 This option instructs the pager to exit immediately when
1044 Ctrl+C
1045 is pressed\&. To allow
1046 \fBless\fR
1047 to handle
1048 Ctrl+C
1049 itself to switch back to the pager command prompt, unset this option\&.
1050 .sp
1051 If the value of
1052 \fI$SYSTEMD_LESS\fR
1053 does not include
1054 "K", and the pager that is invoked is
1055 \fBless\fR,
1056 Ctrl+C
1057 will be ignored by the executable, and needs to be handled by the pager\&.
1058 .RE
1059 .PP
1060 \fBX\fR
1061 .RS 4
1062 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\&.
1063 .RE
1064 .sp
1065 Note that setting the regular
1066 \fI$LESS\fR
1067 environment variable has no effect for
1068 \fBless\fR
1069 invocations by systemd tools\&.
1070 .sp
1071 See
1072 \fBless\fR(1)
1073 for more discussion\&.
1074 .RE
1075 .PP
1076 \fI$SYSTEMD_LESSCHARSET\fR
1077 .RS 4
1078 Override the charset passed to
1079 \fBless\fR
1080 (by default
1081 "utf\-8", if the invoking terminal is determined to be UTF\-8 compatible)\&.
1082 .sp
1083 Note that setting the regular
1084 \fI$LESSCHARSET\fR
1085 environment variable has no effect for
1086 \fBless\fR
1087 invocations by systemd tools\&.
1088 .RE
1089 .PP
1090 \fI$SYSTEMD_PAGERSECURE\fR
1091 .RS 4
1092 Common pager commands like
1093 \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
1094 \fBsudo\fR(8)
1095 or
1096 \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,
1097 \fIif the pager supports that\fR
1098 (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
1099 \fB\-\-no\-pager\fR
1100 or
1101 \fIPAGER=cat\fR
1102 when allowing untrusted users to execute commands with elevated privileges\&.
1103 .sp
1104 This option takes a boolean argument\&. When set to true, the "secure mode" of the pager is enabled\&. In "secure mode",
1105 \fBLESSSECURE=1\fR
1106 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
1107 \fBless\fR(1)
1108 is known to understand this variable and implement "secure mode"\&.
1109 .sp
1110 When set to false, no limitation is placed on the pager\&. Setting
1111 \fISYSTEMD_PAGERSECURE=0\fR
1112 or not removing it from the inherited environment may allow the user to invoke arbitrary commands\&.
1113 .sp
1114 When
1115 \fI$SYSTEMD_PAGERSECURE\fR
1116 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
1117 \fBgeteuid\fR(2)
1118 and
1119 \fBsd_pid_get_owner_uid\fR(3), or when running under
1120 \fBsudo\fR(8)
1121 or similar tools (\fI$SUDO_UID\fR
1122 is set
1123 \&\s-2\u[1]\d\s+2)\&. In those cases,
1124 \fISYSTEMD_PAGERSECURE=1\fR
1125 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
1126 \fI$SYSTEMD_PAGERSECURE\fR
1127 or disable the pager\&.
1128 .sp
1129 Note that if the
1130 \fI$SYSTEMD_PAGER\fR
1131 or
1132 \fI$PAGER\fR
1133 variables are to be honoured, other than to disable the pager,
1134 \fI$SYSTEMD_PAGERSECURE\fR
1135 must be set too\&.
1136 .RE
1137 .PP
1138 \fI$SYSTEMD_COLORS\fR
1139 .RS 4
1140 Takes a boolean argument, or a special value\&. By default (unset),
1141 \fBsystemd\fR
1142 and related utilities will use colors in their output if possible\&. If
1143 \fI$COLORTERM\fR
1144 is set to
1145 "truecolor"
1146 or
1147 "24bit", 24\-bit colors will be enabled, 256 colors otherwise, unless
1148 \fI$NO_COLOR\fR
1149 or
1150 \fI$TERM\fR
1151 indicates colors are disabled\&.
1152 .PP
1153 \fBtrue\fR
1154 .RS 4
1155 Same as unset, except that
1156 \fI$NO_COLOR\fR
1157 is ignored\&.
1158 .RE
1159 .PP
1160 \fBfalse\fR
1161 .RS 4
1162 The output will be monochrome\&.
1163 .RE
1164 .PP
1165 "16", "256", "24bit"
1166 .RS 4
1167 Always use the base 16 ANSI colors, 256 colors, or 24 bit color, respectively\&.
1168 .RE
1169 .PP
1170 "auto\-16", "auto\-256", "auto\-24bit"
1171 .RS 4
1172 Use the given quantity of colours, subject to
1173 \fI$TERM\fR, and what the console is connected to\&.
1174 .RE
1175 .RE
1176 .PP
1177 \fI$SYSTEMD_URLIFY\fR
1178 .RS 4
1179 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
1180 \fBsystemd\fR
1181 makes based on
1182 \fI$TERM\fR
1183 and other conditions\&.
1184 .RE
1185 .SH "SEE ALSO"
1186 .PP
1187 \fBsystemd\fR(1), \fBsystemd-machined.service\fR(8), \fBsystemd-nspawn\fR(1), \fBsystemd.special\fR(7), \fBimportctl\fR(1), \fBtar\fR(1), \fBxz\fR(1), \fBgzip\fR(1), \fBbzip2\fR(1), \fBzstd\fR(1)
1188 .SH "NOTES"
1189 .IP " 1." 4
1190 It is recommended for other tools to set and check
1191 \fI$SUDO_UID\fR
1192 as appropriate, treating it is a common interface.
1193