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