]> git.ipfire.org Git - thirdparty/systemd.git/blame - man/systemd-sysext.xml
Merge pull request #25608 from poettering/dissect-moar
[thirdparty/systemd.git] / man / systemd-sysext.xml
CommitLineData
7a87fb61
LP
1<?xml version='1.0'?> <!--*-nxml-*-->
2<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
3 "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">
4<!-- SPDX-License-Identifier: LGPL-2.1-or-later -->
5
6<refentry id="systemd-sysext"
7 xmlns:xi="http://www.w3.org/2001/XInclude">
8
9 <refentryinfo>
10 <title>systemd-sysext</title>
11 <productname>systemd</productname>
12 </refentryinfo>
13
14 <refmeta>
15 <refentrytitle>systemd-sysext</refentrytitle>
16 <manvolnum>8</manvolnum>
17 </refmeta>
18
19 <refnamediv>
20 <refname>systemd-sysext</refname>
21 <refname>systemd-sysext.service</refname>
1f4f1666 22 <refname>systemd-confext</refname>
23 <refname>systemd-confext.service</refname>
7a87fb61
LP
24 <refpurpose>Activates System Extension Images</refpurpose>
25 </refnamediv>
26
27 <refsynopsisdiv>
28 <cmdsynopsis>
29 <command>systemd-sysext</command>
30 <arg choice="opt" rep="repeat">OPTIONS</arg>
782e41ab 31 <arg choice="plain">COMMAND</arg>
7a87fb61
LP
32 </cmdsynopsis>
33
34 <para><literallayout><filename>systemd-sysext.service</filename></literallayout></para>
35
1f4f1666 36 <cmdsynopsis>
37 <command>systemd-confext</command>
38 <arg choice="opt" rep="repeat">OPTIONS</arg>
39 <arg choice="plain">COMMAND</arg>
40 </cmdsynopsis>
41
42 <para><literallayout><filename>systemd-confext.service</filename></literallayout></para>
43
7a87fb61
LP
44 </refsynopsisdiv>
45
46 <refsect1>
47 <title>Description</title>
48
49 <para><command>systemd-sysext</command> activates/deactivates system extension images. System extension
50 images may – dynamically at runtime — extend the <filename>/usr/</filename> and
51 <filename>/opt/</filename> directory hierarchies with additional files. This is particularly useful on
52 immutable system images where a <filename>/usr/</filename> and/or <filename>/opt/</filename> hierarchy
53 residing on a read-only file system shall be extended temporarily at runtime without making any
54 persistent modifications.</para>
55
56 <para>System extension images should contain files and directories similar in fashion to regular
57 operating system tree. When one or more system extension images are activated, their
58 <filename>/usr/</filename> and <filename>/opt/</filename> hierarchies are combined via
59 <literal>overlayfs</literal> with the same hierarchies of the host OS, and the host
be0d27ee 60 <filename>/usr/</filename> and <filename>/opt/</filename> overmounted with it ("merging"). When they are
7a87fb61
LP
61 deactivated, the mount point is disassembled — again revealing the unmodified original host version of
62 the hierarchy ("unmerging"). Merging thus makes the extension's resources suddenly appear below the
63 <filename>/usr/</filename> and <filename>/opt/</filename> hierarchies as if they were included in the
64 base OS image itself. Unmerging makes them disappear again, leaving in place only the files that were
65 shipped with the base OS image itself.</para>
66
67 <para>Files and directories contained in the extension images outside of the <filename>/usr/</filename>
68 and <filename>/opt/</filename> hierarchies are <emphasis>not</emphasis> merged, and hence have no effect
60bb6caa
LB
69 when included in a system extension image. In particular, files in the <filename>/etc/</filename> and
70 <filename>/var/</filename> included in a system extension image will <emphasis>not</emphasis> appear in
71 the respective hierarchies after activation.</para>
7a87fb61
LP
72
73 <para>System extension images are strictly read-only, and the host <filename>/usr/</filename> and
74 <filename>/opt/</filename> hierarchies become read-only too while they are activated.</para>
75
76 <para>System extensions are supposed to be purely additive, i.e. they are supposed to include only files
77 that do not exist in the underlying basic OS image. However, the underlying mechanism (overlayfs) also
566e4b3a 78 allows overlaying or removing files, but it is recommended not to make use of this.</para>
7a87fb61
LP
79
80 <para>System extension images may be provided in the following formats:</para>
81
82 <orderedlist>
83 <listitem><para>Plain directories or btrfs subvolumes containing the OS tree</para></listitem>
84 <listitem><para>Disk images with a GPT disk label, following the <ulink
db811444 85 url="https://uapi-group.org/specifications/specs/discoverable_partitions_specification">Discoverable Partitions Specification</ulink></para></listitem>
09e917ea
LP
86 <listitem><para>Disk images lacking a partition table, with a naked Linux file system (e.g. erofs,
87 squashfs or ext4)</para></listitem>
7a87fb61
LP
88 </orderedlist>
89
90 <para>These image formats are the same ones that
91 <citerefentry><refentrytitle>systemd-nspawn</refentrytitle><manvolnum>1</manvolnum></citerefentry>
01ae74c8 92 supports via its <option>--directory=</option>/<option>--image=</option> switches and those that the
7a87fb61
LP
93 service manager supports via <option>RootDirectory=</option>/<option>RootImage=</option>. Similar to
94 them they may optionally carry Verity authentication information.</para>
95
0d6e0ade 96 <para>System extensions are searched for in the directories
de862276
LB
97 <filename>/etc/extensions/</filename>, <filename>/run/extensions/</filename> and
98 <filename>/var/lib/extensions/</filename>. The first two listed directories are not suitable for
7a87fb61
LP
99 carrying large binary images, however are still useful for carrying symlinks to them. The primary place
100 for installing system extensions is <filename>/var/lib/extensions/</filename>. Any directories found in
0d6e0ade 101 these search directories are considered directory based extension images; any files with the
9ea81191
LP
102 <filename>.raw</filename> suffix are considered disk image based extension images. When invoked in the
103 initrd, the additional directory <filename>/.extra/sysext/</filename> is included in the directories that
104 are searched for extension images. Note however, that by default a tighter image policy applies to images
105 found there, though, see below. This directory is populated by
106 <citerefentry><refentrytitle>systemd-stub</refentrytitle><manvolnum>7</manvolnum></citerefentry> with
107 extension images found in the system's EFI System Partition.</para>
7a87fb61
LP
108
109 <para>During boot OS extension images are activated automatically, if the
110 <filename>systemd-sysext.service</filename> is enabled. Note that this service runs only after the
6a15846d 111 underlying file systems where system extensions may be located have been mounted. This means they are not
7a87fb61
LP
112 suitable for shipping resources that are processed by subsystems running in earliest boot. Specifically,
113 OS extension images are not suitable for shipping system services or
114 <citerefentry><refentrytitle>systemd-sysusers</refentrytitle><manvolnum>8</manvolnum></citerefentry>
8b9f0921
ZJS
115 definitions. See the <ulink url="https://systemd.io/PORTABLE_SERVICES">Portable Services Documentation</ulink>
116 for a simple mechanism for shipping system services in disk images, in a similar fashion to OS
117 extensions. Note the different isolation on these two mechanisms: while system extension directly extend
118 the underlying OS image with additional files that appear in a way very similar to as if they were
119 shipped in the OS image itself and thus imply no security isolation, portable services imply service
120 level sandboxing in one way or another. The <filename>systemd-sysext.service</filename> service is
121 guaranteed to finish start-up before <filename>basic.target</filename> is reached; i.e. at the time
122 regular services initialize (those which do not use <varname>DefaultDependencies=no</varname>), the files
123 and directories system extensions provide are available in <filename>/usr/</filename> and
124 <filename>/opt/</filename> and may be accessed.</para>
7a87fb61
LP
125
126 <para>Note that there is no concept of enabling/disabling installed system extension images: all
1abe15fe
KL
127 installed extension images are automatically activated at boot. However, you can place an empty directory
128 named like the extension (no <filename>.raw</filename>) in <filename>/etc/extensions/</filename> to "mask"
129 an extension with the same name in a system folder with lower precedence.</para>
7a87fb61 130
60bb6caa
LB
131 <para>A simple mechanism for version compatibility is enforced: a system extension image must carry a
132 <filename>/usr/lib/extension-release.d/extension-release.<replaceable>$name</replaceable></filename>
133 file, which must match its image name, that is compared with the host <filename>os-release</filename>
ab4d43c5
KL
134 file: the contained <varname>ID=</varname> fields have to match unless <literal>_any</literal> is set
135 for the extension. If the extension <varname>ID=</varname> is not <literal>_any</literal>, the
136 <varname>SYSEXT_LEVEL=</varname> field (if defined) has to match. If the latter is not defined, the
16c1ca0d
KL
137 <varname>VERSION_ID=</varname> field has to match instead. If the extension defines the
138 <varname>ARCHITECTURE=</varname> field and the value is not <literal>_any</literal> it has to match the kernel's
139 architecture reported by <citerefentry><refentrytitle>uname</refentrytitle><manvolnum>2</manvolnum></citerefentry>
140 but the used architecture identifiers are the same as for <varname>ConditionArchitecture=</varname>
141 described in <citerefentry><refentrytitle>systemd.unit</refentrytitle><manvolnum>5</manvolnum></citerefentry>.
142 System extensions should not ship a <filename>/usr/lib/os-release</filename> file (as that would be merged
143 into the host <filename>/usr/</filename> tree, overriding the host OS version data, which is not desirable).
144 The <filename>extension-release</filename> file follows the same format and semantics, and carries the same
60bb6caa
LB
145 content, as the <filename>os-release</filename> file of the OS, but it describes the resources carried
146 in the extension image.</para>
1f4f1666 147
148 <para>The <command>systemd-confext</command> concept follows the same principle as the
149 <citerefentry><refentrytitle>systemd-sysext</refentrytitle><manvolnum>1</manvolnum></citerefentry>
150 functionality but instead of working on <filename>/usr</filename> and <filename>/opt</filename>,
151 <command>confext</command> will extend only <filename>/etc</filename>. Files and directories contained
152 in the confext images outside of the <filename>/etc/</filename> hierarchy are <emphasis>not</emphasis>
153 merged, and hence have no effect when included in the image. Formats for these images are of the
154 same as sysext images.</para>
155
156 <para>Confexts are looked for in the directories <filename>/run/confexts/</filename>,
157 <filename>/var/lib/confexts/</filename>, <filename>/usr/lib/confexts/</filename> and
158 <filename>/usr/local/lib/confexts/</filename>. The first two listed directories are not suitable for
159 carrying large binary images, however are still useful for carrying symlinks to them. The primary place
160 for installing system extensions is <filename>/var/lib/confexts/</filename>. Any directories found in
161 these search directories are considered directory based confext images, any files with the
162 <filename>.raw</filename> suffix are considered disk image based confext images.</para>
163
164 <para>Again, just like sysext images, the confext images will contain a
165 <filename>/etc/extension-release.d/extension-release.<replaceable>$name</replaceable></filename>
166 file, which must match the image name (with the usual escape hatch of xattr), and again with content
167 being one or more of <varname>ID=</varname>, <varname>VERSION_ID=</varname>, and
168 <varname>CONFEXT_LEVEL</varname>. Confext images will then be checked and matched against the
169 base OS layer.</para>
7a87fb61
LP
170 </refsect1>
171
172 <refsect1>
173 <title>Uses</title>
174
175 <para>The primary use case for system images are immutable environments where debugging and development
be0d27ee
ZJS
176 tools shall optionally be made available, but not included in the immutable base OS image itself (e.g.
177 <citerefentry project='man-pages'><refentrytitle>strace</refentrytitle><manvolnum>1</manvolnum></citerefentry>
178 and
179 <citerefentry project='man-pages'><refentrytitle>gdb</refentrytitle><manvolnum>1</manvolnum></citerefentry>
180 shall be an optionally installable addition in order to make debugging/development easier). System
181 extension images should not be misunderstood as a generic software packaging framework, as no dependency
182 scheme is available: system extensions should carry all files they need themselves, except for those
183 already shipped in the underlying host system image. Typically, system extension images are built at the
184 same time as the base OS image — within the same build system.</para>
7a87fb61
LP
185
186 <para>Another use case for the system extension concept is temporarily overriding OS supplied resources
187 with newer ones, for example to install a locally compiled development version of some low-level
188 component over the immutable OS image without doing a full OS rebuild or modifying the nominally
189 immutable image. (e.g. "install" a locally built package with <command>DESTDIR=/var/lib/extensions/mytest
301265ea 190 make install &amp;&amp; systemd-sysext refresh</command>, making it available in
7a87fb61
LP
191 <filename>/usr/</filename> as if it was installed in the OS image itself.) This case works regardless if
192 the underlying host <filename>/usr/</filename> is managed as immutable disk image or is a traditional
193 package manager controlled (i.e. writable) tree.</para>
1f4f1666 194
195 <para>For the confext case, the OSConfig project aims to perform runtime reconfiguration of OS services.
196 Sometimes, there is a need to swap certain configuration parameter values or restart only a specific
197 service without deployment of new code or a complete OS deployment. In other words, we want to be able
198 to tie the most frequently configured options to runtime updateable flags that can be changed without a
199 system reboot. This will help reduce servicing times when there is a need for changing the OS configuration.</para></refsect1>
7a87fb61
LP
200
201 <refsect1>
202 <title>Commands</title>
203
1f4f1666 204 <para>The following commands are understood by both the sysext and confext concepts:</para>
7a87fb61
LP
205
206 <variablelist>
207 <varlistentry>
301265ea
LP
208 <term><option>status</option></term>
209
210 <listitem><para>When invoked without any command verb, or when <option>status</option> is specified
1f4f1666 211 the current merge status is shown, separately (for both <filename>/usr/</filename> and
212 <filename>/opt/</filename> of sysext and for <filename>/etc/</filename> of confext).</para></listitem>
301265ea
LP
213 </varlistentry>
214
215 <varlistentry>
216 <term><option>merge</option></term>
7a87fb61
LP
217 <listitem><para>Merges all currently installed system extension images into
218 <filename>/usr/</filename> and <filename>/opt/</filename>, by overmounting these hierarchies with an
219 <literal>overlayfs</literal> file system combining the underlying hierarchies with those included in
1f4f1666 220 the extension images. This command will fail if the hierarchies are already merged. For confext, the merge
221 happens into the <filename>/etc/</filename> directory instead.</para></listitem>
7a87fb61
LP
222 </varlistentry>
223
224 <varlistentry>
301265ea 225 <term><option>unmerge</option></term>
7a87fb61 226 <listitem><para>Unmerges all currently installed system extension images from
1f4f1666 227 <filename>/usr/</filename> and <filename>/opt/</filename> for sysext and <filename>/etc/</filename>,
228 for confext, by unmounting the <literal>overlayfs</literal> file systems created by <option>merge</option>
7a87fb61
LP
229 prior.</para></listitem>
230 </varlistentry>
231
232 <varlistentry>
301265ea
LP
233 <term><option>refresh</option></term>
234 <listitem><para>A combination of <option>unmerge</option> and <option>merge</option>: if already
7a87fb61
LP
235 mounted the existing <literal>overlayfs</literal> instance is unmounted temporarily, and then
236 replaced by a new version. This command is useful after installing/removing system extension images,
237 in order to update the <literal>overlayfs</literal> file system accordingly. If no system extensions
1f4f1666 238 are installed when this command is executed, the equivalent of <option>unmerge</option> is executed,
239 without establishing any new <literal>overlayfs</literal> instance.
240 Note that currently there's a brief moment where neither the old nor the new <literal>overlayfs</literal>
241 file system is mounted. This implies that all resources supplied by a system extension will briefly
242 disappear — even if it exists continuously during the refresh operation.</para></listitem>
7a87fb61
LP
243 </varlistentry>
244
245 <varlistentry>
301265ea 246 <term><option>list</option></term>
7a87fb61
LP
247
248 <listitem><para>A brief list of installed extension images is shown.</para></listitem>
249 </varlistentry>
250
251 <xi:include href="standard-options.xml" xpointer="help" />
252 <xi:include href="standard-options.xml" xpointer="version" />
253 </variablelist>
7a87fb61
LP
254 </refsect1>
255
256 <refsect1>
257 <title>Options</title>
258
259 <variablelist>
260 <varlistentry>
261 <term><option>--root=</option></term>
262
263 <listitem><para>Operate relative to the specified root directory, i.e. establish the
264 <literal>overlayfs</literal> mount not on the top-level host <filename>/usr/</filename> and
1f4f1666 265 <filename>/opt/</filename> hierarchies for sysext or <filename>/etc/</filename> for confext,
266 but below some specified root directory.</para></listitem>
7a87fb61
LP
267 </varlistentry>
268
301265ea
LP
269 <varlistentry>
270 <term><option>--force</option></term>
271
272 <listitem><para>When merging system extensions into <filename>/usr/</filename> and
1f4f1666 273 <filename>/opt/</filename> for sysext and <filename>/etc/</filename> for confext,
274 ignore version incompatibilities, i.e. force merging regardless of
275 whether the version information included in the images matches the host or not.</para></listitem>
301265ea
LP
276 </varlistentry>
277
9ea81191
LP
278 <varlistentry>
279 <term><option>--image-policy=<replaceable>policy</replaceable></option></term>
280
281 <listitem><para>Takes an image policy string as argument, as per
282 <citerefentry><refentrytitle>systemd.image-policy</refentrytitle><manvolnum>7</manvolnum></citerefentry>. The
283 policy is enforced when operating on system extension disk images. If not specified defaults to
284 <literal>root=verity+signed+encrypted+unprotected+absent:usr=verity+signed+encrypted+unprotected+absent</literal>,
285 i.e. only the root and <filename>/usr/</filename> file systems in the image are used. When run in the
286 initrd and operating on a system extension image stored in the <filename>/.extra/sysext/</filename>
287 directory a slightly stricter policy is used by default:
288 <literal>root=signed+absent:usr=signed+absent</literal>, see above for details.</para></listitem>
289 </varlistentry>
290
7a87fb61 291 <xi:include href="standard-options.xml" xpointer="no-pager" />
16a36b56 292 <xi:include href="standard-options.xml" xpointer="no-legend" />
8d0d1a30 293 <xi:include href="standard-options.xml" xpointer="json" />
7a87fb61
LP
294 </variablelist>
295 </refsect1>
296
297 <refsect1>
298 <title>Exit status</title>
299
300 <para>On success, 0 is returned.</para>
301 </refsect1>
302
303 <refsect1>
304 <title>See Also</title>
305 <para>
306 <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
9ea81191
LP
307 <citerefentry><refentrytitle>systemd-nspawn</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
308 <citerefentry><refentrytitle>systemd-stub</refentrytitle><manvolnum>7</manvolnum></citerefentry>
7a87fb61
LP
309 </para>
310 </refsect1>
311
312</refentry>