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