| 1 |
<?xml version="1.0"?> |
| 2 |
<!--*-nxml-*--> |
| 3 |
<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" |
| 4 |
"http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd" [ |
| 5 |
<!ENTITY % entities SYSTEM "custom-entities.ent" > |
| 6 |
%entities; |
| 7 |
]> |
| 8 |
<!-- SPDX-License-Identifier: LGPL-2.1-or-later --> |
| 9 |
<refentry id="systemd-import-generator" |
| 10 |
xmlns:xi="http://www.w3.org/2001/XInclude"> |
| 11 |
|
| 12 |
<refentryinfo> |
| 13 |
<title>systemd-import-generator</title> |
| 14 |
<productname>systemd</productname> |
| 15 |
</refentryinfo> |
| 16 |
|
| 17 |
<refmeta> |
| 18 |
<refentrytitle>systemd-import-generator</refentrytitle> |
| 19 |
<manvolnum>8</manvolnum> |
| 20 |
</refmeta> |
| 21 |
|
| 22 |
<refnamediv> |
| 23 |
<refname>systemd-import-generator</refname> |
| 24 |
<refpurpose>Generator for automatically downloading disk images at boot</refpurpose> |
| 25 |
</refnamediv> |
| 26 |
|
| 27 |
<refsynopsisdiv> |
| 28 |
<para><filename>/usr/lib/systemd/system-generators/systemd-import-generator</filename></para> |
| 29 |
</refsynopsisdiv> |
| 30 |
|
| 31 |
<refsect1> |
| 32 |
<title>Description</title> |
| 33 |
|
| 34 |
<para><command>systemd-import-generator</command> may be used to automatically download disk images |
| 35 |
(tarballs or DDIs) via |
| 36 |
<citerefentry><refentrytitle>systemd-importd.service</refentrytitle><manvolnum>8</manvolnum></citerefentry> |
| 37 |
at boot, based on parameters on the kernel command line or via system credentials. This is useful for |
| 38 |
automatically deploying an |
| 39 |
<citerefentry><refentrytitle>systemd-confext</refentrytitle><manvolnum>8</manvolnum></citerefentry>, |
| 40 |
<citerefentry><refentrytitle>systemd-sysext</refentrytitle><manvolnum>8</manvolnum></citerefentry>, |
| 41 |
<citerefentry><refentrytitle>systemd-nspawn</refentrytitle><manvolnum>1</manvolnum></citerefentry>/ |
| 42 |
<citerefentry><refentrytitle>systemd-vmspawn</refentrytitle><manvolnum>1</manvolnum></citerefentry> or |
| 43 |
<citerefentry><refentrytitle>systemd-portabled.service</refentrytitle><manvolnum>8</manvolnum></citerefentry> |
| 44 |
image at boot. This provides functionality equivalent to |
| 45 |
<citerefentry><refentrytitle>importctl</refentrytitle><manvolnum>1</manvolnum></citerefentry>, but |
| 46 |
accessible via the kernel command line and system credentials.</para> |
| 47 |
|
| 48 |
<para><filename>systemd-import-generator</filename> implements |
| 49 |
<citerefentry><refentrytitle>systemd.generator</refentrytitle><manvolnum>7</manvolnum></citerefentry>.</para> |
| 50 |
</refsect1> |
| 51 |
|
| 52 |
<refsect1> |
| 53 |
<title>Kernel Command Line</title> |
| 54 |
|
| 55 |
<para><filename>systemd-import-generator</filename> understands the following |
| 56 |
<citerefentry><refentrytitle>kernel-command-line</refentrytitle><manvolnum>7</manvolnum></citerefentry> |
| 57 |
parameters:</para> |
| 58 |
|
| 59 |
<variablelist class='kernel-commandline-options'> |
| 60 |
<varlistentry> |
| 61 |
<term><varname>systemd.pull=</varname></term> |
| 62 |
|
| 63 |
<listitem><para>This option takes a colon separate triplet of option string, local target image name |
| 64 |
and remote URL. The local target image name can be specified as an empty string, in which case the |
| 65 |
name is derived from the specified remote URL. The remote URL must using the |
| 66 |
<literal>http://</literal>, <literal>https://</literal>, <literal>file://</literal> schemes. The |
| 67 |
option string itself is a comma separated list of options:</para> |
| 68 |
|
| 69 |
<variablelist> |
| 70 |
<varlistentry> |
| 71 |
<term>rw</term> |
| 72 |
<term>ro</term> |
| 73 |
|
| 74 |
<listitem><para>Controls whether to mark the local image as read-only. If not |
| 75 |
specified read-only defaults to off.</para> |
| 76 |
|
| 77 |
<xi:include href="version-info.xml" xpointer="v257"/></listitem> |
| 78 |
</varlistentry> |
| 79 |
|
| 80 |
<varlistentry> |
| 81 |
<term>verify=</term> |
| 82 |
|
| 83 |
<listitem><para>Controls whether to cryptographically validate the download before installing it |
| 84 |
in place. Takes one of <literal>no</literal>, <literal>checksum</literal>, or |
| 85 |
<literal>signature</literal> (the default if not specified). For details see the |
| 86 |
<option>--verify=</option> of |
| 87 |
<citerefentry><refentrytitle>importctl</refentrytitle><manvolnum>1</manvolnum></citerefentry>. |
| 88 |
</para> |
| 89 |
|
| 90 |
<xi:include href="version-info.xml" xpointer="v257"/></listitem> |
| 91 |
</varlistentry> |
| 92 |
|
| 93 |
<varlistentry> |
| 94 |
<term>sysext</term> |
| 95 |
<term>confext</term> |
| 96 |
<term>machine</term> |
| 97 |
<term>portable</term> |
| 98 |
|
| 99 |
<listitem><para>Controls the image class to download, and thus ultimately the target directory |
| 100 |
for the image, depending on this choice the target directory |
| 101 |
<filename>/var/lib/extensions/</filename>, <filename>/var/lib/confexts/</filename>, |
| 102 |
<filename>/var/lib/machines/</filename> or <filename>/var/lib/portables/</filename> is |
| 103 |
selected.</para> |
| 104 |
|
| 105 |
<para>Specification of exactly one of these options is mandatory.</para> |
| 106 |
|
| 107 |
<xi:include href="version-info.xml" xpointer="v257"/></listitem> |
| 108 |
</varlistentry> |
| 109 |
|
| 110 |
<varlistentry> |
| 111 |
<term>tar</term> |
| 112 |
<term>raw</term> |
| 113 |
|
| 114 |
<listitem><para>Controls the type of resource to download, i.e. a (possibly compressed) tarball |
| 115 |
that needs to be unpacked into a file system tree, or (possibly compressed) raw disk image (DDI). |
| 116 |
</para> |
| 117 |
|
| 118 |
<para>Specification of exactly one of these options is mandatory.</para> |
| 119 |
|
| 120 |
<xi:include href="version-info.xml" xpointer="v257"/></listitem> |
| 121 |
</varlistentry> |
| 122 |
|
| 123 |
<varlistentry> |
| 124 |
<term>blockdev</term> |
| 125 |
|
| 126 |
<listitem><para>If this option is specified the downloaded image is attached to a loopback block |
| 127 |
device (via <filename>[email protected]</filename>) after completion. This permits booting |
| 128 |
from downloaded disk images. This is only supported for <literal>raw</literal> disk images.</para> |
| 129 |
|
| 130 |
<para>Note when this option is used with the purpose of mounting a disk image conforming to the |
| 131 |
<ulink url="https://uapi-group.org/specifications/specs/discoverable_disk_image/">UAPI.3 Discoverable |
| 132 |
Disk Image Specification</ulink> as root file system, and the automatic GPT partition discovery |
| 133 |
logic as implemented by |
| 134 |
<citerefentry><refentrytitle>systemd-gpt-auto-generator</refentrytitle><manvolnum>8</manvolnum></citerefentry> |
| 135 |
shall process it, it's essential to specify <literal>rootdisk</literal> as the local name for the |
| 136 |
import. Moreover, <literal>root=gpt-auto</literal> must be specified on the kernel command line |
| 137 |
explicitly. Also, prefix the <literal>systemd.pull=</literal> command line option with |
| 138 |
<literal>rd.</literal> to ensure it is executed in the initial RAM disk (initrd) already, also |
| 139 |
see below.</para> |
| 140 |
|
| 141 |
<xi:include href="version-info.xml" xpointer="v258"/></listitem> |
| 142 |
</varlistentry> |
| 143 |
|
| 144 |
<varlistentry> |
| 145 |
<term>bootorigin</term> |
| 146 |
|
| 147 |
<listitem><para>If this option is specified, in place of the URL a simple filename may be |
| 148 |
specified. If the system is booted via UEFI HTTP network booting the last component of the |
| 149 |
network boot origin URL is replaced by this filename and used as download source. This hence |
| 150 |
allows one to automatically derive the URLs for disk images from the original boot URL used to |
| 151 |
invoke the kernel or boot loader.</para> |
| 152 |
|
| 153 |
<para>If this option is used and the system is not actually booted via UEFI HTTP network booting, |
| 154 |
the download is gracefully skipped. Or in other words without other modifications it is possible |
| 155 |
to put together an initrd image that will boot from a local disk if available, or from downloaded |
| 156 |
disk image if used via network booting.</para> |
| 157 |
|
| 158 |
<xi:include href="version-info.xml" xpointer="v258"/></listitem> |
| 159 |
</varlistentry> |
| 160 |
|
| 161 |
<varlistentry> |
| 162 |
<term>runtime=</term> |
| 163 |
|
| 164 |
<listitem><para>Takes a boolean argument. If set to true, the image is downloaded below the |
| 165 |
<filename>/run/</filename> hierarchy, if set to false below the <filename>/var/lib/</filename> |
| 166 |
hierarchy. If not specified defaults to true in the initial RAM disk (initrd) and to false on the |
| 167 |
host system.</para> |
| 168 |
|
| 169 |
<xi:include href="version-info.xml" xpointer="v258"/></listitem> |
| 170 |
</varlistentry> |
| 171 |
</variablelist> |
| 172 |
|
| 173 |
<xi:include href="version-info.xml" xpointer="v257"/></listitem> |
| 174 |
</varlistentry> |
| 175 |
|
| 176 |
<varlistentry> |
| 177 |
<term><varname>systemd.pull.success_action=</varname></term> |
| 178 |
<term><varname>systemd.pull.failure_action=</varname></term> |
| 179 |
|
| 180 |
<listitem><para>Controls whether to execute an action such as reboot, power-off and similar after |
| 181 |
completing the download successfully, or unsuccessfully. See |
| 182 |
<varname>SuccessAction=</varname>/<varname>FailureAction=</varname> on |
| 183 |
<citerefentry><refentrytitle>systemd.unit</refentrytitle><manvolnum>5</manvolnum></citerefentry> for |
| 184 |
details about the available actions. If not specified, no action is taken, and the system will |
| 185 |
continue to boot normally.</para> |
| 186 |
|
| 187 |
<xi:include href="version-info.xml" xpointer="v257"/></listitem> |
| 188 |
</varlistentry> |
| 189 |
</variablelist> |
| 190 |
|
| 191 |
<para>These kernel command line options are interpreted by the host system only. If these options are |
| 192 |
prefixed with <literal>rd.</literal> they are interpreted by the initial RAM disk (initrd) |
| 193 |
instead.</para> |
| 194 |
</refsect1> |
| 195 |
|
| 196 |
<refsect1> |
| 197 |
<title>Credentials</title> |
| 198 |
|
| 199 |
<para><command>systemd-import-generator</command> supports the system credentials logic. The following |
| 200 |
credentials are used when passed in:</para> |
| 201 |
|
| 202 |
<variablelist class='system-credentials'> |
| 203 |
<varlistentry> |
| 204 |
<term><varname>import.pull</varname></term> |
| 205 |
|
| 206 |
<listitem><para>This credential should be a text file, with each line referencing one download |
| 207 |
operation. Each line should follow the same format as the value of the |
| 208 |
<varname>systemd.pull=</varname> kernel command line option described above.</para> |
| 209 |
|
| 210 |
<xi:include href="version-info.xml" xpointer="v257"/></listitem> |
| 211 |
</varlistentry> |
| 212 |
</variablelist> |
| 213 |
</refsect1> |
| 214 |
|
| 215 |
<refsect1> |
| 216 |
<title>Examples</title> |
| 217 |
|
| 218 |
<example> |
| 219 |
<title>Download Configuration Extension</title> |
| 220 |
|
| 221 |
<programlisting>systemd.pull=raw,confext::https://example.com/myconfext.raw.gz</programlisting> |
| 222 |
|
| 223 |
<para>With a kernel command line option like the above a configuration extension DDI is downloaded |
| 224 |
automatically at boot from the specified URL, validated cryptographically, uncompressed and installed.</para> |
| 225 |
</example> |
| 226 |
|
| 227 |
<example> |
| 228 |
<title>Download System Extension (Without Validation)</title> |
| 229 |
|
| 230 |
<programlisting>systemd.pull=tar,sysext,verify=no::https://example.com/mysysext.tar.gz</programlisting> |
| 231 |
|
| 232 |
<para>With a kernel command line option like the above a system extension tarball is downloaded |
| 233 |
automatically at boot from the specified URL, uncompressed and installed – without any cryptographic |
| 234 |
validation. This is useful for development purposes in virtual machines and containers. Warning: do not |
| 235 |
deploy a system with validation disabled like this!</para> |
| 236 |
</example> |
| 237 |
|
| 238 |
<example> |
| 239 |
<title>Download root disk image (raw) into memory, for booting into it</title> |
| 240 |
|
| 241 |
<programlisting>rd.systemd.pull=raw,machine,verify=no,blockdev:image:https://example.com/image.raw.xz root=/dev/disk/by-loop-ref/image.raw-part2</programlisting> |
| 242 |
|
| 243 |
<para>This downloads the specified disk image, saving it locally under the name |
| 244 |
<literal>image</literal>, and attaches it to a loopback block device on completion. It then boots from |
| 245 |
the 2nd partition in the image.</para> |
| 246 |
</example> |
| 247 |
|
| 248 |
<example> |
| 249 |
<title>Boot into disk image (raw), with URL derived from UEFI HTTP network booting</title> |
| 250 |
|
| 251 |
<programlisting>rd.systemd.pull=raw,machine,verify=no,blockdev,bootorigin:rootdisk:image.raw.xz root=gpt-auto</programlisting> |
| 252 |
|
| 253 |
<para>This is similar to the previous example, but this time the source URL is automatically derived |
| 254 |
from the UEFI HTTP network boot URL. For example, if an UKI is booted from an URL |
| 255 |
<literal>http://example.com/image.efi</literal> this would result in a root disk being downloaded from |
| 256 |
<literal>http://example.com/image.raw.xz</literal>. Moreover this uses the |
| 257 |
<citerefentry><refentrytitle>systemd-gpt-auto-generator</refentrytitle><manvolnum>8</manvolnum></citerefentry> |
| 258 |
logic to mount the root file system from the disk image.</para> |
| 259 |
</example> |
| 260 |
|
| 261 |
<example> |
| 262 |
<title>Boot into disk image (tar), with URL derived from UEFI HTTP network booting</title> |
| 263 |
|
| 264 |
<programlisting>rd.systemd.pull=tar,machine,verify=no,bootorigin:root:image.tar.xz root=bind:/run/machines/root</programlisting> |
| 265 |
|
| 266 |
<para>This is similar to the previous example, but instead of a raw (i.e. block device based) disk |
| 267 |
image the system boots into a tarball that is downloaded from the originating UEFI network |
| 268 |
server.</para> |
| 269 |
</example> |
| 270 |
</refsect1> |
| 271 |
|
| 272 |
<refsect1> |
| 273 |
<title>See Also</title> |
| 274 |
<para><simplelist type="inline"> |
| 275 |
<member><citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry></member> |
| 276 |
<member><citerefentry><refentrytitle>systemd-importd.service</refentrytitle><manvolnum>8</manvolnum></citerefentry></member> |
| 277 |
<member><citerefentry><refentrytitle>kernel-command-line</refentrytitle><manvolnum>7</manvolnum></citerefentry></member> |
| 278 |
<member><citerefentry><refentrytitle>systemd.system-credentials</refentrytitle><manvolnum>7</manvolnum></citerefentry></member> |
| 279 |
<member><citerefentry><refentrytitle>importctl</refentrytitle><manvolnum>1</manvolnum></citerefentry></member> |
| 280 |
<member><citerefentry><refentrytitle>[email protected]</refentrytitle><manvolnum>8</manvolnum></citerefentry></member> |
| 281 |
<member><citerefentry><refentrytitle>systemd-gpt-auto-generator</refentrytitle><manvolnum>8</manvolnum></citerefentry></member> |
| 282 |
</simplelist></para> |
| 283 |
</refsect1> |
| 284 |
</refentry> |