1MACHINECTL(1)                     machinectl                     MACHINECTL(1)
2
3
4

NAME

6       machinectl - Control the systemd machine manager
7

SYNOPSIS

9       machinectl [OPTIONS...] {COMMAND} [NAME...]
10

DESCRIPTION

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 hostnames. 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

COMMANDS

50       The following commands are understood:
51
52   Machine Commands
53       list
54           List currently running (online) virtual machines and containers. To
55           enumerate machine images that can be started, use list-images (see
56           below). Note that this command hides the special ".host" machine by
57           default. Use the --all switch to show it.
58
59       status NAME...
60           Show runtime status information about one or more virtual machines
61           and containers, followed by the most recent log data from the
62           journal. This function is intended to generate human-readable
63           output. If you are looking for computer-parsable output, use show
64           instead. Note that the log data shown is reported by the virtual
65           machine or container manager, and frequently contains console
66           output of the machine, but not necessarily journal contents of the
67           machine itself.
68
69       show [NAME...]
70           Show properties of one or more registered virtual machines or
71           containers or the manager itself. If no argument is specified,
72           properties of the manager will be shown. If a NAME is specified,
73           properties of this virtual machine or container are shown. By
74           default, empty properties are suppressed. Use --all to show those
75           too. To select specific properties to show, use --property=. This
76           command is intended to be used whenever computer-parsable output is
77           required, and does not print the control group tree or journal
78           entries. Use status if you are looking for formatted human-readable
79           output.
80
81       start NAME...
82           Start a container as a system service, using systemd-nspawn(1).
83           This starts systemd-nspawn@.service, instantiated for the specified
84           machine name, similar to the effect of systemctl start on the
85           service name.  systemd-nspawn looks for a container image by the
86           specified name in /var/lib/machines/ (and other search paths, see
87           below) and runs it. Use list-images (see below) for listing
88           available container images to start.
89
90           Note that systemd-machined.service(8) also interfaces with a
91           variety of other container and VM managers, systemd-nspawn is just
92           one implementation of it. Most of the commands available in
93           machinectl may be used on containers or VMs controlled by other
94           managers, not just systemd-nspawn. Starting VMs and container
95           images on those managers requires manager-specific tools.
96
97           To interactively start a container on the command line with full
98           access to the container's console, please invoke systemd-nspawn
99           directly. To stop a running container use machinectl poweroff.
100
101       login [NAME]
102           Open an interactive terminal login session in a container or on the
103           local host. If an argument is supplied, it refers to the container
104           machine to connect to. If none is specified, or the container name
105           is specified as the empty string, or the special machine name
106           ".host" (see below) is specified, the connection is made to the
107           local host instead. This will create a TTY connection to a specific
108           container or the local host and asks for the execution of a getty
109           on it. Note that this is only supported for containers running
110           systemd(1) as init system.
111
112           This command will open a full login prompt on the container or the
113           local host, which then asks for username and password. Use shell
114           (see below) or systemd-run(1) with the --machine= switch to
115           directly invoke a single command, either interactively or in the
116           background.
117
118       shell [[NAME@]NAME [PATH [ARGUMENTS...]]]
119           Open an interactive shell session in a container or on the local
120           host. The first argument refers to the container machine to connect
121           to. If none is specified, or the machine name is specified as the
122           empty string, or the special machine name ".host" (see below) is
123           specified, the connection is made to the local host instead. This
124           works similar to login but immediately invokes a user process. This
125           command runs the specified executable with the specified arguments,
126           or the default shell for the user if none is specified, or /bin/sh
127           if no default shell is found. By default, --uid=, or by prefixing
128           the machine name with a username and an "@" character, a different
129           user may be selected. Use --setenv= to set environment variables
130           for the executed process.
131
132           Note that machinectl shell does not propagate the exit code/status
133           of the invoked shell process. Use systemd-run instead if that
134           information is required (see below).
135
136           When using the shell command without arguments, (thus invoking the
137           executed shell or command on the local host), it is in many ways
138           similar to a su(1) session, but, unlike su, completely isolates the
139           new session from the originating session, so that it shares no
140           process or session properties, and is in a clean and well-defined
141           state. It will be tracked in a new utmp, login, audit, security and
142           keyring session, and will not inherit any environment variables or
143           resource limits, among other properties.
144
145           Note that systemd-run(1) with its --machine= switch may be used in
146           place of the machinectl shell command, and allows non-interactive
147           operation, more detailed and low-level configuration of the invoked
148           unit, as well as access to runtime and exit code/status information
149           of the invoked shell process. In particular, use systemd-run's
150           --wait switch to propagate exit status information of the invoked
151           process. Use systemd-run's --pty switch for acquiring an
152           interactive shell, similar to machinectl shell. In general,
153           systemd-run is preferable for scripting purposes. However, note
154           that systemd-run might require higher privileges than machinectl
155           shell.
156
157       enable NAME..., disable NAME...
158           Enable or disable a container as a system service to start at
159           system boot, using systemd-nspawn(1). This enables or disables
160           systemd-nspawn@.service, instantiated for the specified machine
161           name, similar to the effect of systemctl enable or systemctl
162           disable on the service name.
163
164       poweroff NAME...
165           Power off one or more containers. This will trigger a reboot by
166           sending SIGRTMIN+4 to the container's init process, which causes
167           systemd-compatible init systems to shut down cleanly. Use stop as
168           alias for poweroff. This operation does not work on containers that
169           do not run a systemd(1)-compatible init system, such as sysvinit.
170           Use terminate (see below) to immediately terminate a container or
171           VM, without cleanly shutting it down.
172
173       reboot NAME...
174           Reboot one or more containers. This will trigger a reboot by
175           sending SIGINT to the container's init process, which is roughly
176           equivalent to pressing Ctrl+Alt+Del on a non-containerized system,
177           and is compatible with containers running any system manager.
178
179       terminate NAME...
180           Immediately terminates a virtual machine or container, without
181           cleanly shutting it down. This kills all processes of the virtual
182           machine or container and deallocates all resources attached to that
183           instance. Use poweroff to issue a clean shutdown request.
184
185       kill NAME...
186           Send a signal to one or more processes of the virtual machine or
187           container. This means processes as seen by the host, not the
188           processes inside the virtual machine or container. Use --kill-who=
189           to select which process to kill. Use --signal= to select the signal
190           to send.
191
192       bind NAME PATH [PATH]
193           Bind mounts a file or directory from the host into the specified
194           container. The first path argument is the source file or directory
195           on the host, the second path argument is the destination file or
196           directory in the container. When the latter is omitted, the
197           destination path in the container is the same as the source path on
198           the host. When combined with the --read-only switch, a ready-only
199           bind mount is created. When combined with the --mkdir switch, the
200           destination path is first created before the mount is applied. Note
201           that this option is currently only supported for systemd-nspawn(1)
202           containers, and only if user namespacing (--private-users) is not
203           used. This command supports bind mounting directories, regular
204           files, device nodes, AF_UNIX socket nodes, as well as FIFOs.
205
206       copy-to NAME PATH [PATH]
207           Copies files or directories from the host system into a running
208           container. Takes a container name, followed by the source path on
209           the host and the destination path in the container. If the
210           destination path is omitted, the same as the source path is used.
211
212           If host and container share the same user and group namespace, file
213           ownership by numeric user ID and group ID is preserved for the
214           copy, otherwise all files and directories in the copy will be owned
215           by the root user and group (UID/GID 0).
216
217       copy-from NAME PATH [PATH]
218           Copies files or directories from a container into the host system.
219           Takes a container name, followed by the source path in the
220           container and the destination path on the host. If the destination
221           path is omitted, the same as the source path is used.
222
223           If host and container share the same user and group namespace, file
224           ownership by numeric user ID and group ID is preserved for the
225           copy, otherwise all files and directories in the copy will be owned
226           by the root user and group (UID/GID 0).
227
228   Image Commands
229       list-images
230           Show a list of locally installed container and VM images. This
231           enumerates all raw disk images and container directories and
232           subvolumes in /var/lib/machines/ (and other search paths, see
233           below). Use start (see above) to run a container off one of the
234           listed images. Note that, by default, containers whose name begins
235           with a dot (".") are not shown. To show these too, specify --all.
236           Note that a special image ".host" always implicitly exists and
237           refers to the image the host itself is booted from.
238
239       image-status [NAME...]
240           Show terse status information about one or more container or VM
241           images. This function is intended to generate human-readable
242           output. Use show-image (see below) to generate computer-parsable
243           output instead.
244
245       show-image [NAME...]
246           Show properties of one or more registered virtual machine or
247           container images, or the manager itself. If no argument is
248           specified, properties of the manager will be shown. If a NAME is
249           specified, properties of this virtual machine or container image
250           are shown. By default, empty properties are suppressed. Use --all
251           to show those too. To select specific properties to show, use
252           --property=. This command is intended to be used whenever
253           computer-parsable output is required. Use image-status if you are
254           looking for formatted human-readable output.
255
256       clone NAME NAME
257           Clones a container or VM image. The arguments specify the name of
258           the image to clone and the name of the newly cloned image. Note
259           that plain directory container images are cloned into btrfs
260           subvolume images with this command, if the underlying file system
261           supports this. Note that cloning a container or VM image is
262           optimized for file systems that support copy-on-write, and might
263           not be efficient on others, due to file system limitations.
264
265           Note that this command leaves hostname, machine ID and all other
266           settings that could identify the instance unmodified. The original
267           image and the cloned copy will hence share these credentials, and
268           it might be necessary to manually change them in the copy.
269
270           If combined with the --read-only switch a read-only cloned image is
271           created.
272
273       rename NAME NAME
274           Renames a container or VM image. The arguments specify the name of
275           the image to rename and the new name of the image.
276
277       read-only NAME [BOOL]
278           Marks or (unmarks) a container or VM image read-only. Takes a VM or
279           container image name, followed by a boolean as arguments. If the
280           boolean is omitted, positive is implied, i.e. the image is marked
281           read-only.
282
283       remove NAME...
284           Removes one or more container or VM images. The special image
285           ".host", which refers to the host's own directory tree, may not be
286           removed.
287
288       set-limit [NAME] BYTES
289           Sets the maximum size in bytes that a specific container or VM
290           image, or all images, may grow up to on disk (disk quota). Takes
291           either one or two parameters. The first, optional parameter refers
292           to a container or VM image name. If specified, the size limit of
293           the specified image is changed. If omitted, the overall size limit
294           of the sum of all images stored locally is changed. The final
295           argument specifies the size limit in bytes, possibly suffixed by
296           the usual K, M, G, T units. If the size limit shall be disabled,
297           specify "-" as size.
298
299           Note that per-container size limits are only supported on btrfs
300           file systems.
301
302       clean
303           Remove hidden VM or container images (or all). This command removes
304           all hidden machine images from /var/lib/machines/, i.e. those whose
305           name begins with a dot. Use machinectl list-images --all to see a
306           list of all machine images, including the hidden ones.
307
308           When combined with the --all switch removes all images, not just
309           hidden ones. This command effectively empties /var/lib/machines/.
310
311           Note that commands such as machinectl pull-tar or machinectl
312           pull-raw usually create hidden, read-only, unmodified machine
313           images from the downloaded image first, before cloning a writable
314           working copy of it, in order to avoid duplicate downloads in case
315           of images that are reused multiple times. Use machinectl clean to
316           remove old, hidden images created this way.
317
318   Image Transfer Commands
319       pull-tar URL [NAME]
320           Downloads a .tar container image from the specified URL, and makes
321           it available under the specified local machine name. The URL must
322           be of type "http://" or "https://", and must refer to a .tar,
323           .tar.gz, .tar.xz or .tar.bz2 archive file. If the local machine
324           name is omitted, it is automatically derived from the last
325           component of the URL, with its suffix removed.
326
327           The image is verified before it is made available, unless
328           --verify=no is specified. Verification is done either via an inline
329           signed file with the name of the image and the suffix .sha256 or
330           via separate SHA256SUMS and SHA256SUMS.gpg files. The signature
331           files need to be made available on the same web server, under the
332           same URL as the .tar file. With --verify=checksum, only the SHA256
333           checksum for the file is verified, based on the .sha256 suffixed
334           file or the SHA256SUMS file. With --verify=signature, the sha
335           checksum file is first verified with the inline signature in the
336           .sha256 file or the detached GPG signature file SHA256SUMS.gpg. The
337           public key for this verification step needs to be available in
338           /usr/lib/systemd/import-pubring.gpg or
339           /etc/systemd/import-pubring.gpg.
340
341           The container image will be downloaded and stored in a read-only
342           subvolume in /var/lib/machines/ that is named after the specified
343           URL and its HTTP etag. A writable snapshot is then taken from this
344           subvolume, and named after the specified local name. This behavior
345           ensures that creating multiple container instances of the same URL
346           is efficient, as multiple downloads are not necessary. In order to
347           create only the read-only image, and avoid creating its writable
348           snapshot, specify "-" as local machine name.
349
350           Note that the read-only subvolume is prefixed with .tar-, and is
351           thus not shown by list-images, unless --all is passed.
352
353           Note that pressing C-c during execution of this command will not
354           abort the download. Use cancel-transfer, described below.
355
356       pull-raw URL [NAME]
357           Downloads a .raw container or VM disk image from the specified URL,
358           and makes it available under the specified local machine name. The
359           URL must be of type "http://" or "https://". The container image
360           must either be a .qcow2 or raw disk image, optionally compressed as
361           .gz, .xz, or .bz2. If the local machine name is omitted, it is
362           automatically derived from the last component of the URL, with its
363           suffix removed.
364
365           Image verification is identical for raw and tar images (see above).
366
367           If the downloaded image is in .qcow2 format it is converted into a
368           raw image file before it is made available.
369
370           Downloaded images of this type will be placed as read-only .raw
371           file in /var/lib/machines/. A local, writable (reflinked) copy is
372           then made under the specified local machine name. To omit creation
373           of the local, writable copy pass "-" as local machine name.
374
375           Similar to the behavior of pull-tar, the read-only image is
376           prefixed with .raw-, and thus not shown by list-images, unless
377           --all is passed.
378
379           Note that pressing C-c during execution of this command will not
380           abort the download. Use cancel-transfer, described below.
381
382       import-tar FILE [NAME], import-raw FILE [NAME]
383           Imports a TAR or RAW container or VM image, and places it under the
384           specified name in /var/lib/machines/. When import-tar is used, the
385           file specified as the first argument should be a tar archive,
386           possibly compressed with xz, gzip or bzip2. It will then be
387           unpacked into its own subvolume in /var/lib/machines/. When
388           import-raw is used, the file should be a qcow2 or raw disk image,
389           possibly compressed with xz, gzip or bzip2. If the second argument
390           (the resulting image name) is not specified, it is automatically
391           derived from the file name. If the filename is passed as "-", the
392           image is read from standard input, in which case the second
393           argument is mandatory.
394
395           Optionally, the --read-only switch may be used to create a
396           read-only container or VM image. No cryptographic validation is
397           done when importing the images.
398
399           Much like image downloads, ongoing imports may be listed with
400           list-transfers and aborted with cancel-transfer.
401
402       import-fs DIRECTORY [NAME]
403           Imports a container image stored in a local directory into
404           /var/lib/machines/, operates similar to import-tar or import-raw,
405           but the first argument is the source directory. If supported, this
406           command will create btrfs snapshot or subvolume for the new image.
407
408       export-tar NAME [FILE], export-raw NAME [FILE]
409           Exports a TAR or RAW container or VM image and stores it in the
410           specified file. The first parameter should be a VM or container
411           image name. The second parameter should be a file path the TAR or
412           RAW image is written to. If the path ends in ".gz", the file is
413           compressed with gzip, if it ends in ".xz", with xz, and if it ends
414           in ".bz2", with bzip2. If the path ends in neither, the file is
415           left uncompressed. If the second argument is missing, the image is
416           written to standard output. The compression may also be explicitly
417           selected with the --format= switch. This is in particular useful if
418           the second parameter is left unspecified.
419
420           Much like image downloads and imports, ongoing exports may be
421           listed with list-transfers and aborted with cancel-transfer.
422
423           Note that, currently, only directory and subvolume images may be
424           exported as TAR images, and only raw disk images as RAW images.
425
426       list-transfers
427           Shows a list of container or VM image downloads, imports and
428           exports that are currently in progress.
429
430       cancel-transfer ID...
431           Aborts a download, import or export of the container or VM image
432           with the specified ID. To list ongoing transfers and their IDs, use
433           list-transfers.
434

OPTIONS

436       The following options are understood:
437
438       -p, --property=
439           When showing machine or image properties, limit the output to
440           certain properties as specified by the argument. If not specified,
441           all set properties are shown. The argument should be a property
442           name, such as "Name". If specified more than once, all properties
443           with the specified names are shown.
444
445       -a, --all
446           When showing machine or image properties, show all properties
447           regardless of whether they are set or not.
448
449           When listing VM or container images, do not suppress images
450           beginning in a dot character (".").
451
452           When cleaning VM or container images, remove all images, not just
453           hidden ones.
454
455       --value
456           When printing properties with show, only print the value, and skip
457           the property name and "=".
458
459       -l, --full
460           Do not ellipsize process tree entries or table. This implies
461           --max-addresses=full.
462
463       --kill-who=
464           When used with kill, choose which processes to kill. Must be one of
465           leader, or all to select whether to kill only the leader process of
466           the machine or all processes of the machine. If omitted, defaults
467           to all.
468
469       -s, --signal=
470           When used with kill, choose which signal to send to selected
471           processes. Must be one of the well-known signal specifiers such as
472           SIGTERM, SIGINT or SIGSTOP. If omitted, defaults to SIGTERM.
473
474           The special value "help" will list the known values and the program
475           will exit immediately, and the special value "list" will list known
476           values along with the numerical signal numbers and the program will
477           exit immediately.
478
479       --uid=
480           When used with the shell command, chooses the user ID to open the
481           interactive shell session as. If the argument to the shell command
482           also specifies a user name, this option is ignored. If the name is
483           not specified in either way, "root" will be used by default. Note
484           that this switch is not supported for the login command (see
485           below).
486
487       -E NAME[=VALUE], --setenv=NAME[=VALUE]
488           When used with the shell command, sets an environment variable for
489           the executed shell. This option may be used more than once to set
490           multiple variables. When "=" and VALUE are omitted, the value of
491           the variable with the same name in the program environment will be
492           used.
493
494           Note that this option is not supported for the login command.
495
496       --mkdir
497           When used with bind, creates the destination file or directory
498           before applying the bind mount. Note that even though the name of
499           this option suggests that it is suitable only for directories, this
500           option also creates the destination file node to mount over if the
501           object to mount is not a directory, but a regular file, device
502           node, socket or FIFO.
503
504       --read-only
505           When used with bind, creates a read-only bind mount.
506
507           When used with clone, import-raw or import-tar a read-only
508           container or VM image is created.
509
510       -n, --lines=
511           When used with status, controls the number of journal lines to
512           show, counting from the most recent ones. Takes a positive integer
513           argument. Defaults to 10.
514
515       -o, --output=
516           When used with status, controls the formatting of the journal
517           entries that are shown. For the available choices, see
518           journalctl(1). Defaults to "short".
519
520       --verify=
521           When downloading a container or VM image, specify whether the image
522           shall be verified before it is made available. Takes one of "no",
523           "checksum" and "signature". If "no", no verification is done. If
524           "checksum" is specified, the download is checked for integrity
525           after the transfer is complete, but no signatures are verified. If
526           "signature" is specified, the checksum is verified and the image's
527           signature is checked against a local keyring of trustable vendors.
528           It is strongly recommended to set this option to "signature" if the
529           server and protocol support this. Defaults to "signature".
530
531       --force
532           When downloading a container or VM image, and a local copy by the
533           specified local machine name already exists, delete it first and
534           replace it by the newly downloaded image.
535
536       --format=
537           When used with the export-tar or export-raw commands, specifies the
538           compression format to use for the resulting file. Takes one of
539           "uncompressed", "xz", "gzip", "bzip2". By default, the format is
540           determined automatically from the image file name passed.
541
542       --max-addresses=
543           When used with the list-machines command, limits the number of ip
544           addresses output for every machine. Defaults to 1. All addresses
545           can be requested with "all" as argument to --max-addresses=. If the
546           argument to --max-addresses= is less than the actual number of
547           addresses, "..."follows the last address.
548
549       -q, --quiet
550           Suppresses additional informational output while running.
551
552       -H, --host=
553           Execute the operation remotely. Specify a hostname, or a username
554           and hostname separated by "@", to connect to. The hostname may
555           optionally be suffixed by a port ssh is listening on, separated by
556           ":", and then a container name, separated by "/", which connects
557           directly to a specific container on the specified host. This will
558           use SSH to talk to the remote machine manager instance. Container
559           names may be enumerated with machinectl -H HOST. Put IPv6 addresses
560           in brackets.
561
562       -M, --machine=
563           Connect to systemd-machined.service(8) running in a local
564           container, to perform the specified operation within the container.
565
566       --no-pager
567           Do not pipe output into a pager.
568
569       --no-legend
570           Do not print the legend, i.e. column headers and the footer with
571           hints.
572
573       --no-ask-password
574           Do not query the user for authentication for privileged operations.
575
576       -h, --help
577           Print a short help text and exit.
578
579       --version
580           Print a short version string and exit.
581

MACHINE AND IMAGE NAMES

583       The machinectl tool operates on machines and images whose names must be
584       chosen following strict rules. Machine names must be suitable for use
585       as hostnames following a conservative subset of DNS and UNIX/Linux
586       semantics. Specifically, they must consist of one or more non-empty
587       label strings, separated by dots. No leading or trailing dots are
588       allowed. No sequences of multiple dots are allowed. The label strings
589       may only consist of alphanumeric characters as well as the dash and
590       underscore. The maximum length of a machine name is 64 characters.
591
592       A special machine with the name ".host" refers to the running host
593       system itself. This is useful for execution operations or inspecting
594       the host system as well. Note that machinectl list will not show this
595       special machine unless the --all switch is specified.
596
597       Requirements on image names are less strict, however, they must be
598       valid UTF-8, must be suitable as file names (hence not be the single or
599       double dot, and not include a slash), and may not contain control
600       characters. Since many operations search for an image by the name of a
601       requested machine, it is recommended to name images in the same strict
602       fashion as machines.
603
604       A special image with the name ".host" refers to the image of the
605       running host system. It hence conceptually maps to the special ".host"
606       machine name described above. Note that machinectl list-images will not
607       show this special image either, unless --all is specified.
608

FILES AND DIRECTORIES

610       Machine images are preferably stored in /var/lib/machines/, but are
611       also searched for in /usr/local/lib/machines/ and /usr/lib/machines/.
612       For compatibility reasons, the directory /var/lib/container/ is
613       searched, too. Note that images stored below /usr/ are always
614       considered read-only. It is possible to symlink machines images from
615       other directories into /var/lib/machines/ to make them available for
616       control with machinectl.
617
618       Note that some image operations are only supported, efficient or atomic
619       on btrfs file systems.
620
621       Disk images are understood by systemd-nspawn(1) and machinectl in three
622       formats:
623
624       •   A simple directory tree, containing the files and directories of
625           the container to boot.
626
627       •   Subvolumes (on btrfs file systems), which are similar to the simple
628           directories, described above. However, they have additional
629           benefits, such as efficient cloning and quota reporting.
630
631       •   "Raw" disk images, i.e. binary images of disks with a GPT or MBR
632           partition table. Images of this type are regular files with the
633           suffix ".raw".
634
635       See systemd-nspawn(1) for more information on image formats, in
636       particular its --directory= and --image= options.
637

EXAMPLES

639       Example 1. Download an Ubuntu image and open a shell in it
640
641           # machinectl pull-tar https://cloud-images.ubuntu.com/trusty/current/trusty-server-cloudimg-amd64-root.tar.gz
642           # systemd-nspawn -M trusty-server-cloudimg-amd64-root
643
644       This downloads and verifies the specified .tar image, and then uses
645       systemd-nspawn(1) to open a shell in it.
646
647       Example 2. Download a Fedora image, set a root password in it, start it
648       as a service
649
650           # machinectl pull-raw --verify=no \
651                 https://download.fedoraproject.org/pub/fedora/linux/releases/36/Cloud/x86_64/images/Fedora-Cloud-Base-36-1.5.x86_64.raw.xz \
652                 Fedora-Cloud-Base-36-1.5.x86-64
653           # systemd-nspawn -M Fedora-Cloud-Base-36-1.5.x86-64
654           # passwd
655           # exit
656           # machinectl start Fedora-Cloud-Base-36-1.5.x86-64
657           # machinectl login Fedora-Cloud-Base-36-1.5.x86-64
658
659       This downloads the specified .raw image with verification disabled.
660       Then, a shell is opened in it and a root password is set. Afterwards
661       the shell is left, and the machine started as system service. With the
662       last command a login prompt into the container is requested.
663
664       Example 3. Exports a container image as tar file
665
666           # machinectl export-tar fedora myfedora.tar.xz
667
668       Exports the container "fedora" as an xz-compressed tar file
669       myfedora.tar.xz into the current directory.
670
671       Example 4. Create a new shell session
672
673           # machinectl shell --uid=lennart
674
675       This creates a new shell session on the local host for the user ID
676       "lennart", in a su(1)-like fashion.
677

EXIT STATUS

679       On success, 0 is returned, a non-zero failure code otherwise.
680

ENVIRONMENT

682       $SYSTEMD_LOG_LEVEL
683           The maximum log level of emitted messages (messages with a higher
684           log level, i.e. less important ones, will be suppressed). Either
685           one of (in order of decreasing importance) emerg, alert, crit, err,
686           warning, notice, info, debug, or an integer in the range 0...7. See
687           syslog(3) for more information.
688
689       $SYSTEMD_LOG_COLOR
690           A boolean. If true, messages written to the tty will be colored
691           according to priority.
692
693           This setting is only useful when messages are written directly to
694           the terminal, because journalctl(1) and other tools that display
695           logs will color messages based on the log level on their own.
696
697       $SYSTEMD_LOG_TIME
698           A boolean. If true, console log messages will be prefixed with a
699           timestamp.
700
701           This setting is only useful when messages are written directly to
702           the terminal or a file, because journalctl(1) and other tools that
703           display logs will attach timestamps based on the entry metadata on
704           their own.
705
706       $SYSTEMD_LOG_LOCATION
707           A boolean. If true, messages will be prefixed with a filename and
708           line number in the source code where the message originates.
709
710           Note that the log location is often attached as metadata to journal
711           entries anyway. Including it directly in the message text can
712           nevertheless be convenient when debugging programs.
713
714       $SYSTEMD_LOG_TID
715           A boolean. If true, messages will be prefixed with the current
716           numerical thread ID (TID).
717
718           Note that the this information is attached as metadata to journal
719           entries anyway. Including it directly in the message text can
720           nevertheless be convenient when debugging programs.
721
722       $SYSTEMD_LOG_TARGET
723           The destination for log messages. One of console (log to the
724           attached tty), console-prefixed (log to the attached tty but with
725           prefixes encoding the log level and "facility", see syslog(3), kmsg
726           (log to the kernel circular log buffer), journal (log to the
727           journal), journal-or-kmsg (log to the journal if available, and to
728           kmsg otherwise), auto (determine the appropriate log target
729           automatically, the default), null (disable log output).
730
731       $SYSTEMD_PAGER
732           Pager to use when --no-pager is not given; overrides $PAGER. If
733           neither $SYSTEMD_PAGER nor $PAGER are set, a set of well-known
734           pager implementations are tried in turn, including less(1) and
735           more(1), until one is found. If no pager implementation is
736           discovered no pager is invoked. Setting this environment variable
737           to an empty string or the value "cat" is equivalent to passing
738           --no-pager.
739
740       $SYSTEMD_LESS
741           Override the options passed to less (by default "FRSXMK").
742
743           Users might want to change two options in particular:
744
745           K
746               This option instructs the pager to exit immediately when Ctrl+C
747               is pressed. To allow less to handle Ctrl+C itself to switch
748               back to the pager command prompt, unset this option.
749
750               If the value of $SYSTEMD_LESS does not include "K", and the
751               pager that is invoked is less, Ctrl+C will be ignored by the
752               executable, and needs to be handled by the pager.
753
754           X
755               This option instructs the pager to not send termcap
756               initialization and deinitialization strings to the terminal. It
757               is set by default to allow command output to remain visible in
758               the terminal even after the pager exits. Nevertheless, this
759               prevents some pager functionality from working, in particular
760               paged output cannot be scrolled with the mouse.
761
762           See less(1) for more discussion.
763
764       $SYSTEMD_LESSCHARSET
765           Override the charset passed to less (by default "utf-8", if the
766           invoking terminal is determined to be UTF-8 compatible).
767
768       $SYSTEMD_PAGERSECURE
769           Takes a boolean argument. When true, the "secure" mode of the pager
770           is enabled; if false, disabled. If $SYSTEMD_PAGERSECURE is not set
771           at all, secure mode is enabled if the effective UID is not the same
772           as the owner of the login session, see geteuid(2) and
773           sd_pid_get_owner_uid(3). In secure mode, LESSSECURE=1 will be set
774           when invoking the pager, and the pager shall disable commands that
775           open or create new files or start new subprocesses. When
776           $SYSTEMD_PAGERSECURE is not set at all, pagers which are not known
777           to implement secure mode will not be used. (Currently only less(1)
778           implements secure mode.)
779
780           Note: when commands are invoked with elevated privileges, for
781           example under sudo(8) or pkexec(1), care must be taken to ensure
782           that unintended interactive features are not enabled. "Secure" mode
783           for the pager may be enabled automatically as describe above.
784           Setting SYSTEMD_PAGERSECURE=0 or not removing it from the inherited
785           environment allows the user to invoke arbitrary commands. Note that
786           if the $SYSTEMD_PAGER or $PAGER variables are to be honoured,
787           $SYSTEMD_PAGERSECURE must be set too. It might be reasonable to
788           completely disable the pager using --no-pager instead.
789
790       $SYSTEMD_COLORS
791           Takes a boolean argument. When true, systemd and related utilities
792           will use colors in their output, otherwise the output will be
793           monochrome. Additionally, the variable can take one of the
794           following special values: "16", "256" to restrict the use of colors
795           to the base 16 or 256 ANSI colors, respectively. This can be
796           specified to override the automatic decision based on $TERM and
797           what the console is connected to.
798
799       $SYSTEMD_URLIFY
800           The value must be a boolean. Controls whether clickable links
801           should be generated in the output for terminal emulators supporting
802           this. This can be specified to override the decision that systemd
803           makes based on $TERM and other conditions.
804

SEE ALSO

806       systemd(1), systemd-machined.service(8), systemd-nspawn(1),
807       systemd.special(7), tar(1), xz(1), gzip(1), bzip2(1)
808
809
810
811systemd 250                                                      MACHINECTL(1)
Impressum