]> git.ipfire.org Git - thirdparty/systemd.git/blame - man/machinectl.xml
man: update version information
[thirdparty/systemd.git] / man / machinectl.xml
CommitLineData
514094f9 1<?xml version='1.0'?>
3a54a157 2<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
5fadff33
ZJS
3 "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd" [
4<!ENTITY % entities SYSTEM "custom-entities.ent" >
5%entities;
6]>
db9ecf05 7<!-- SPDX-License-Identifier: LGPL-2.1-or-later -->
19887cd0 8
21ac6ff1 9<refentry id="machinectl" conditional='ENABLE_MACHINED'
798d3a52
ZJS
10 xmlns:xi="http://www.w3.org/2001/XInclude">
11
12 <refentryinfo>
13 <title>machinectl</title>
14 <productname>systemd</productname>
798d3a52
ZJS
15 </refentryinfo>
16
17 <refmeta>
18 <refentrytitle>machinectl</refentrytitle>
19 <manvolnum>1</manvolnum>
20 </refmeta>
21
22 <refnamediv>
23 <refname>machinectl</refname>
24 <refpurpose>Control the systemd machine manager</refpurpose>
25 </refnamediv>
26
27 <refsynopsisdiv>
28 <cmdsynopsis>
29 <command>machinectl</command>
30 <arg choice="opt" rep="repeat">OPTIONS</arg>
31 <arg choice="req">COMMAND</arg>
32 <arg choice="opt" rep="repeat">NAME</arg>
33 </cmdsynopsis>
34 </refsynopsisdiv>
35
36 <refsect1>
37 <title>Description</title>
38
39 <para><command>machinectl</command> may be used to introspect and
40 control the state of the
41 <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>
42 virtual machine and container registration manager
43 <citerefentry><refentrytitle>systemd-machined.service</refentrytitle><manvolnum>8</manvolnum></citerefentry>.</para>
91913f58
LP
44
45 <para><command>machinectl</command> may be used to execute
46 operations on machines and images. Machines in this sense are
47 considered running instances of:</para>
48
49 <itemizedlist>
50 <listitem><para>Virtual Machines (VMs) that virtualize hardware
51 to run full operating system (OS) instances (including their kernels)
52 in a virtualized environment on top of the host OS.</para></listitem>
53
54 <listitem><para>Containers that share the hardware and
55 OS kernel with the host OS, in order to run
56 OS userspace instances on top the host OS.</para></listitem>
57
fa69a4c7 58 <listitem><para>The host system itself.</para></listitem>
91913f58
LP
59 </itemizedlist>
60
61 <para>Machines are identified by names that follow the same rules
38b38500 62 as UNIX and DNS hostnames. For details, see below.</para>
fa69a4c7
ZJS
63
64 <para>Machines are instantiated from disk or file system images that
65 frequently — but not necessarily — carry the same name as machines running
66 from them. Images in this sense may be:</para>
91913f58
LP
67
68 <itemizedlist>
fa69a4c7 69 <listitem><para>Directory trees containing an OS, including the
3b121157
ZJS
70 top-level directories <filename>/usr/</filename>,
71 <filename>/etc/</filename>, and so on.</para></listitem>
91913f58 72
576cf244 73 <listitem><para>btrfs subvolumes containing OS trees, similar to regular directory trees.</para></listitem>
91913f58 74
576cf244
LP
75 <listitem><para>Binary "raw" disk image files containing MBR or GPT partition tables and Linux file
76 systems.</para></listitem>
77
78 <listitem><para>Similarly, block devices containing MBR or GPT partition tables and file systems.</para></listitem>
91913f58
LP
79
80 <listitem><para>The file system tree of the host OS itself.</para></listitem>
81 </itemizedlist>
82
798d3a52
ZJS
83 </refsect1>
84
798d3a52
ZJS
85 <refsect1>
86 <title>Commands</title>
87
88 <para>The following commands are understood:</para>
89
90 <refsect2><title>Machine Commands</title><variablelist>
91
92 <varlistentry>
93 <term><command>list</command></term>
94
95 <listitem><para>List currently running (online) virtual
91913f58
LP
96 machines and containers. To enumerate machine images that can
97 be started, use <command>list-images</command> (see
98 below). Note that this command hides the special
99 <literal>.host</literal> machine by default. Use the
aefdc112
AK
100 <option>--all</option> switch to show it.</para>
101
102 <xi:include href="version-info.xml" xpointer="v206"/></listitem>
798d3a52
ZJS
103 </varlistentry>
104
105 <varlistentry>
1eecafb8 106 <term><command>status</command> <replaceable>NAME</replaceable>…</term>
798d3a52 107
28f90ea2 108 <listitem><para>Show runtime status information about
798d3a52
ZJS
109 one or more virtual machines and containers, followed by the
110 most recent log data from the journal. This function is
111 intended to generate human-readable output. If you are looking
112 for computer-parsable output, use <command>show</command>
113 instead. Note that the log data shown is reported by the
114 virtual machine or container manager, and frequently contains
115 console output of the machine, but not necessarily journal
ec07c3c8
AK
116 contents of the machine itself.</para>
117
aefdc112 118 <xi:include href="version-info.xml" xpointer="v206"/></listitem>
798d3a52
ZJS
119 </varlistentry>
120
121 <varlistentry>
1eecafb8 122 <term><command>show</command> [<replaceable>NAME</replaceable>…]</term>
798d3a52 123
e9c880dd
LP
124 <listitem><para>Show properties of one or more registered virtual machines or containers or the manager
125 itself. If no argument is specified, properties of the manager will be shown. If a NAME is specified,
126 properties of this virtual machine or container are shown. By default, empty properties are suppressed. Use
127 <option>--all</option> to show those too. To select specific properties to show, use
128 <option>--property=</option>. This command is intended to be used whenever computer-parsable output is
129 required, and does not print the control group tree or journal entries. Use <command>status</command> if you
ec07c3c8
AK
130 are looking for formatted human-readable output.</para>
131
aefdc112 132 <xi:include href="version-info.xml" xpointer="v206"/></listitem>
798d3a52
ZJS
133 </varlistentry>
134
135 <varlistentry>
1eecafb8 136 <term><command>start</command> <replaceable>NAME</replaceable>…</term>
798d3a52
ZJS
137
138 <listitem><para>Start a container as a system service, using
139 <citerefentry><refentrytitle>systemd-nspawn</refentrytitle><manvolnum>1</manvolnum></citerefentry>.
140 This starts <filename>systemd-nspawn@.service</filename>,
141 instantiated for the specified machine name, similar to the
142 effect of <command>systemctl start</command> on the service
143 name. <command>systemd-nspawn</command> looks for a container
144 image by the specified name in
145 <filename>/var/lib/machines/</filename> (and other search
146 paths, see below) and runs it. Use
b938cb90 147 <command>list-images</command> (see below) for listing
798d3a52
ZJS
148 available container images to start.</para>
149
150 <para>Note that
151 <citerefentry><refentrytitle>systemd-machined.service</refentrytitle><manvolnum>8</manvolnum></citerefentry>
152 also interfaces with a variety of other container and VM
153 managers, <command>systemd-nspawn</command> is just one
154 implementation of it. Most of the commands available in
155 <command>machinectl</command> may be used on containers or VMs
156 controlled by other managers, not just
157 <command>systemd-nspawn</command>. Starting VMs and container
158 images on those managers requires manager-specific
159 tools.</para>
160
161 <para>To interactively start a container on the command line
162 with full access to the container's console, please invoke
163 <command>systemd-nspawn</command> directly. To stop a running
ec07c3c8
AK
164 container use <command>machinectl poweroff</command>.</para>
165
aefdc112 166 <xi:include href="version-info.xml" xpointer="v219"/></listitem>
798d3a52
ZJS
167 </varlistentry>
168
169 <varlistentry>
91913f58 170 <term><command>login</command> [<replaceable>NAME</replaceable>]</term>
798d3a52 171
c454426c 172 <listitem><para>Open an interactive terminal login session in
b938cb90 173 a container or on the local host. If an argument is supplied,
91913f58
LP
174 it refers to the container machine to connect to. If none is
175 specified, or the container name is specified as the empty
176 string, or the special machine name <literal>.host</literal>
177 (see below) is specified, the connection is made to the local
178 host instead. This will create a TTY connection to a specific
179 container or the local host and asks for the execution of a
180 getty on it. Note that this is only supported for containers
181 running
798d3a52
ZJS
182 <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>
183 as init system.</para>
184
185 <para>This command will open a full login prompt on the
91913f58
LP
186 container or the local host, which then asks for username and
187 password. Use <command>shell</command> (see below) or
798d3a52 188 <citerefentry><refentrytitle>systemd-run</refentrytitle><manvolnum>1</manvolnum></citerefentry>
91913f58
LP
189 with the <option>--machine=</option> switch to directly invoke
190 a single command, either interactively or in the
ec07c3c8
AK
191 background.</para>
192
aefdc112 193 <xi:include href="version-info.xml" xpointer="v209"/></listitem>
798d3a52
ZJS
194 </varlistentry>
195
c454426c 196 <varlistentry>
1eecafb8 197 <term><command>shell</command> [[<replaceable>NAME</replaceable>@]<replaceable>NAME</replaceable> [<replaceable>PATH</replaceable> [<replaceable>ARGUMENTS</replaceable>…]]] </term>
c454426c
LP
198
199 <listitem><para>Open an interactive shell session in a
91913f58
LP
200 container or on the local host. The first argument refers to
201 the container machine to connect to. If none is specified, or
202 the machine name is specified as the empty string, or the
203 special machine name <literal>.host</literal> (see below) is
204 specified, the connection is made to the local host
15102ced 205 instead. This works similarly to <command>login</command>, but
91913f58 206 immediately invokes a user process. This command runs the
c46bc7e2
SL
207 specified executable with the specified arguments, or the
208 default shell for the user if none is specified, or
209 <filename>/bin/sh</filename> if no default shell is found. By default,
ef3100e9
LP
210 <option>--uid=</option>, or by prefixing the machine name with
211 a username and an <literal>@</literal> character, a different
212 user may be selected. Use <option>--setenv=</option> to set
213 environment variables for the executed process.</para>
214
7f129a1f
LP
215 <para>Note that <command>machinectl shell</command> does not propagate the exit code/status of the invoked
216 shell process. Use <command>systemd-run</command> instead if that information is required (see below).</para>
217
15102ced
ZJS
218 <para>Using the <command>shell</command> command without arguments (thus invoking the executed shell
219 or command on the local host), is in many ways similar to a <citerefentry
220 project='die-net'><refentrytitle>su</refentrytitle><manvolnum>1</manvolnum></citerefentry> session,
221 but, unlike <command>su</command>, completely isolates the new session from the originating session,
222 so that it shares no process or session properties and is in a clean well-defined state. It will be
223 tracked in a new utmp, login, audit, security, and keyring sessions, and will not inherit any
224 environment variables or resource limits, among other properties.</para>
225
226 <para>Note that
227 <citerefentry><refentrytitle>systemd-run</refentrytitle><manvolnum>1</manvolnum></citerefentry> with
228 its <option>--machine=</option> switch may be used in place of the <command>machinectl
229 shell</command> command, and allows non-interactive operation, more detailed and low-level
230 configuration of the invoked unit, as well as access to runtime and exit code/status information of
231 the invoked shell process. In particular, use <command>systemd-run</command>'s
232 <option>--wait</option> switch to propagate exit status information of the invoked process. Use
233 <command>systemd-run</command>'s <option>--pty</option> switch to acquire an interactive shell,
234 similarly to <command>machinectl shell</command>. In general, <command>systemd-run</command> is
235 preferable for scripting purposes. However, note that <command>systemd-run</command> might require
ec07c3c8
AK
236 higher privileges than <command>machinectl shell</command>.</para>
237
aefdc112 238 <xi:include href="version-info.xml" xpointer="v225"/></listitem>
c454426c
LP
239 </varlistentry>
240
798d3a52 241 <varlistentry>
1eecafb8
ZJS
242 <term><command>enable</command> <replaceable>NAME</replaceable>…</term>
243 <term><command>disable</command> <replaceable>NAME</replaceable>…</term>
798d3a52 244
15102ced 245 <listitem><para>Enable or disable a container as a system service to start at system boot, using
798d3a52 246 <citerefentry><refentrytitle>systemd-nspawn</refentrytitle><manvolnum>1</manvolnum></citerefentry>.
15102ced
ZJS
247 This enables or disables <filename>systemd-nspawn@.service</filename>, instantiated for the specified
248 machine name, similarly to the effect of <command>systemctl enable</command> or <command>systemctl
c2434a61
MY
249 disable</command> on the service name.</para>
250
251 <para>This command implicitly reloads the system manager configuration after completing the operation.
252 Note that this command does not implicitly start or power off the containers that are being operated on.
ec07c3c8
AK
253 If this is desired, combine the command with the <option>--now</option> switch.</para>
254
aefdc112 255 <xi:include href="version-info.xml" xpointer="v219"/></listitem>
798d3a52
ZJS
256 </varlistentry>
257
258 <varlistentry>
1eecafb8 259 <term><command>poweroff</command> <replaceable>NAME</replaceable>…</term>
798d3a52
ZJS
260
261 <listitem><para>Power off one or more containers. This will
262 trigger a reboot by sending SIGRTMIN+4 to the container's init
263 process, which causes systemd-compatible init systems to shut
b2bb19bb
CR
264 down cleanly. Use <command>stop</command> as alias for <command>poweroff</command>.
265 This operation does not work on containers that do not run a
798d3a52
ZJS
266 <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>-compatible
267 init system, such as sysvinit. Use
268 <command>terminate</command> (see below) to immediately
269 terminate a container or VM, without cleanly shutting it
ec07c3c8
AK
270 down.</para>
271
aefdc112 272 <xi:include href="version-info.xml" xpointer="v212"/></listitem>
798d3a52
ZJS
273 </varlistentry>
274
275 <varlistentry>
1eecafb8 276 <term><command>reboot</command> <replaceable>NAME</replaceable>…</term>
798d3a52
ZJS
277
278 <listitem><para>Reboot one or more containers. This will
279 trigger a reboot by sending SIGINT to the container's init
280 process, which is roughly equivalent to pressing Ctrl+Alt+Del
281 on a non-containerized system, and is compatible with
ec07c3c8
AK
282 containers running any system manager.</para>
283
aefdc112 284 <xi:include href="version-info.xml" xpointer="v209"/></listitem>
798d3a52
ZJS
285 </varlistentry>
286
287 <varlistentry>
1eecafb8 288 <term><command>terminate</command> <replaceable>NAME</replaceable>…</term>
798d3a52
ZJS
289
290 <listitem><para>Immediately terminates a virtual machine or
291 container, without cleanly shutting it down. This kills all
292 processes of the virtual machine or container and deallocates
293 all resources attached to that instance. Use
294 <command>poweroff</command> to issue a clean shutdown
ec07c3c8
AK
295 request.</para>
296
aefdc112 297 <xi:include href="version-info.xml" xpointer="v206"/></listitem>
798d3a52
ZJS
298 </varlistentry>
299
300 <varlistentry>
1eecafb8 301 <term><command>kill</command> <replaceable>NAME</replaceable>…</term>
798d3a52
ZJS
302
303 <listitem><para>Send a signal to one or more processes of the
304 virtual machine or container. This means processes as seen by
305 the host, not the processes inside the virtual machine or
4ccde410 306 container. Use <option>--kill-whom=</option> to select which
798d3a52 307 process to kill. Use <option>--signal=</option> to select the
ec07c3c8
AK
308 signal to send.</para>
309
aefdc112 310 <xi:include href="version-info.xml" xpointer="v206"/></listitem>
798d3a52
ZJS
311 </varlistentry>
312
313 <varlistentry>
314 <term><command>bind</command> <replaceable>NAME</replaceable> <replaceable>PATH</replaceable> [<replaceable>PATH</replaceable>]</term>
315
d3590ace
LP
316 <listitem><para>Bind mounts a file or directory from the host into the specified container. The first path
317 argument is the source file or directory on the host, the second path argument is the destination file or
318 directory in the container. When the latter is omitted, the destination path in the container is the same as
319 the source path on the host. When combined with the <option>--read-only</option> switch, a ready-only bind
320 mount is created. When combined with the <option>--mkdir</option> switch, the destination path is first created
321 before the mount is applied. Note that this option is currently only supported for
7f43928b 322 <citerefentry><refentrytitle>systemd-nspawn</refentrytitle><manvolnum>1</manvolnum></citerefentry> containers,
d3590ace
LP
323 and only if user namespacing (<option>--private-users</option>) is not used. This command supports bind
324 mounting directories, regular files, device nodes, <constant>AF_UNIX</constant> socket nodes, as well as
ec07c3c8
AK
325 FIFOs.</para>
326
327 <xi:include href="version-info.xml" xpointer="v219"/></listitem>
798d3a52
ZJS
328 </varlistentry>
329
330 <varlistentry>
ae03e1a9 331 <term><command>copy-to</command> <replaceable>NAME</replaceable> <replaceable>PATH</replaceable> [<replaceable>PATH</replaceable>] <option>--force</option></term>
798d3a52
ZJS
332
333 <listitem><para>Copies files or directories from the host
334 system into a running container. Takes a container name,
335 followed by the source path on the host and the destination
b938cb90 336 path in the container. If the destination path is omitted, the
d01cd401 337 same as the source path is used.</para>
798d3a52 338
d01cd401
LP
339 <para>If host and container share the same user and group namespace, file ownership by numeric user ID and
340 group ID is preserved for the copy, otherwise all files and directories in the copy will be owned by the root
ec07c3c8
AK
341 user and group (UID/GID 0).</para>
342
aefdc112 343 <xi:include href="version-info.xml" xpointer="v219"/></listitem>
d01cd401 344 </varlistentry>
798d3a52
ZJS
345
346 <varlistentry>
ae03e1a9 347 <term><command>copy-from</command> <replaceable>NAME</replaceable> <replaceable>PATH</replaceable> [<replaceable>PATH</replaceable>] <option>--force</option></term>
798d3a52
ZJS
348
349 <listitem><para>Copies files or directories from a container
350 into the host system. Takes a container name, followed by the
e9dd6984 351 source path in the container and the destination path on the host.
b938cb90 352 If the destination path is omitted, the same as the source path
d01cd401
LP
353 is used.</para>
354
355 <para>If host and container share the same user and group namespace, file ownership by numeric user ID and
356 group ID is preserved for the copy, otherwise all files and directories in the copy will be owned by the root
ec07c3c8
AK
357 user and group (UID/GID 0).</para>
358
aefdc112 359 <xi:include href="version-info.xml" xpointer="v219"/></listitem>
798d3a52
ZJS
360 </varlistentry>
361 </variablelist></refsect2>
362
363 <refsect2><title>Image Commands</title><variablelist>
364
365 <varlistentry>
366 <term><command>list-images</command></term>
367
368 <listitem><para>Show a list of locally installed container and
369 VM images. This enumerates all raw disk images and container
370 directories and subvolumes in
371 <filename>/var/lib/machines/</filename> (and other search
372 paths, see below). Use <command>start</command> (see above) to
b938cb90
JE
373 run a container off one of the listed images. Note that, by
374 default, containers whose name begins with a dot
798d3a52
ZJS
375 (<literal>.</literal>) are not shown. To show these too,
376 specify <option>--all</option>. Note that a special image
377 <literal>.host</literal> always implicitly exists and refers
ec07c3c8
AK
378 to the image the host itself is booted from.</para>
379
380 <xi:include href="version-info.xml" xpointer="v219"/></listitem>
798d3a52
ZJS
381 </varlistentry>
382
383 <varlistentry>
1eecafb8 384 <term><command>image-status</command> [<replaceable>NAME</replaceable>…]</term>
798d3a52
ZJS
385
386 <listitem><para>Show terse status information about one or
387 more container or VM images. This function is intended to
388 generate human-readable output. Use
389 <command>show-image</command> (see below) to generate
ec07c3c8
AK
390 computer-parsable output instead.</para>
391
aefdc112 392 <xi:include href="version-info.xml" xpointer="v219"/></listitem>
798d3a52
ZJS
393 </varlistentry>
394
395 <varlistentry>
1eecafb8 396 <term><command>show-image</command> [<replaceable>NAME</replaceable>…]</term>
798d3a52
ZJS
397
398 <listitem><para>Show properties of one or more registered
399 virtual machine or container images, or the manager itself. If
400 no argument is specified, properties of the manager will be
037a3ded 401 shown. If a NAME is specified, properties of this virtual
798d3a52
ZJS
402 machine or container image are shown. By default, empty
403 properties are suppressed. Use <option>--all</option> to show
404 those too. To select specific properties to show, use
405 <option>--property=</option>. This command is intended to be
406 used whenever computer-parsable output is required. Use
407 <command>image-status</command> if you are looking for
ec07c3c8
AK
408 formatted human-readable output.</para>
409
aefdc112 410 <xi:include href="version-info.xml" xpointer="v219"/></listitem>
798d3a52
ZJS
411 </varlistentry>
412
1ed35a0d
MY
413 <varlistentry>
414 <term><command>edit</command> <replaceable>NAME|FILE</replaceable></term>
415
416 <listitem><para>Edit the settings file of the specified machines. For the format of the settings file, refer to <citerefentry
417 project='man-pages'><refentrytitle>systemd.nspawn</refentrytitle><manvolnum>5</manvolnum></citerefentry>.
418 If an existing settings file of the given machine can't be found, <command>edit</command> automatically
ec07c3c8
AK
419 create a new settings file from scratch under <filename>/etc/</filename></para>
420
421 <xi:include href="version-info.xml" xpointer="v254"/></listitem>
1ed35a0d
MY
422 </varlistentry>
423
424 <varlistentry>
425 <term><command>cat</command> <replaceable>NAME|FILE</replaceable></term>
426
ec07c3c8
AK
427 <listitem><para>Show the settings file of the specified machines.</para>
428
429 <xi:include href="version-info.xml" xpointer="v254"/></listitem>
1ed35a0d
MY
430 </varlistentry>
431
798d3a52
ZJS
432 <varlistentry>
433 <term><command>clone</command> <replaceable>NAME</replaceable> <replaceable>NAME</replaceable></term>
434
d13febb1
LP
435 <listitem><para>Clones a container or VM image. The arguments specify the name of the image to clone and the
436 name of the newly cloned image. Note that plain directory container images are cloned into btrfs subvolume
437 images with this command, if the underlying file system supports this. Note that cloning a container or VM
17cbb288
LP
438 image is optimized for file systems that support copy-on-write, and might not be efficient on others, due to
439 file system limitations.</para>
3fe22bb4 440
38b38500 441 <para>Note that this command leaves hostname, machine ID and
3fe22bb4
LP
442 all other settings that could identify the instance
443 unmodified. The original image and the cloned copy will hence
444 share these credentials, and it might be necessary to manually
d94c2b06
LP
445 change them in the copy.</para>
446
447 <para>If combined with the <option>--read-only</option> switch a read-only cloned image is
ec07c3c8
AK
448 created.</para>
449
450 <xi:include href="version-info.xml" xpointer="v219"/></listitem>
798d3a52
ZJS
451 </varlistentry>
452
453 <varlistentry>
454 <term><command>rename</command> <replaceable>NAME</replaceable> <replaceable>NAME</replaceable></term>
455
d6ce17c7 456 <listitem><para>Renames a container or VM image. The
798d3a52 457 arguments specify the name of the image to rename and the new
ec07c3c8
AK
458 name of the image.</para>
459
460 <xi:include href="version-info.xml" xpointer="v219"/></listitem>
798d3a52
ZJS
461 </varlistentry>
462
463 <varlistentry>
464 <term><command>read-only</command> <replaceable>NAME</replaceable> [<replaceable>BOOL</replaceable>]</term>
465
d6ce17c7 466 <listitem><para>Marks or (unmarks) a container or VM image
798d3a52
ZJS
467 read-only. Takes a VM or container image name, followed by a
468 boolean as arguments. If the boolean is omitted, positive is
ec07c3c8
AK
469 implied, i.e. the image is marked read-only.</para>
470
471 <xi:include href="version-info.xml" xpointer="v219"/></listitem>
798d3a52
ZJS
472 </varlistentry>
473
798d3a52 474 <varlistentry>
1eecafb8 475 <term><command>remove</command> <replaceable>NAME</replaceable>…</term>
798d3a52 476
d6ce17c7 477 <listitem><para>Removes one or more container or VM images.
798d3a52 478 The special image <literal>.host</literal>, which refers to
b938cb90 479 the host's own directory tree, may not be
ec07c3c8
AK
480 removed.</para>
481
aefdc112 482 <xi:include href="version-info.xml" xpointer="v219"/></listitem>
798d3a52
ZJS
483 </varlistentry>
484
d6ce17c7
LP
485 <varlistentry>
486 <term><command>set-limit</command> [<replaceable>NAME</replaceable>] <replaceable>BYTES</replaceable></term>
487
a8eaaee7 488 <listitem><para>Sets the maximum size in bytes that a specific
b938cb90 489 container or VM image, or all images, may grow up to on disk
7de30452 490 (disk quota). Takes either one or two parameters. The first,
d6ce17c7 491 optional parameter refers to a container or VM image name. If
b938cb90
JE
492 specified, the size limit of the specified image is changed. If
493 omitted, the overall size limit of the sum of all images stored
7de30452
LP
494 locally is changed. The final argument specifies the size
495 limit in bytes, possibly suffixed by the usual K, M, G, T
496 units. If the size limit shall be disabled, specify
497 <literal>-</literal> as size.</para>
498
ec07c3c8
AK
499 <para>Note that per-container size limits are only supported on btrfs file systems.</para>
500
501 <xi:include href="version-info.xml" xpointer="v220"/></listitem>
d6ce17c7
LP
502 </varlistentry>
503
d94c2b06
LP
504 <varlistentry>
505 <term><command>clean</command></term>
506
507 <listitem><para>Remove hidden VM or container images (or all). This command removes all hidden machine images
3b121157 508 from <filename>/var/lib/machines/</filename>, i.e. those whose name begins with a dot. Use <command>machinectl
d94c2b06
LP
509 list-images --all</command> to see a list of all machine images, including the hidden ones.</para>
510
511 <para>When combined with the <option>--all</option> switch removes all images, not just hidden ones. This
3b121157 512 command effectively empties <filename>/var/lib/machines/</filename>.</para>
d94c2b06
LP
513
514 <para>Note that commands such as <command>machinectl pull-tar</command> or <command>machinectl
515 pull-raw</command> usually create hidden, read-only, unmodified machine images from the downloaded image first,
516 before cloning a writable working copy of it, in order to avoid duplicate downloads in case of images that are
517 reused multiple times. Use <command>machinectl clean</command> to remove old, hidden images created this
ec07c3c8
AK
518 way.</para>
519
520 <xi:include href="version-info.xml" xpointer="v230"/></listitem>
d94c2b06
LP
521 </varlistentry>
522
798d3a52
ZJS
523 </variablelist></refsect2>
524
525 <refsect2><title>Image Transfer Commands</title><variablelist>
526
527 <varlistentry>
528 <term><command>pull-tar</command> <replaceable>URL</replaceable> [<replaceable>NAME</replaceable>]</term>
529
530 <listitem><para>Downloads a <filename>.tar</filename>
531 container image from the specified URL, and makes it available
532 under the specified local machine name. The URL must be of
533 type <literal>http://</literal> or
534 <literal>https://</literal>, and must refer to a
535 <filename>.tar</filename>, <filename>.tar.gz</filename>,
536 <filename>.tar.xz</filename> or <filename>.tar.bz2</filename>
b938cb90 537 archive file. If the local machine name is omitted, it
798d3a52
ZJS
538 is automatically derived from the last component of the URL,
539 with its suffix removed.</para>
540
697be0be
TB
541 <para>The image is verified before it is made available, unless
542 <option>--verify=no</option> is specified.
543 Verification is done either via an inline signed file with the name
544 of the image and the suffix <filename>.sha256</filename> or via
545 separate <filename>SHA256SUMS</filename> and
546 <filename>SHA256SUMS.gpg</filename> files.
547 The signature files need to be made available on the same web
548 server, under the same URL as the <filename>.tar</filename> file.
549 With <option>--verify=checksum</option>, only the SHA256 checksum
550 for the file is verified, based on the <filename>.sha256</filename>
abdc57df 551 suffixed file or the <filename>SHA256SUMS</filename> file.
697be0be
TB
552 With <option>--verify=signature</option>, the sha checksum file is
553 first verified with the inline signature in the
554 <filename>.sha256</filename> file or the detached GPG signature file
555 <filename>SHA256SUMS.gpg</filename>.
556 The public key for this verification step needs to be available in
12b42c76
TG
557 <filename>/usr/lib/systemd/import-pubring.gpg</filename> or
558 <filename>/etc/systemd/import-pubring.gpg</filename>.</para>
798d3a52
ZJS
559
560 <para>The container image will be downloaded and stored in a
561 read-only subvolume in
b938cb90 562 <filename>/var/lib/machines/</filename> that is named after
798d3a52
ZJS
563 the specified URL and its HTTP etag. A writable snapshot is
564 then taken from this subvolume, and named after the specified
dd2b607b 565 local name. This behavior ensures that creating multiple
798d3a52
ZJS
566 container instances of the same URL is efficient, as multiple
567 downloads are not necessary. In order to create only the
568 read-only image, and avoid creating its writable snapshot,
569 specify <literal>-</literal> as local machine name.</para>
570
571 <para>Note that the read-only subvolume is prefixed with
6b94875f 572 <filename>.tar-</filename>, and is thus not shown by
798d3a52
ZJS
573 <command>list-images</command>, unless <option>--all</option>
574 is passed.</para>
575
576 <para>Note that pressing C-c during execution of this command
577 will not abort the download. Use
578 <command>cancel-transfer</command>, described
ec07c3c8
AK
579 below.</para>
580
581 <xi:include href="version-info.xml" xpointer="v219"/></listitem>
798d3a52
ZJS
582 </varlistentry>
583
584 <varlistentry>
585 <term><command>pull-raw</command> <replaceable>URL</replaceable> [<replaceable>NAME</replaceable>]</term>
586
587 <listitem><para>Downloads a <filename>.raw</filename>
588 container or VM disk image from the specified URL, and makes
589 it available under the specified local machine name. The URL
590 must be of type <literal>http://</literal> or
591 <literal>https://</literal>. The container image must either
592 be a <filename>.qcow2</filename> or raw disk image, optionally
593 compressed as <filename>.gz</filename>,
594 <filename>.xz</filename>, or <filename>.bz2</filename>. If the
b938cb90 595 local machine name is omitted, it is automatically
798d3a52
ZJS
596 derived from the last component of the URL, with its suffix
597 removed.</para>
598
599 <para>Image verification is identical for raw and tar images
600 (see above).</para>
601
1d3eaa93 602 <para>If the downloaded image is in
6b94875f 603 <filename>.qcow2</filename> format it is converted into a raw
798d3a52
ZJS
604 image file before it is made available.</para>
605
606 <para>Downloaded images of this type will be placed as
607 read-only <filename>.raw</filename> file in
608 <filename>/var/lib/machines/</filename>. A local, writable
609 (reflinked) copy is then made under the specified local
610 machine name. To omit creation of the local, writable copy
611 pass <literal>-</literal> as local machine name.</para>
612
15102ced
ZJS
613 <para>Similarly to the behavior of <command>pull-tar</command>, the read-only image is prefixed with
614 <filename>.raw-</filename>, and thus not shown by <command>list-images</command>, unless
615 <option>--all</option> is passed.</para>
798d3a52
ZJS
616
617 <para>Note that pressing C-c during execution of this command
618 will not abort the download. Use
619 <command>cancel-transfer</command>, described
ec07c3c8
AK
620 below.</para>
621
622 <xi:include href="version-info.xml" xpointer="v219"/></listitem>
798d3a52
ZJS
623 </varlistentry>
624
af40e5d3
LP
625 <varlistentry>
626 <term><command>import-tar</command> <replaceable>FILE</replaceable> [<replaceable>NAME</replaceable>]</term>
627 <term><command>import-raw</command> <replaceable>FILE</replaceable> [<replaceable>NAME</replaceable>]</term>
628 <listitem><para>Imports a TAR or RAW container or VM image,
629 and places it under the specified name in
630 <filename>/var/lib/machines/</filename>. When
b938cb90 631 <command>import-tar</command> is used, the file specified as
a8eaaee7 632 the first argument should be a tar archive, possibly compressed
af40e5d3 633 with xz, gzip or bzip2. It will then be unpacked into its own
3b121157 634 subvolume in <filename>/var/lib/machines/</filename>. When
b938cb90 635 <command>import-raw</command> is used, the file should be a
af40e5d3
LP
636 qcow2 or raw disk image, possibly compressed with xz, gzip or
637 bzip2. If the second argument (the resulting image name) is
b938cb90 638 not specified, it is automatically derived from the file
1245e413 639 name. If the filename is passed as <literal>-</literal>, the
af40e5d3
LP
640 image is read from standard input, in which case the second
641 argument is mandatory.</para>
642
5f7ecd61
LP
643 <para>Optionally, the <option>--read-only</option> switch may be used to create a read-only container or VM
644 image. No cryptographic validation is done when importing the images.</para>
af40e5d3
LP
645
646 <para>Much like image downloads, ongoing imports may be listed
647 with <command>list-transfers</command> and aborted with
ec07c3c8
AK
648 <command>cancel-transfer</command>.</para>
649
650 <xi:include href="version-info.xml" xpointer="v220"/></listitem>
af40e5d3
LP
651 </varlistentry>
652
1d7579c4
LP
653 <varlistentry>
654 <term><command>import-fs</command> <replaceable>DIRECTORY</replaceable> [<replaceable>NAME</replaceable>]</term>
655
656 <listitem><para>Imports a container image stored in a local directory into
15102ced
ZJS
657 <filename>/var/lib/machines/</filename>, operates similarly to <command>import-tar</command> or
658 <command>import-raw</command>, but the first argument is the source directory. If supported, this
ec07c3c8
AK
659 command will create a btrfs snapshot or subvolume for the new image.</para>
660
661 <xi:include href="version-info.xml" xpointer="v240"/></listitem>
1d7579c4
LP
662 </varlistentry>
663
6e9efa59
LP
664 <varlistentry>
665 <term><command>export-tar</command> <replaceable>NAME</replaceable> [<replaceable>FILE</replaceable>]</term>
666 <term><command>export-raw</command> <replaceable>NAME</replaceable> [<replaceable>FILE</replaceable>]</term>
667 <listitem><para>Exports a TAR or RAW container or VM image and
668 stores it in the specified file. The first parameter should be
669 a VM or container image name. The second parameter should be a
670 file path the TAR or RAW image is written to. If the path ends
b938cb90
JE
671 in <literal>.gz</literal>, the file is compressed with gzip, if
672 it ends in <literal>.xz</literal>, with xz, and if it ends in
673 <literal>.bz2</literal>, with bzip2. If the path ends in
674 neither, the file is left uncompressed. If the second argument
675 is missing, the image is written to standard output. The
6e9efa59
LP
676 compression may also be explicitly selected with the
677 <option>--format=</option> switch. This is in particular
678 useful if the second parameter is left unspecified.</para>
679
680 <para>Much like image downloads and imports, ongoing exports
681 may be listed with <command>list-transfers</command> and
682 aborted with
683 <command>cancel-transfer</command>.</para>
684
b938cb90 685 <para>Note that, currently, only directory and subvolume images
6e9efa59 686 may be exported as TAR images, and only raw disk images as RAW
ec07c3c8
AK
687 images.</para>
688
689 <xi:include href="version-info.xml" xpointer="v220"/></listitem>
6e9efa59
LP
690 </varlistentry>
691
798d3a52
ZJS
692 <varlistentry>
693 <term><command>list-transfers</command></term>
694
695 <listitem><para>Shows a list of container or VM image
6e9efa59 696 downloads, imports and exports that are currently in
ec07c3c8
AK
697 progress.</para>
698
699 <xi:include href="version-info.xml" xpointer="v219"/></listitem>
798d3a52
ZJS
700 </varlistentry>
701
702 <varlistentry>
ee156e8d 703 <term><command>cancel-transfer</command> <replaceable>ID</replaceable>…</term>
798d3a52 704
6e9efa59
LP
705 <listitem><para>Aborts a download, import or export of the
706 container or VM image with the specified ID. To list ongoing
707 transfers and their IDs, use
ec07c3c8
AK
708 <command>list-transfers</command>. </para>
709
aefdc112 710 <xi:include href="version-info.xml" xpointer="v219"/></listitem>
798d3a52
ZJS
711 </varlistentry>
712
713 </variablelist></refsect2>
714
715 </refsect1>
716
e1fac8a6
ZJS
717 <refsect1>
718 <title>Options</title>
719
720 <para>The following options are understood:</para>
721
722 <variablelist>
723 <varlistentry>
724 <term><option>-p</option></term>
725 <term><option>--property=</option></term>
726
727 <listitem><para>When showing machine or image properties,
728 limit the output to certain properties as specified by the
729 argument. If not specified, all set properties are shown. The
730 argument should be a property name, such as
731 <literal>Name</literal>. If specified more than once, all
732 properties with the specified names are
ec07c3c8
AK
733 shown.</para>
734
735 <xi:include href="version-info.xml" xpointer="v206"/></listitem>
e1fac8a6
ZJS
736 </varlistentry>
737
738 <varlistentry>
739 <term><option>-a</option></term>
740 <term><option>--all</option></term>
741
742 <listitem><para>When showing machine or image properties, show
743 all properties regardless of whether they are set or
744 not.</para>
745
746 <para>When listing VM or container images, do not suppress
747 images beginning in a dot character
748 (<literal>.</literal>).</para>
749
ec07c3c8
AK
750 <para>When cleaning VM or container images, remove all images, not just hidden ones.</para>
751
752 <xi:include href="version-info.xml" xpointer="v206"/></listitem>
e1fac8a6
ZJS
753 </varlistentry>
754
755 <varlistentry>
756 <term><option>--value</option></term>
757
758 <listitem><para>When printing properties with <command>show</command>, only print the value,
ec07c3c8
AK
759 and skip the property name and <literal>=</literal>.</para>
760
761 <xi:include href="version-info.xml" xpointer="v230"/></listitem>
e1fac8a6
ZJS
762 </varlistentry>
763
764 <varlistentry>
765 <term><option>-l</option></term>
766 <term><option>--full</option></term>
767
12845a91
YW
768 <listitem><para>Do not ellipsize process tree entries or table. This implies
769 <option>--max-addresses=full</option>.</para>
ec07c3c8
AK
770
771 <xi:include href="version-info.xml" xpointer="v206"/>
e1fac8a6
ZJS
772 </listitem>
773 </varlistentry>
774
775 <varlistentry>
4ccde410 776 <term><option>--kill-whom=</option></term>
e1fac8a6
ZJS
777
778 <listitem><para>When used with <command>kill</command>, choose
779 which processes to kill. Must be one of
780 <option>leader</option>, or <option>all</option> to select
781 whether to kill only the leader process of the machine or all
782 processes of the machine. If omitted, defaults to
ec07c3c8
AK
783 <option>all</option>.</para>
784
aefdc112 785 <xi:include href="version-info.xml" xpointer="v206"/></listitem>
e1fac8a6
ZJS
786 </varlistentry>
787
86beb213 788 <xi:include href="standard-options.xml" xpointer="signal" />
e1fac8a6
ZJS
789
790 <varlistentry>
791 <term><option>--uid=</option></term>
792
793 <listitem><para>When used with the <command>shell</command> command, chooses the user ID to
794 open the interactive shell session as. If the argument to the <command>shell</command>
795 command also specifies a user name, this option is ignored. If the name is not specified
796 in either way, <literal>root</literal> will be used by default. Note that this switch is
ec07c3c8
AK
797 not supported for the <command>login</command> command (see below).</para>
798
799 <xi:include href="version-info.xml" xpointer="v225"/></listitem>
e1fac8a6
ZJS
800 </varlistentry>
801
802 <varlistentry>
89bf86e0
ZJS
803 <term><option>-E <replaceable>NAME</replaceable>[=<replaceable>VALUE</replaceable>]</option></term>
804 <term><option>--setenv=<replaceable>NAME</replaceable>[=<replaceable>VALUE</replaceable>]</option></term>
805
806 <listitem><para>When used with the <command>shell</command> command, sets an environment variable for
807 the executed shell. This option may be used more than once to set multiple variables. When
808 <literal>=</literal> and <replaceable>VALUE</replaceable> are omitted, the value of the variable with
809 the same name in the program environment will be used.</para>
810
811 <para>Note that this option is not supported for the <command>login</command> command.
ec07c3c8
AK
812 </para>
813
aefdc112 814 <xi:include href="version-info.xml" xpointer="v230"/></listitem>
e1fac8a6
ZJS
815 </varlistentry>
816
817 <varlistentry>
818 <term><option>--mkdir</option></term>
819
820 <listitem><para>When used with <command>bind</command>, creates the destination file or directory before
821 applying the bind mount. Note that even though the name of this option suggests that it is suitable only for
822 directories, this option also creates the destination file node to mount over if the object to mount is not
ec07c3c8
AK
823 a directory, but a regular file, device node, socket or FIFO.</para>
824
825 <xi:include href="version-info.xml" xpointer="v219"/></listitem>
e1fac8a6
ZJS
826 </varlistentry>
827
828 <varlistentry>
829 <term><option>--read-only</option></term>
830
831 <listitem><para>When used with <command>bind</command>, creates a read-only bind mount.</para>
832
833 <para>When used with <command>clone</command>, <command>import-raw</command> or <command>import-tar</command> a
ec07c3c8
AK
834 read-only container or VM image is created.</para>
835
836 <xi:include href="version-info.xml" xpointer="v219"/></listitem>
e1fac8a6
ZJS
837 </varlistentry>
838
839 <varlistentry>
840 <term><option>-n</option></term>
841 <term><option>--lines=</option></term>
842
843 <listitem><para>When used with <command>status</command>,
844 controls the number of journal lines to show, counting from
845 the most recent ones. Takes a positive integer argument.
846 Defaults to 10.</para>
ec07c3c8
AK
847
848 <xi:include href="version-info.xml" xpointer="v219"/>
e1fac8a6
ZJS
849 </listitem>
850 </varlistentry>
851
852 <varlistentry>
853 <term><option>-o</option></term>
854 <term><option>--output=</option></term>
855
856 <listitem><para>When used with <command>status</command>,
857 controls the formatting of the journal entries that are shown.
858 For the available choices, see
859 <citerefentry><refentrytitle>journalctl</refentrytitle><manvolnum>1</manvolnum></citerefentry>.
ec07c3c8
AK
860 Defaults to <literal>short</literal>.</para>
861
862 <xi:include href="version-info.xml" xpointer="v219"/></listitem>
e1fac8a6
ZJS
863 </varlistentry>
864
865 <varlistentry>
866 <term><option>--verify=</option></term>
867
868 <listitem><para>When downloading a container or VM image,
869 specify whether the image shall be verified before it is made
870 available. Takes one of <literal>no</literal>,
871 <literal>checksum</literal> and <literal>signature</literal>.
872 If <literal>no</literal>, no verification is done. If
873 <literal>checksum</literal> is specified, the download is
874 checked for integrity after the transfer is complete, but no
875 signatures are verified. If <literal>signature</literal> is
876 specified, the checksum is verified and the image's signature
877 is checked against a local keyring of trustable vendors. It is
878 strongly recommended to set this option to
879 <literal>signature</literal> if the server and protocol
880 support this. Defaults to
ec07c3c8
AK
881 <literal>signature</literal>.</para>
882
883 <xi:include href="version-info.xml" xpointer="v219"/></listitem>
e1fac8a6
ZJS
884 </varlistentry>
885
c2434a61
MY
886 <varlistentry>
887 <term><option>--now</option></term>
888
889 <listitem>
890 <para>When used with <command>enable</command> or <command>disable</command>,
891 the containers will also be started or powered off. The start or poweroff
892 operation is only carried out when the respective enable or disable
893 operation has been successful.</para>
ec07c3c8
AK
894
895 <xi:include href="version-info.xml" xpointer="v253"/>
c2434a61
MY
896 </listitem>
897 </varlistentry>
898
e1fac8a6
ZJS
899 <varlistentry>
900 <term><option>--force</option></term>
901
902 <listitem><para>When downloading a container or VM image, and
903 a local copy by the specified local machine name already
904 exists, delete it first and replace it by the newly downloaded
ec07c3c8
AK
905 image.</para>
906
907 <xi:include href="version-info.xml" xpointer="v219"/></listitem>
e1fac8a6
ZJS
908 </varlistentry>
909
910 <varlistentry>
911 <term><option>--format=</option></term>
912
913 <listitem><para>When used with the <option>export-tar</option>
914 or <option>export-raw</option> commands, specifies the
915 compression format to use for the resulting file. Takes one of
916 <literal>uncompressed</literal>, <literal>xz</literal>,
917 <literal>gzip</literal>, <literal>bzip2</literal>. By default,
918 the format is determined automatically from the image file
ec07c3c8
AK
919 name passed.</para>
920
921 <xi:include href="version-info.xml" xpointer="v220"/></listitem>
e1fac8a6
ZJS
922 </varlistentry>
923
924 <varlistentry>
925 <term><option>--max-addresses=</option></term>
926
99b8149a
ZJS
927 <listitem><para>When used with the <option>list-machines</option> command, limits the number of IP
928 addresses shown for every machine. Defaults to 1. All addresses can be requested with
929 <literal>all</literal>. If the limit is 0, the address column is not shown. Otherwise, if the machine
ec07c3c8
AK
930 has more addresses than shown, <literal>…</literal> follows the last address.</para>
931
932 <xi:include href="version-info.xml" xpointer="v232"/></listitem>
e1fac8a6
ZJS
933 </varlistentry>
934
935 <varlistentry>
936 <term><option>-q</option></term>
937 <term><option>--quiet</option></term>
938
ec07c3c8
AK
939 <listitem><para>Suppresses additional informational output while running.</para>
940
941 <xi:include href="version-info.xml" xpointer="v236"/></listitem>
e1fac8a6
ZJS
942 </varlistentry>
943
944 <xi:include href="user-system-options.xml" xpointer="host" />
945
946 <varlistentry>
947 <term><option>-M</option></term>
948 <term><option>--machine=</option></term>
949
950 <listitem><para>Connect to
951 <citerefentry><refentrytitle>systemd-machined.service</refentrytitle><manvolnum>8</manvolnum></citerefentry>
952 running in a local container, to perform the specified operation within
ec07c3c8
AK
953 the container.</para>
954
955 <xi:include href="version-info.xml" xpointer="v235"/></listitem>
e1fac8a6
ZJS
956 </varlistentry>
957
958 <xi:include href="standard-options.xml" xpointer="no-pager" />
959 <xi:include href="standard-options.xml" xpointer="no-legend" />
960 <xi:include href="standard-options.xml" xpointer="no-ask-password" />
961 <xi:include href="standard-options.xml" xpointer="help" />
962 <xi:include href="standard-options.xml" xpointer="version" />
963 </variablelist>
964 </refsect1>
965
91913f58
LP
966 <refsect1>
967 <title>Machine and Image Names</title>
968
969 <para>The <command>machinectl</command> tool operates on machines
b938cb90 970 and images whose names must be chosen following strict
38b38500 971 rules. Machine names must be suitable for use as hostnames
91913f58
LP
972 following a conservative subset of DNS and UNIX/Linux
973 semantics. Specifically, they must consist of one or more
974 non-empty label strings, separated by dots. No leading or trailing
975 dots are allowed. No sequences of multiple dots are allowed. The
a8eaaee7 976 label strings may only consist of alphanumeric characters as well
91913f58
LP
977 as the dash and underscore. The maximum length of a machine name
978 is 64 characters.</para>
979
980 <para>A special machine with the name <literal>.host</literal>
981 refers to the running host system itself. This is useful for execution
a8eaaee7 982 operations or inspecting the host system as well. Note that
91913f58
LP
983 <command>machinectl list</command> will not show this special
984 machine unless the <option>--all</option> switch is specified.</para>
985
a8eaaee7 986 <para>Requirements on image names are less strict, however, they must be
91913f58
LP
987 valid UTF-8, must be suitable as file names (hence not be the
988 single or double dot, and not include a slash), and may not
989 contain control characters. Since many operations search for an
b938cb90 990 image by the name of a requested machine, it is recommended to name
91913f58
LP
991 images in the same strict fashion as machines.</para>
992
993 <para>A special image with the name <literal>.host</literal>
a8eaaee7 994 refers to the image of the running host system. It hence
91913f58
LP
995 conceptually maps to the special <literal>.host</literal> machine
996 name described above. Note that <command>machinectl
7ca41557 997 list-images</command> will not show this special image either, unless
91913f58
LP
998 <option>--all</option> is specified.</para>
999 </refsect1>
1000
798d3a52
ZJS
1001 <refsect1>
1002 <title>Files and Directories</title>
1003
1004 <para>Machine images are preferably stored in
1005 <filename>/var/lib/machines/</filename>, but are also searched for
1006 in <filename>/usr/local/lib/machines/</filename> and
b938cb90 1007 <filename>/usr/lib/machines/</filename>. For compatibility reasons,
798d3a52
ZJS
1008 the directory <filename>/var/lib/container/</filename> is
1009 searched, too. Note that images stored below
3b121157 1010 <filename>/usr/</filename> are always considered read-only. It is
798d3a52
ZJS
1011 possible to symlink machines images from other directories into
1012 <filename>/var/lib/machines/</filename> to make them available for
1013 control with <command>machinectl</command>.</para>
1014
5f7ecd61 1015 <para>Note that some image operations are only supported, efficient or atomic on btrfs file systems.</para>
7de30452 1016
798d3a52
ZJS
1017 <para>Disk images are understood by
1018 <citerefentry><refentrytitle>systemd-nspawn</refentrytitle><manvolnum>1</manvolnum></citerefentry>
1019 and <command>machinectl</command> in three formats:</para>
1020
1021 <itemizedlist>
1022 <listitem><para>A simple directory tree, containing the files
1023 and directories of the container to boot.</para></listitem>
1024
a8eaaee7 1025 <listitem><para>Subvolumes (on btrfs file systems), which are
798d3a52
ZJS
1026 similar to the simple directories, described above. However,
1027 they have additional benefits, such as efficient cloning and
1028 quota reporting.</para></listitem>
1029
1030 <listitem><para>"Raw" disk images, i.e. binary images of disks
1031 with a GPT or MBR partition table. Images of this type are
1032 regular files with the suffix
1033 <literal>.raw</literal>.</para></listitem>
1034 </itemizedlist>
1035
1036 <para>See
1037 <citerefentry><refentrytitle>systemd-nspawn</refentrytitle><manvolnum>1</manvolnum></citerefentry>
a8eaaee7 1038 for more information on image formats, in particular its
798d3a52
ZJS
1039 <option>--directory=</option> and <option>--image=</option>
1040 options.</para>
1041 </refsect1>
1042
1043 <refsect1>
1044 <title>Examples</title>
1045 <example>
5bc9ea07 1046 <title>Download a Ubuntu image and open a shell in it</title>
798d3a52
ZJS
1047
1048 <programlisting># machinectl pull-tar https://cloud-images.ubuntu.com/trusty/current/trusty-server-cloudimg-amd64-root.tar.gz
e0ea94c1
LP
1049# systemd-nspawn -M trusty-server-cloudimg-amd64-root</programlisting>
1050
798d3a52
ZJS
1051 <para>This downloads and verifies the specified
1052 <filename>.tar</filename> image, and then uses
1053 <citerefentry><refentrytitle>systemd-nspawn</refentrytitle><manvolnum>1</manvolnum></citerefentry>
1054 to open a shell in it.</para>
1055 </example>
1056
1057 <example>
1058 <title>Download a Fedora image, set a root password in it, start
5fadff33 1059 it as a service</title>
798d3a52 1060
5fadff33
ZJS
1061 <programlisting># machinectl pull-raw --verify=no \
1062 https://download.fedoraproject.org/pub/fedora/linux/releases/&fedora_latest_version;/Cloud/x86_64/images/Fedora-Cloud-Base-&fedora_latest_version;-&fedora_cloud_release;.x86_64.raw.xz \
1063 Fedora-Cloud-Base-&fedora_latest_version;-&fedora_cloud_release;.x86-64
1064# systemd-nspawn -M Fedora-Cloud-Base-&fedora_latest_version;-&fedora_cloud_release;.x86-64
ac92ced5
BF
1065# passwd
1066# exit
5fadff33
ZJS
1067# machinectl start Fedora-Cloud-Base-&fedora_latest_version;-&fedora_cloud_release;.x86-64
1068# machinectl login Fedora-Cloud-Base-&fedora_latest_version;-&fedora_cloud_release;.x86-64</programlisting>
798d3a52
ZJS
1069
1070 <para>This downloads the specified <filename>.raw</filename>
b938cb90 1071 image with verification disabled. Then, a shell is opened in it
798d3a52
ZJS
1072 and a root password is set. Afterwards the shell is left, and
1073 the machine started as system service. With the last command a
1074 login prompt into the container is requested.</para>
1075 </example>
1076
6e9efa59
LP
1077 <example>
1078 <title>Exports a container image as tar file</title>
1079
1080 <programlisting># machinectl export-tar fedora myfedora.tar.xz</programlisting>
1081
a8eaaee7
JE
1082 <para>Exports the container <literal>fedora</literal> as an
1083 xz-compressed tar file <filename>myfedora.tar.xz</filename> into the
6e9efa59
LP
1084 current directory.</para>
1085 </example>
1086
ef3100e9
LP
1087 <example>
1088 <title>Create a new shell session</title>
1089
1090 <programlisting># machinectl shell --uid=lennart</programlisting>
1091
b938cb90 1092 <para>This creates a new shell session on the local host for
ef3100e9
LP
1093 the user ID <literal>lennart</literal>, in a <citerefentry
1094 project='die-net'><refentrytitle>su</refentrytitle><manvolnum>1</manvolnum></citerefentry>-like
1095 fashion.</para>
1096 </example>
1097
798d3a52
ZJS
1098 </refsect1>
1099
1100 <refsect1>
1101 <title>Exit status</title>
1102
1103 <para>On success, 0 is returned, a non-zero failure code
1104 otherwise.</para>
1105 </refsect1>
1106
4ef3ca34 1107 <xi:include href="common-variables.xml" />
798d3a52
ZJS
1108
1109 <refsect1>
1110 <title>See Also</title>
1111 <para>
d47410f3 1112 <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
798d3a52
ZJS
1113 <citerefentry><refentrytitle>systemd-machined.service</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
1114 <citerefentry><refentrytitle>systemd-nspawn</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
6e9efa59 1115 <citerefentry><refentrytitle>systemd.special</refentrytitle><manvolnum>7</manvolnum></citerefentry>,
16eb4024
ZJS
1116 <citerefentry project='die-net'><refentrytitle>tar</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
1117 <citerefentry project='die-net'><refentrytitle>xz</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
1118 <citerefentry project='die-net'><refentrytitle>gzip</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
1119 <citerefentry project='die-net'><refentrytitle>bzip2</refentrytitle><manvolnum>1</manvolnum></citerefentry>
798d3a52
ZJS
1120 </para>
1121 </refsect1>
19887cd0
ZJS
1122
1123</refentry>