1MACHINECTL(1) machinectl MACHINECTL(1)
2
3
4
6 machinectl - Control the systemd machine manager
7
9 machinectl [OPTIONS...] {COMMAND} [NAME...]
10
12 machinectl may be used to introspect and control the state of the
13 systemd(1) virtual machine and container registration manager systemd-
14 machined.service(8).
15
16 machinectl may be used to execute operations on machines and images.
17 Machines in this sense are considered running instances of:
18
19 · Virtual Machines (VMs) that virtualize hardware to run full
20 operating system (OS) instances (including their kernels) in a
21 virtualized environment on top of the host OS.
22
23 · Containers that share the hardware and OS kernel with the host OS,
24 in order to run OS userspace instances on top the host OS.
25
26 · The host system itself.
27
28 Machines are identified by names that follow the same rules as UNIX and
29 DNS host names. For details, see below.
30
31 Machines are instantiated from disk or file system images that
32 frequently — but not necessarily — carry the same name as machines
33 running from them. Images in this sense may be:
34
35 · Directory trees containing an OS, including the top-level
36 directories /usr, /etc, and so on.
37
38 · btrfs subvolumes containing OS trees, similar to regular directory
39 trees.
40
41 · Binary "raw" disk image files containing MBR or GPT partition
42 tables and Linux file systems.
43
44 · Similarly, block devices containing MBR or GPT partition tables and
45 file systems.
46
47 · The file system tree of the host OS itself.
48
50 The following options are understood:
51
52 -p, --property=
53 When showing machine or image properties, limit the output to
54 certain properties as specified by the argument. If not specified,
55 all set properties are shown. The argument should be a property
56 name, such as "Name". If specified more than once, all properties
57 with the specified names are shown.
58
59 -a, --all
60 When showing machine or image properties, show all properties
61 regardless of whether they are set or not.
62
63 When listing VM or container images, do not suppress images
64 beginning in a dot character (".").
65
66 When cleaning VM or container images, remove all images, not just
67 hidden ones.
68
69 --value
70 When printing properties with show, only print the value, and skip
71 the property name and "=".
72
73 -l, --full
74 Do not ellipsize process tree entries.
75
76 --kill-who=
77 When used with kill, choose which processes to kill. Must be one of
78 leader, or all to select whether to kill only the leader process of
79 the machine or all processes of the machine. If omitted, defaults
80 to all.
81
82 -s, --signal=
83 When used with kill, choose which signal to send to selected
84 processes. Must be one of the well-known signal specifiers, such as
85 SIGTERM, SIGINT or SIGSTOP. If omitted, defaults to SIGTERM.
86
87 --uid=
88 When used with the shell command, chooses the user ID to open the
89 interactive shell session as. If the argument to the shell command
90 also specifies a user name, this option is ignored. If the name is
91 not specified in either way, "root" will be used by default. Note
92 that this switch is not supported for the login command (see
93 below).
94
95 -E NAME=VALUE, --setenv=NAME=VALUE
96 When used with the shell command, sets an environment variable to
97 pass to the executed shell. Takes an environment variable name and
98 value, separated by "=". This switch may be used multiple times to
99 set multiple environment variables. Note that this switch is not
100 supported for the login command (see below).
101
102 --mkdir
103 When used with bind, creates the destination file or directory
104 before applying the bind mount. Note that even though the name of
105 this option suggests that it is suitable only for directories, this
106 option also creates the destination file node to mount over if the
107 object to mount is not a directory, but a regular file, device
108 node, socket or FIFO.
109
110 --read-only
111 When used with bind, creates a read-only bind mount.
112
113 When used with clone, import-raw or import-tar a read-only
114 container or VM image is created.
115
116 -n, --lines=
117 When used with status, controls the number of journal lines to
118 show, counting from the most recent ones. Takes a positive integer
119 argument. Defaults to 10.
120
121 -o, --output=
122 When used with status, controls the formatting of the journal
123 entries that are shown. For the available choices, see
124 journalctl(1). Defaults to "short".
125
126 --verify=
127 When downloading a container or VM image, specify whether the image
128 shall be verified before it is made available. Takes one of "no",
129 "checksum" and "signature". If "no", no verification is done. If
130 "checksum" is specified, the download is checked for integrity
131 after the transfer is complete, but no signatures are verified. If
132 "signature" is specified, the checksum is verified and the image's
133 signature is checked against a local keyring of trustable vendors.
134 It is strongly recommended to set this option to "signature" if the
135 server and protocol support this. Defaults to "signature".
136
137 --force
138 When downloading a container or VM image, and a local copy by the
139 specified local machine name already exists, delete it first and
140 replace it by the newly downloaded image.
141
142 --format=
143 When used with the export-tar or export-raw commands, specifies the
144 compression format to use for the resulting file. Takes one of
145 "uncompressed", "xz", "gzip", "bzip2". By default, the format is
146 determined automatically from the image file name passed.
147
148 --max-addresses=
149 When used with the list-machines command, limits the number of ip
150 addresses output for every machine. Defaults to 1. All addresses
151 can be requested with "all" as argument to --max-addresses . If the
152 argument to --max-addresses is less than the actual number of
153 addresses, "..."follows the last address. If multiple addresses are
154 to be written for a given machine, every address except the first
155 one is on a new line and is followed by "," if another address will
156 be output afterwards.
157
158 -q, --quiet
159 Suppresses additional informational output while running.
160
161 -H, --host=
162 Execute the operation remotely. Specify a hostname, or a username
163 and hostname separated by "@", to connect to. The hostname may
164 optionally be suffixed by a port ssh is listening on, separated by
165 ":", and then a container name, separated by "/", which connects
166 directly to a specific container on the specified host. This will
167 use SSH to talk to the remote machine manager instance. Container
168 names may be enumerated with machinectl -H HOST. Put IPv6 addresses
169 in brackets.
170
171 -M, --machine=
172 Connect to systemd-machined.service(8) running in a local
173 container, to perform the specified operation within the container.
174
175 --no-pager
176 Do not pipe output into a pager.
177
178 --no-legend
179 Do not print the legend, i.e. column headers and the footer with
180 hints.
181
182 --no-ask-password
183 Do not query the user for authentication for privileged operations.
184
185 -h, --help
186 Print a short help text and exit.
187
188 --version
189 Print a short version string and exit.
190
192 The following commands are understood:
193
194 Machine Commands
195 list
196 List currently running (online) virtual machines and containers. To
197 enumerate machine images that can be started, use list-images (see
198 below). Note that this command hides the special ".host" machine by
199 default. Use the --all switch to show it.
200
201 status NAME...
202 Show runtime status information about one or more virtual machines
203 and containers, followed by the most recent log data from the
204 journal. This function is intended to generate human-readable
205 output. If you are looking for computer-parsable output, use show
206 instead. Note that the log data shown is reported by the virtual
207 machine or container manager, and frequently contains console
208 output of the machine, but not necessarily journal contents of the
209 machine itself.
210
211 show [NAME...]
212 Show properties of one or more registered virtual machines or
213 containers or the manager itself. If no argument is specified,
214 properties of the manager will be shown. If a NAME is specified,
215 properties of this virtual machine or container are shown. By
216 default, empty properties are suppressed. Use --all to show those
217 too. To select specific properties to show, use --property=. This
218 command is intended to be used whenever computer-parsable output is
219 required, and does not print the control group tree or journal
220 entries. Use status if you are looking for formatted human-readable
221 output.
222
223 start NAME...
224 Start a container as a system service, using systemd-nspawn(1).
225 This starts systemd-nspawn@.service, instantiated for the specified
226 machine name, similar to the effect of systemctl start on the
227 service name. systemd-nspawn looks for a container image by the
228 specified name in /var/lib/machines/ (and other search paths, see
229 below) and runs it. Use list-images (see below) for listing
230 available container images to start.
231
232 Note that systemd-machined.service(8) also interfaces with a
233 variety of other container and VM managers, systemd-nspawn is just
234 one implementation of it. Most of the commands available in
235 machinectl may be used on containers or VMs controlled by other
236 managers, not just systemd-nspawn. Starting VMs and container
237 images on those managers requires manager-specific tools.
238
239 To interactively start a container on the command line with full
240 access to the container's console, please invoke systemd-nspawn
241 directly. To stop a running container use machinectl poweroff.
242
243 login [NAME]
244 Open an interactive terminal login session in a container or on the
245 local host. If an argument is supplied, it refers to the container
246 machine to connect to. If none is specified, or the container name
247 is specified as the empty string, or the special machine name
248 ".host" (see below) is specified, the connection is made to the
249 local host instead. This will create a TTY connection to a specific
250 container or the local host and asks for the execution of a getty
251 on it. Note that this is only supported for containers running
252 systemd(1) as init system.
253
254 This command will open a full login prompt on the container or the
255 local host, which then asks for username and password. Use shell
256 (see below) or systemd-run(1) with the --machine= switch to
257 directly invoke a single command, either interactively or in the
258 background.
259
260 shell [[NAME@]NAME [PATH [ARGUMENTS...]]]
261 Open an interactive shell session in a container or on the local
262 host. The first argument refers to the container machine to connect
263 to. If none is specified, or the machine name is specified as the
264 empty string, or the special machine name ".host" (see below) is
265 specified, the connection is made to the local host instead. This
266 works similar to login but immediately invokes a user process. This
267 command runs the specified executable with the specified arguments,
268 or the default shell for the user if none is specified, or /bin/sh
269 if no default shell is found. By default, --uid=, or by prefixing
270 the machine name with a username and an "@" character, a different
271 user may be selected. Use --setenv= to set environment variables
272 for the executed process.
273
274 Note that machinectl shell does not propagate the exit code/status
275 of the invoked shell process. Use systemd-run instead if that
276 information is required (see below).
277
278 When using the shell command without arguments, (thus invoking the
279 executed shell or command on the local host), it is in many ways
280 similar to a su(1) session, but, unlike su, completely isolates the
281 new session from the originating session, so that it shares no
282 process or session properties, and is in a clean and well-defined
283 state. It will be tracked in a new utmp, login, audit, security and
284 keyring session, and will not inherit any environment variables or
285 resource limits, among other properties.
286
287 Note that systemd-run(1) with its --machine= switch may be used in
288 place of the machinectl shell command, and allows non-interactive
289 operation, more detailed and low-level configuration of the invoked
290 unit, as well as access to runtime and exit code/status information
291 of the invoked shell process. In particular, use systemd-run's
292 --wait switch to propagate exit status information of the invoked
293 process. Use systemd-run's --pty switch for acquiring an
294 interactive shell, similar to machinectl shell. In general,
295 systemd-run is preferable for scripting purposes. However, note
296 that systemd-run might require higher privileges than machinectl
297 shell.
298
299 enable NAME..., disable NAME...
300 Enable or disable a container as a system service to start at
301 system boot, using systemd-nspawn(1). This enables or disables
302 systemd-nspawn@.service, instantiated for the specified machine
303 name, similar to the effect of systemctl enable or systemctl
304 disable on the service name.
305
306 poweroff NAME...
307 Power off one or more containers. This will trigger a reboot by
308 sending SIGRTMIN+4 to the container's init process, which causes
309 systemd-compatible init systems to shut down cleanly. Use stop as
310 alias for poweroff. This operation does not work on containers that
311 do not run a systemd(1)-compatible init system, such as sysvinit.
312 Use terminate (see below) to immediately terminate a container or
313 VM, without cleanly shutting it down.
314
315 reboot NAME...
316 Reboot one or more containers. This will trigger a reboot by
317 sending SIGINT to the container's init process, which is roughly
318 equivalent to pressing Ctrl+Alt+Del on a non-containerized system,
319 and is compatible with containers running any system manager.
320
321 terminate NAME...
322 Immediately terminates a virtual machine or container, without
323 cleanly shutting it down. This kills all processes of the virtual
324 machine or container and deallocates all resources attached to that
325 instance. Use poweroff to issue a clean shutdown request.
326
327 kill NAME...
328 Send a signal to one or more processes of the virtual machine or
329 container. This means processes as seen by the host, not the
330 processes inside the virtual machine or container. Use --kill-who=
331 to select which process to kill. Use --signal= to select the signal
332 to send.
333
334 bind NAME PATH [PATH]
335 Bind mounts a file or directory from the host into the specified
336 container. The first path argument is the source file or directory
337 on the host, the second path argument is the destination file or
338 directory in the container. When the latter is omitted, the
339 destination path in the container is the same as the source path on
340 the host. When combined with the --read-only switch, a ready-only
341 bind mount is created. When combined with the --mkdir switch, the
342 destination path is first created before the mount is applied. Note
343 that this option is currently only supported for systemd-nspawn(1)
344 containers, and only if user namespacing (--private-users) is not
345 used. This command supports bind mounting directories, regular
346 files, device nodes, AF_UNIX socket nodes, as well as FIFOs.
347
348 copy-to NAME PATH [PATH]
349 Copies files or directories from the host system into a running
350 container. Takes a container name, followed by the source path on
351 the host and the destination path in the container. If the
352 destination path is omitted, the same as the source path is used.
353
354 If host and container share the same user and group namespace, file
355 ownership by numeric user ID and group ID is preserved for the
356 copy, otherwise all files and directories in the copy will be owned
357 by the root user and group (UID/GID 0).
358
359 copy-from NAME PATH [PATH]
360 Copies files or directories from a container into the host system.
361 Takes a container name, followed by the source path in the
362 container the destination path on the host. If the destination path
363 is omitted, the same as the source path is used.
364
365 If host and container share the same user and group namespace, file
366 ownership by numeric user ID and group ID is preserved for the
367 copy, otherwise all files and directories in the copy will be owned
368 by the root user and group (UID/GID 0).
369
370 Image Commands
371 list-images
372 Show a list of locally installed container and VM images. This
373 enumerates all raw disk images and container directories and
374 subvolumes in /var/lib/machines/ (and other search paths, see
375 below). Use start (see above) to run a container off one of the
376 listed images. Note that, by default, containers whose name begins
377 with a dot (".") are not shown. To show these too, specify --all.
378 Note that a special image ".host" always implicitly exists and
379 refers to the image the host itself is booted from.
380
381 image-status [NAME...]
382 Show terse status information about one or more container or VM
383 images. This function is intended to generate human-readable
384 output. Use show-image (see below) to generate computer-parsable
385 output instead.
386
387 show-image [NAME...]
388 Show properties of one or more registered virtual machine or
389 container images, or the manager itself. If no argument is
390 specified, properties of the manager will be shown. If a NAME is
391 specified, properties of this virtual machine or container image
392 are shown. By default, empty properties are suppressed. Use --all
393 to show those too. To select specific properties to show, use
394 --property=. This command is intended to be used whenever
395 computer-parsable output is required. Use image-status if you are
396 looking for formatted human-readable output.
397
398 clone NAME NAME
399 Clones a container or VM image. The arguments specify the name of
400 the image to clone and the name of the newly cloned image. Note
401 that plain directory container images are cloned into btrfs
402 subvolume images with this command, if the underlying file system
403 supports this. Note that cloning a container or VM image is
404 optimized for file systems that support copy-on-write, and might
405 not be efficient on others, due to file system limitations.
406
407 Note that this command leaves host name, machine ID and all other
408 settings that could identify the instance unmodified. The original
409 image and the cloned copy will hence share these credentials, and
410 it might be necessary to manually change them in the copy.
411
412 If combined with the --read-only switch a read-only cloned image is
413 created.
414
415 rename NAME NAME
416 Renames a container or VM image. The arguments specify the name of
417 the image to rename and the new name of the image.
418
419 read-only NAME [BOOL]
420 Marks or (unmarks) a container or VM image read-only. Takes a VM or
421 container image name, followed by a boolean as arguments. If the
422 boolean is omitted, positive is implied, i.e. the image is marked
423 read-only.
424
425 remove NAME...
426 Removes one or more container or VM images. The special image
427 ".host", which refers to the host's own directory tree, may not be
428 removed.
429
430 set-limit [NAME] BYTES
431 Sets the maximum size in bytes that a specific container or VM
432 image, or all images, may grow up to on disk (disk quota). Takes
433 either one or two parameters. The first, optional parameter refers
434 to a container or VM image name. If specified, the size limit of
435 the specified image is changed. If omitted, the overall size limit
436 of the sum of all images stored locally is changed. The final
437 argument specifies the size limit in bytes, possibly suffixed by
438 the usual K, M, G, T units. If the size limit shall be disabled,
439 specify "-" as size.
440
441 Note that per-container size limits are only supported on btrfs
442 file systems.
443
444 clean
445 Remove hidden VM or container images (or all). This command removes
446 all hidden machine images from /var/lib/machines, i.e. those whose
447 name begins with a dot. Use machinectl list-images --all to see a
448 list of all machine images, including the hidden ones.
449
450 When combined with the --all switch removes all images, not just
451 hidden ones. This command effectively empties /var/lib/machines.
452
453 Note that commands such as machinectl pull-tar or machinectl
454 pull-raw usually create hidden, read-only, unmodified machine
455 images from the downloaded image first, before cloning a writable
456 working copy of it, in order to avoid duplicate downloads in case
457 of images that are reused multiple times. Use machinectl clean to
458 remove old, hidden images created this way.
459
460 Image Transfer Commands
461 pull-tar URL [NAME]
462 Downloads a .tar container image from the specified URL, and makes
463 it available under the specified local machine name. The URL must
464 be of type "http://" or "https://", and must refer to a .tar,
465 .tar.gz, .tar.xz or .tar.bz2 archive file. If the local machine
466 name is omitted, it is automatically derived from the last
467 component of the URL, with its suffix removed.
468
469 The image is verified before it is made available, unless
470 --verify=no is specified. Verification is done either via an inline
471 signed file with the name of the image and the suffix .sha256 or
472 via separate SHA256SUMS and SHA256SUMS.gpg files. The signature
473 files need to be made available on the same web server, under the
474 same URL as the .tar file. With --verify=checksum, only the SHA256
475 checksum for the file is verified, based on the .sha256 suffixed
476 file or the SHA256SUMS file. With --verify=signature, the sha
477 checksum file is first verified with the inline signature in the
478 .sha256 file or the detached GPG signature file SHA256SUMS.gpg. The
479 public key for this verification step needs to be available in
480 /usr/lib/systemd/import-pubring.gpg or
481 /etc/systemd/import-pubring.gpg.
482
483 The container image will be downloaded and stored in a read-only
484 subvolume in /var/lib/machines/ that is named after the specified
485 URL and its HTTP etag. A writable snapshot is then taken from this
486 subvolume, and named after the specified local name. This behavior
487 ensures that creating multiple container instances of the same URL
488 is efficient, as multiple downloads are not necessary. In order to
489 create only the read-only image, and avoid creating its writable
490 snapshot, specify "-" as local machine name.
491
492 Note that the read-only subvolume is prefixed with .tar-, and is
493 thus not shown by list-images, unless --all is passed.
494
495 Note that pressing C-c during execution of this command will not
496 abort the download. Use cancel-transfer, described below.
497
498 pull-raw URL [NAME]
499 Downloads a .raw container or VM disk image from the specified URL,
500 and makes it available under the specified local machine name. The
501 URL must be of type "http://" or "https://". The container image
502 must either be a .qcow2 or raw disk image, optionally compressed as
503 .gz, .xz, or .bz2. If the local machine name is omitted, it is
504 automatically derived from the last component of the URL, with its
505 suffix removed.
506
507 Image verification is identical for raw and tar images (see above).
508
509 If the downloaded image is in .qcow2 format it is converted into a
510 raw image file before it is made available.
511
512 Downloaded images of this type will be placed as read-only .raw
513 file in /var/lib/machines/. A local, writable (reflinked) copy is
514 then made under the specified local machine name. To omit creation
515 of the local, writable copy pass "-" as local machine name.
516
517 Similar to the behavior of pull-tar, the read-only image is
518 prefixed with .raw-, and thus not shown by list-images, unless
519 --all is passed.
520
521 Note that pressing C-c during execution of this command will not
522 abort the download. Use cancel-transfer, described below.
523
524 import-tar FILE [NAME], import-raw FILE [NAME]
525 Imports a TAR or RAW container or VM image, and places it under the
526 specified name in /var/lib/machines/. When import-tar is used, the
527 file specified as the first argument should be a tar archive,
528 possibly compressed with xz, gzip or bzip2. It will then be
529 unpacked into its own subvolume in /var/lib/machines. When
530 import-raw is used, the file should be a qcow2 or raw disk image,
531 possibly compressed with xz, gzip or bzip2. If the second argument
532 (the resulting image name) is not specified, it is automatically
533 derived from the file name. If the filename is passed as "-", the
534 image is read from standard input, in which case the second
535 argument is mandatory.
536
537 Optionally, the --read-only switch may be used to create a
538 read-only container or VM image. No cryptographic validation is
539 done when importing the images.
540
541 Much like image downloads, ongoing imports may be listed with
542 list-transfers and aborted with cancel-transfer.
543
544 import-fs DIRECTORY [NAME]
545 Imports a container image stored in a local directory into
546 /var/lib/machines/, operates similar to import-tar or import-raw,
547 but the first argument is the source directory. If supported, this
548 command will create btrfs snapshot or subvolume for the new image.
549
550 export-tar NAME [FILE], export-raw NAME [FILE]
551 Exports a TAR or RAW container or VM image and stores it in the
552 specified file. The first parameter should be a VM or container
553 image name. The second parameter should be a file path the TAR or
554 RAW image is written to. If the path ends in ".gz", the file is
555 compressed with gzip, if it ends in ".xz", with xz, and if it ends
556 in ".bz2", with bzip2. If the path ends in neither, the file is
557 left uncompressed. If the second argument is missing, the image is
558 written to standard output. The compression may also be explicitly
559 selected with the --format= switch. This is in particular useful if
560 the second parameter is left unspecified.
561
562 Much like image downloads and imports, ongoing exports may be
563 listed with list-transfers and aborted with cancel-transfer.
564
565 Note that, currently, only directory and subvolume images may be
566 exported as TAR images, and only raw disk images as RAW images.
567
568 list-transfers
569 Shows a list of container or VM image downloads, imports and
570 exports that are currently in progress.
571
572 cancel-transfer ID...
573 Aborts a download, import or export of the container or VM image
574 with the specified ID. To list ongoing transfers and their IDs, use
575 list-transfers.
576
578 The machinectl tool operates on machines and images whose names must be
579 chosen following strict rules. Machine names must be suitable for use
580 as host names following a conservative subset of DNS and UNIX/Linux
581 semantics. Specifically, they must consist of one or more non-empty
582 label strings, separated by dots. No leading or trailing dots are
583 allowed. No sequences of multiple dots are allowed. The label strings
584 may only consist of alphanumeric characters as well as the dash and
585 underscore. The maximum length of a machine name is 64 characters.
586
587 A special machine with the name ".host" refers to the running host
588 system itself. This is useful for execution operations or inspecting
589 the host system as well. Note that machinectl list will not show this
590 special machine unless the --all switch is specified.
591
592 Requirements on image names are less strict, however, they must be
593 valid UTF-8, must be suitable as file names (hence not be the single or
594 double dot, and not include a slash), and may not contain control
595 characters. Since many operations search for an image by the name of a
596 requested machine, it is recommended to name images in the same strict
597 fashion as machines.
598
599 A special image with the name ".host" refers to the image of the
600 running host system. It hence conceptually maps to the special ".host"
601 machine name described above. Note that machinectl list-images will not
602 show this special image either, unless --all is specified.
603
605 Machine images are preferably stored in /var/lib/machines/, but are
606 also searched for in /usr/local/lib/machines/ and /usr/lib/machines/.
607 For compatibility reasons, the directory /var/lib/container/ is
608 searched, too. Note that images stored below /usr are always considered
609 read-only. It is possible to symlink machines images from other
610 directories into /var/lib/machines/ to make them available for control
611 with machinectl.
612
613 Note that some image operations are only supported, efficient or atomic
614 on btrfs file systems.
615
616 Disk images are understood by systemd-nspawn(1) and machinectl in three
617 formats:
618
619 · A simple directory tree, containing the files and directories of
620 the container to boot.
621
622 · Subvolumes (on btrfs file systems), which are similar to the simple
623 directories, described above. However, they have additional
624 benefits, such as efficient cloning and quota reporting.
625
626 · "Raw" disk images, i.e. binary images of disks with a GPT or MBR
627 partition table. Images of this type are regular files with the
628 suffix ".raw".
629
630 See systemd-nspawn(1) for more information on image formats, in
631 particular its --directory= and --image= options.
632
634 Example 1. Download an Ubuntu image and open a shell in it
635
636 # machinectl pull-tar https://cloud-images.ubuntu.com/trusty/current/trusty-server-cloudimg-amd64-root.tar.gz
637 # systemd-nspawn -M trusty-server-cloudimg-amd64-root
638
639 This downloads and verifies the specified .tar image, and then uses
640 systemd-nspawn(1) to open a shell in it.
641
642 Example 2. Download a Fedora image, set a root password in it, start it
643 as service
644
645 # machinectl pull-raw --verify=no https://dl.fedoraproject.org/pub/fedora/linux/releases/27/CloudImages/x86_64/images/Fedora-Cloud-Base-27-1.6.x86_64.raw.xz
646 # systemd-nspawn -M Fedora-Cloud-Base-27-1.6.x86_64
647 # passwd
648 # exit
649 # machinectl start Fedora-Cloud-Base-27-1.6.x86_64
650 # machinectl login Fedora-Cloud-Base-27-1.6.x86_64
651
652 This downloads the specified .raw image with verification disabled.
653 Then, a shell is opened in it and a root password is set. Afterwards
654 the shell is left, and the machine started as system service. With the
655 last command a login prompt into the container is requested.
656
657 Example 3. Exports a container image as tar file
658
659 # machinectl export-tar fedora myfedora.tar.xz
660
661 Exports the container "fedora" as an xz-compressed tar file
662 myfedora.tar.xz into the current directory.
663
664 Example 4. Create a new shell session
665
666 # machinectl shell --uid=lennart
667
668 This creates a new shell session on the local host for the user ID
669 "lennart", in a su(1)-like fashion.
670
672 On success, 0 is returned, a non-zero failure code otherwise.
673
675 $SYSTEMD_PAGER
676 Pager to use when --no-pager is not given; overrides $PAGER. If
677 neither $SYSTEMD_PAGER nor $PAGER are set, a set of well-known
678 pager implementations are tried in turn, including less(1) and
679 more(1), until one is found. If no pager implementation is
680 discovered no pager is invoked. Setting this environment variable
681 to an empty string or the value "cat" is equivalent to passing
682 --no-pager.
683
684 $SYSTEMD_LESS
685 Override the options passed to less (by default "FRSXMK").
686
687 Users might want to change two options in particular:
688
689 K
690 This option instructs the pager to exit immediately when Ctrl+C
691 is pressed. To allow less to handle Ctrl+C itself to switch
692 back to the pager command prompt, unset this option.
693
694 If the value of $SYSTEMD_LESS does not include "K", and the
695 pager that is invoked is less, Ctrl+C will be ignored by the
696 executable, and needs to be handled by the pager.
697
698 X
699 This option instructs the pager to not send termcap
700 initialization and deinitialization strings to the terminal. It
701 is set by default to allow command output to remain visible in
702 the terminal even after the pager exits. Nevertheless, this
703 prevents some pager functionality from working, in particular
704 paged output cannot be scrolled with the mouse.
705
706 See less(1) for more discussion.
707
708 $SYSTEMD_LESSCHARSET
709 Override the charset passed to less (by default "utf-8", if the
710 invoking terminal is determined to be UTF-8 compatible).
711
712 $SYSTEMD_COLORS
713 The value must be a boolean. Controls whether colorized output
714 should be generated. This can be specified to override the decision
715 that systemd makes based on $TERM and what the console is connected
716 to.
717
718 $SYSTEMD_URLIFY
719 The value must be a boolean. Controls whether clickable links
720 should be generated in the output for terminal emulators supporting
721 this. This can be specified to override the decision that systemd
722 makes based on $TERM and other conditions.
723
725 systemd(1), systemd-machined.service(8), systemd-nspawn(1),
726 systemd.special(7), tar(1), xz(1), gzip(1), bzip2(1)
727
728
729
730systemd 243 MACHINECTL(1)