]> git.ipfire.org Git - thirdparty/systemd.git/blame - man/kernel-install.xml
cryptsetup: mention correct action in log message
[thirdparty/systemd.git] / man / kernel-install.xml
CommitLineData
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">
db9ecf05 4<!-- SPDX-License-Identifier: LGPL-2.1-or-later -->
81516adc 5
9858e6d2 6<refentry id="kernel-install" conditional='ENABLE_KERNEL_INSTALL'
7054308a 7 xmlns:xi="http://www.w3.org/2001/XInclude">
81516adc
HH
8
9 <refentryinfo>
10 <title>kernel-install</title>
11 <productname>systemd</productname>
81516adc
HH
12 </refentryinfo>
13
14 <refmeta>
15 <refentrytitle>kernel-install</refentrytitle>
16 <manvolnum>8</manvolnum>
17 </refmeta>
18
19 <refnamediv>
20 <refname>kernel-install</refname>
b66a6e1a 21 <refpurpose>Add and remove kernel and initrd images to and from /boot</refpurpose>
81516adc
HH
22 </refnamediv>
23
24 <refsynopsisdiv>
25 <cmdsynopsis>
845c5324 26 <command>kernel-install</command>
7054308a 27 <arg choice="opt" rep="repeat">OPTIONS</arg>
f5c0edd1 28 <arg choice="plain">add</arg>
845c5324 29 <arg choice="plain"><replaceable>KERNEL-VERSION</replaceable></arg>
04ca4d19 30 <arg choice="plain"><replaceable>KERNEL-IMAGE</replaceable></arg>
0912c0b8 31 <arg choice="opt" rep="repeat"><replaceable>INITRD-FILE</replaceable></arg>
81516adc 32 </cmdsynopsis>
6be9f641
AAF
33 <cmdsynopsis>
34 <command>kernel-install</command>
35 <arg choice="opt" rep="repeat">OPTIONS</arg>
36 <arg choice="plain">add-all</arg>
37 </cmdsynopsis>
f5c0edd1
YW
38 <cmdsynopsis>
39 <command>kernel-install</command>
40 <arg choice="opt" rep="repeat">OPTIONS</arg>
41 <arg choice="plain">remove</arg>
42 <arg choice="plain"><replaceable>KERNEL-VERSION</replaceable></arg>
43 </cmdsynopsis>
44 <cmdsynopsis>
45 <command>kernel-install</command>
46 <arg choice="opt" rep="repeat">OPTIONS</arg>
47 <arg choice="plain">inspect</arg>
bdd36c00 48 <arg choice="opt"><replaceable>KERNEL-VERSION</replaceable></arg>
f7665b7f 49 <arg choice="opt"><replaceable>KERNEL-IMAGE</replaceable></arg>
bdd36c00 50 <arg choice="opt" rep="repeat"><replaceable>INITRD-FILE</replaceable></arg>
f5c0edd1 51 </cmdsynopsis>
658e6cc4
LP
52 <cmdsynopsis>
53 <command>kernel-install</command>
54 <arg choice="opt" rep="repeat">OPTIONS</arg>
55 <arg choice="plain">list</arg>
56 </cmdsynopsis>
81516adc
HH
57 </refsynopsisdiv>
58
59 <refsect1>
60 <title>Description</title>
b66a6e1a
ZJS
61 <para><command>kernel-install</command> is used to install and remove kernel and initrd images
62 <footnote>
63 <para>Nowadays actually CPIO archives used as an "initramfs", rather than "initrd". See
64 <citerefentry><refentrytitle>bootup</refentrytitle><manvolnum>7</manvolnum></citerefentry> for an
65 explanation.</para>
66 </footnote>
67 to and from the boot loader partition, referred to as <varname>$BOOT</varname> here. It will usually be
68 one of <filename>/boot/</filename>, <filename>/efi/</filename>, or <filename>/boot/efi/</filename>, see
69 below.</para>
81516adc 70
fe81e346
LP
71 <para><command>kernel-install</command> will run the executable files ("plugins") located in the
72 directory <filename>/usr/lib/kernel/install.d/</filename> and the local administration directory
73 <filename>/etc/kernel/install.d/</filename>. All files are collectively sorted and executed in lexical
74 order, regardless of the directory in which they live. However, files with identical filenames replace
75 each other. Files in <filename>/etc/kernel/install.d/</filename> take precedence over files with the
76 same name in <filename>/usr/lib/kernel/install.d/</filename>. This can be used to override a
77 system-supplied executables with a local file if needed; a symbolic link in
78 <filename>/etc/kernel/install.d/</filename> with the same name as an executable in
79 <filename>/usr/lib/kernel/install.d/</filename>, pointing to <filename>/dev/null</filename>, disables the
80 executable entirely. Executables must have the extension <literal>.install</literal>; other extensions
81 are ignored.</para>
82
83 <para>An executable placed in these directories should return <constant>0</constant> on success. It may
84 also return <constant>77</constant> to cause the whole operation to terminate (executables later in
85 lexical order will be skipped).</para>
81516adc
HH
86 </refsect1>
87
88 <refsect1>
89 <title>Commands</title>
90 <para>The following commands are understood:</para>
91 <variablelist>
92 <varlistentry>
4454ca10 93 <term>
9d9e99a8 94 <command>add [[[<replaceable>KERNEL-VERSION</replaceable>] <replaceable>KERNEL-IMAGE</replaceable>] [<replaceable>INITRD-FILE</replaceable> ...]]</command>
4454ca10
ZJS
95 </term>
96
81516adc 97 <listitem>
9d9e99a8
LP
98 <para>This command takes a kernel version string and a path to a kernel image file as arguments. If
99 the former is omitted, specified as an empty string or as "-" it defaults to the current kernel
100 version, i.e. the same string <command>uname -r</command> returns. If the latter is omitted,
101 specified as an empty string or as "-" defaults to
102 <filename>/usr/lib/modules/<replaceable>KERNEL_VERSION</replaceable>/vmlinuz</filename>. Optionally,
103 one or more initrd images may be specified as well (note that plugins might generate additional
104 ones).</para>
4454ca10
ZJS
105
106 <para>The executable files from <filename>/usr/lib/kernel/install.d/*.install</filename> and
107 <filename>/etc/kernel/install.d/*.install</filename> (i.e. the plugins) are called with the
108 following arguments:</para>
4b2d80bb 109
4454ca10
ZJS
110 <programlisting>add <replaceable>KERNEL-VERSION</replaceable> <filename>$BOOT/<replaceable>ENTRY-TOKEN</replaceable>/<replaceable>KERNEL-VERSION</replaceable>/</filename> <replaceable>KERNEL-IMAGE</replaceable> \
111 [<replaceable>INITRD-FILE</replaceable> ...]</programlisting>
fe81e346 112
b66a6e1a 113 <para>The third argument directly refers to the path where to place kernel images, initrd
4454ca10
ZJS
114 images and other resources for
115 <ulink url="https://uapi-group.org/specifications/specs/boot_loader_specification">Boot
fe81e346 116 Loader Specification</ulink> Type #1 entries (the "entry directory"). If other boot loader schemes
4454ca10
ZJS
117 are used the parameter may be ignored.</para>
118
119 <para>The <replaceable>ENTRY-TOKEN</replaceable> string is typically the machine ID and is supposed
120 to identify the local installation on the system. For details see below.</para>
845c5324 121
641e2124 122 <para>Two default plugins execute the following operations in this case:</para>
4b2d80bb
LP
123
124 <itemizedlist>
641e2124 125 <listitem><para><command>kernel-install</command> creates
fe81e346
LP
126 <filename>$BOOT/<replaceable>ENTRY-TOKEN</replaceable>/<replaceable>KERNEL-VERSION</replaceable></filename>,
127 if enabled (see <varname>$KERNEL_INSTALL_LAYOUT</varname>).</para></listitem>
4b2d80bb
LP
128
129 <listitem><para><filename>50-depmod.install</filename> runs
b7a47345 130 <citerefentry project='man-pages'><refentrytitle>depmod</refentrytitle><manvolnum>8</manvolnum></citerefentry> for the
4b2d80bb
LP
131 <replaceable>KERNEL-VERSION</replaceable>.</para></listitem>
132
fe81e346
LP
133 <listitem><para><filename>90-loaderentry.install</filename> copies
134 <replaceable>KERNEL-IMAGE</replaceable> to
135 <filename>$BOOT/<replaceable>ENTRY-TOKEN</replaceable>/<replaceable>KERNEL-VERSION</replaceable>/linux</filename>.
641e2124 136 If <replaceable>INITRD-FILE</replaceable>s are provided, it also copies them to
fe81e346 137 <filename>$BOOT/<replaceable>ENTRY-TOKEN</replaceable>/<replaceable>KERNEL_VERSION</replaceable>/<replaceable>INITRD-FILE</replaceable></filename>.
42210652 138 This can also be used to prepend microcode before the actual initrd. It also creates a boot loader entry according to the <ulink
db811444 139 url="https://uapi-group.org/specifications/specs/boot_loader_specification">Boot Loader Specification</ulink> (Type #1) in
fe81e346 140 <filename>$BOOT/loader/entries/<replaceable>ENTRY-TOKEN</replaceable>-<replaceable>KERNEL-VERSION</replaceable>.conf</filename>.
4b2d80bb 141 The title of the entry is the <replaceable>PRETTY_NAME</replaceable> parameter specified in
fe81e346
LP
142 <filename>/etc/os-release</filename> or <filename>/usr/lib/os-release</filename> (if the former
143 is missing), or "Linux <replaceable>KERNEL-VERSION</replaceable>", if unset.</para>
cf73f650 144
fe81e346 145 <para>If <varname>$KERNEL_INSTALL_LAYOUT</varname> is not "bls", this plugin does nothing.</para></listitem>
0ccfd356
JB
146
147 <listitem><para><filename>90-uki-copy.install</filename> copies a file
148 <filename>uki.efi</filename> from <varname>$KERNEL_INSTALL_STAGING_AREA</varname> or if it does
642617f4 149 not exist the <replaceable>KERNEL-IMAGE</replaceable> argument, only if it has a
0ccfd356
JB
150 <literal>.efi</literal> extension, to
151 <filename>$BOOT/EFI/Linux/<replaceable>ENTRY-TOKEN</replaceable>-<replaceable>KERNEL-VERSION</replaceable>.efi</filename>.</para>
152
153 <para>If <varname>$KERNEL_INSTALL_LAYOUT</varname> is not "uki", this plugin does nothing.</para></listitem>
4b2d80bb 154 </itemizedlist>
ec07c3c8 155
aefdc112 156 <xi:include href="version-info.xml" xpointer="v198"/>
81516adc
HH
157 </listitem>
158 </varlistentry>
ec1399f5
LP
159 <varlistentry>
160 <term>
161 <command>add-all</command>
162 </term>
163
164 <listitem>
165 <para>This is the same as <command>add</command> (see above), but invokes the operation iteratively
166 for every installed kernel in <filename>/usr/lib/modules/</filename>. This operation is only
167 supported on systems where the kernel image is installed in
168 <filename>/usr/lib/modules/<replaceable>KERNEL-VERSION</replaceable>/vmlinuz</filename>.</para>
169
170 <xi:include href="version-info.xml" xpointer="v255"/>
171 </listitem>
172 </varlistentry>
81516adc 173 <varlistentry>
8f51399e 174 <term><command>remove <replaceable>KERNEL-VERSION</replaceable></command></term>
845c5324 175 <listitem>
4454ca10
ZJS
176 <para>This command expects a kernel version string as single argument.</para>
177
178 <para>The executable files from <filename>/usr/lib/kernel/install.d/*.install</filename> and
179 <filename>/etc/kernel/install.d/*.install</filename> (i.e. the plugins) are called with the
180 following arguments:</para>
845c5324 181
fe81e346
LP
182 <programlisting>remove <replaceable>KERNEL-VERSION</replaceable> <filename>$BOOT/<replaceable>ENTRY-TOKEN</replaceable>/<replaceable>KERNEL-VERSION</replaceable>/</filename></programlisting>
183
184 <para>Afterwards, <command>kernel-install</command> removes the entry directory
185 <filename>$BOOT/<replaceable>ENTRY-TOKEN</replaceable>/<replaceable>KERNEL-VERSION</replaceable>/</filename>
186 and its contents, if it exists.</para>
4b2d80bb
LP
187
188 <para>Two default plugins execute the following operations in this case:</para>
189
190 <itemizedlist>
4454ca10
ZJS
191 <listitem><para><filename>50-depmod.install</filename> removes the files generated by
192 <command>depmod</command> for this kernel again.</para></listitem>
4b2d80bb
LP
193
194 <listitem><para><filename>90-loaderentry.install</filename> removes the file
4454ca10
ZJS
195 <filename>$BOOT/loader/entries/<replaceable>ENTRY-TOKEN</replaceable>-<replaceable>KERNEL-VERSION</replaceable>.conf</filename>.
196 </para></listitem>
0ccfd356
JB
197
198 <listitem><para><filename>90-uki-copy.install</filename> removes the file
4454ca10
ZJS
199 <filename>$BOOT/EFI/Linux/<replaceable>ENTRY-TOKEN</replaceable>-<replaceable>KERNEL-VERSION</replaceable>.efi</filename>.
200 </para></listitem>
641e2124 201 </itemizedlist>
ec07c3c8 202
aefdc112 203 <xi:include href="version-info.xml" xpointer="v198"/>
81516adc
HH
204 </listitem>
205 </varlistentry>
fe81e346 206 <varlistentry>
bdd36c00 207 <term>
758d1476 208 <command>inspect [[[<replaceable>KERNEL-VERSION</replaceable>] <replaceable>KERNEL-IMAGE</replaceable>] [<replaceable>INITRD-FILE</replaceable> ...]]</command>
bdd36c00 209 </term>
fe81e346 210 <listitem>
758d1476
LP
211 <para>Takes the same parameters as <command>add</command>.</para>
212
fe81e346 213 <para>Shows the various paths and parameters configured or auto-detected. In particular shows the
758d1476
LP
214 values of the various <varname>$KERNEL_INSTALL_*</varname> environment variables listed below, as
215 they would be passed to plugins. The <option>--json</option> option can be used to get the output
216 of this verb as a JSON object.</para>
ec07c3c8 217
aefdc112 218 <xi:include href="version-info.xml" xpointer="v251"/>
fe81e346
LP
219 </listitem>
220 </varlistentry>
658e6cc4
LP
221 <varlistentry>
222 <term><command>list</command></term>
223 <listitem>
224 <para>Shows the various installed kernels. This enumerates the subdirectories of
225 <filename>/usr/lib/modules/</filename>, and shows whether a kernel image is installed there.</para>
226
227 <xi:include href="version-info.xml" xpointer="v255"/>
228 </listitem>
229 </varlistentry>
81516adc 230 </variablelist>
694fe6da 231 </refsect1>
81516adc 232
eb25844f
ZJS
233 <refsect1>
234 <title>Compatibility with the kernel build system</title>
235
236 <cmdsynopsis>
237 <command>installkernel</command>
238 <arg choice="opt" rep="repeat">OPTIONS</arg>
239 <arg choice="plain">VERSION</arg>
240 <arg choice="plain">VMLINUZ</arg>
241 <arg choice="opt">MAP</arg>
242 <arg choice="opt">INSTALLATION-DIR</arg>
243 </cmdsynopsis>
244
245 <para>When invoked as <command>installkernel</command>, this program accepts arguments as specified by
246 the kernel build system's <command>make install</command> command. The <parameter>VERSION</parameter> and
247 <parameter>VMLINUZ</parameter> parameters specify the kernel version and the kernel binary. The other two
248 parameters (<parameter>MAP</parameter> and <parameter>INSTALLATION-DIR</parameter>) are currently
249 ignored.
250 </para>
251 </refsect1>
252
694fe6da
ZJS
253 <refsect1>
254 <title>The <varname>$BOOT</varname> partition</title>
f5f5047f 255
db811444 256 <para>The partition where the kernels and <ulink url="https://uapi-group.org/specifications/specs/boot_loader_specification">Boot
694fe6da
ZJS
257 Loader Specification</ulink> snippets are located is called <varname>$BOOT</varname>.
258 <command>kernel-install</command> determines the location of this partition by checking
fe81e346
LP
259 <filename>/efi/</filename>, <filename>/boot/</filename>, and <filename>/boot/efi/</filename> in turn. The
260 first location where <filename>$BOOT/loader/entries/</filename> or
261 <filename>$BOOT/<replaceable>ENTRY-TOKEN</replaceable>/</filename> exists is used.</para>
81516adc
HH
262 </refsect1>
263
7054308a
ZJS
264 <refsect1>
265 <title>Options</title>
266 <para>The following options are understood:</para>
267
268 <variablelist>
4cff5e92
YW
269 <xi:include href="standard-options.xml" xpointer="esp-path"/>
270 <xi:include href="standard-options.xml" xpointer="boot-path"/>
271
b79621aa
YW
272 <varlistentry>
273 <term><option>--make-entry-directory=yes|no|auto</option></term>
274 <listitem>
275 <para>Controls creation and deletion of the
276 <ulink url="https://uapi-group.org/specifications/specs/boot_loader_specification">Boot Loader Specification</ulink>
277 Type #1 entry directory on the file system containing resources such as kernel and initrd images
278 during <option>add</option> and <option>remove</option>, respectively. The directory is named after
279 the entry token, and is placed immediately below the boot root directory. When
280 <literal>auto</literal>, the directory is created or removed only when the install layout is
281 <literal>bls</literal>. Defaults to <literal>auto</literal>.</para>
ec07c3c8
AK
282
283 <xi:include href="version-info.xml" xpointer="v254"/>
b79621aa
YW
284 </listitem>
285 </varlistentry>
286
1fd90ed3
YW
287 <varlistentry>
288 <term><option>--entry-token=</option></term>
289
290 <listitem>
291 <para>Controls how to name and identify boot loader entries for this kernel installation or
292 deletion. Takes one of <literal>auto</literal>, <literal>machine-id</literal>,
293 <literal>os-id</literal>, <literal>os-image-id</literal>, or an arbitrary string prefixed by
294 <literal>literal:</literal> as argument.</para>
295
296 <para>If set to <option>machine-id</option> the entries are named after the machine ID of the
297 running system (e.g. <literal>b0e793a9baf14b5fa13ecbe84ff637ac</literal>). See
298 <citerefentry><refentrytitle>machine-id</refentrytitle><manvolnum>5</manvolnum></citerefentry> for
299 details about the machine ID concept and file.</para>
300
301 <para>If set to <option>os-id</option> the entries are named after the OS ID of the running system,
302 i.e. the <varname>ID=</varname> field of
303 <citerefentry><refentrytitle>os-release</refentrytitle><manvolnum>5</manvolnum></citerefentry>
304 (e.g. <literal>fedora</literal>). Similarly, if set to <option>os-image-id</option> the entries are
305 named after the OS image ID of the running system, i.e. the <varname>IMAGE_ID=</varname> field of
306 <filename>os-release</filename> (e.g. <literal>vendorx-cashier-system</literal>).</para>
307
308 <para>If set to <option>auto</option> (the default), the
309 <filename>/etc/kernel/entry-token</filename> (or
310 <filename>$KERNEL_INSTALL_CONF_ROOT/entry-token</filename>) file will be read if it exists, and the
311 stored value used. Otherwise if the local machine ID is initialized it is used. Otherwise
312 <varname>IMAGE_ID=</varname> from <filename>os-release</filename> will be used, if set. Otherwise,
313 <varname>ID=</varname> from <filename>os-release</filename> will be used, if set. Otherwise a
314 randomly generated machine ID is used.</para>
315
316 <para>Using the machine ID for naming the entries is generally preferable, however there are cases
317 where using the other identifiers is a good option. Specifically: if the identification data that
318 the machine ID entails shall not be stored on the (unencrypted) <varname>$BOOT_ROOT</varname>
319 partition, or if the ID shall be generated on first boot and is not known when the entries are
320 prepared. Note that using the machine ID has the benefit that multiple parallel installations of
321 the same OS can coexist on the same medium, and they can update their boot loader entries
322 independently. When using another identifier (such as the OS ID or the OS image ID), parallel
323 installations of the same OS would try to use the same entry name. To support parallel
324 installations, the installer must use a different entry token when adding a second installation.
325 </para>
ec07c3c8
AK
326
327 <xi:include href="version-info.xml" xpointer="v254"/>
1fd90ed3
YW
328 </listitem>
329 </varlistentry>
330
7054308a
ZJS
331 <varlistentry>
332 <term><option>-v</option></term>
333 <term><option>--verbose</option></term>
334 <listitem>
335 <para>Output additional information about operations being performed.</para>
ec07c3c8
AK
336
337 <xi:include href="version-info.xml" xpointer="v242"/>
7054308a
ZJS
338 </listitem>
339 </varlistentry>
340
04a8c2ce
DDM
341 <varlistentry>
342 <term><option>--root=<replaceable>root</replaceable></option></term>
343
344 <listitem><para>Takes a directory path as an argument. All paths will be prefixed with the given
345 alternate <replaceable>root</replaceable> path, including config search paths. This is useful to
346 operate on a system image mounted to the specified directory instead of the host system
347 itself.</para>
348
349 <xi:include href="version-info.xml" xpointer="v255"/></listitem>
350 </varlistentry>
351
352 <varlistentry>
353 <term><option>--image=<replaceable>image</replaceable></option></term>
354
355 <listitem><para>Takes a path to a disk image file or block device node. If specified, all operations
356 are applied to the file system in the indicated disk image. This option is similar to
357 <option>--root=</option>, but operates on file systems stored in disk images or block devices. The
358 disk image should either contain just a file system or a set of file systems within a GPT partition
359 table, following the <ulink url="https://uapi-group.org/specifications/specs/discoverable_partitions_specification">Discoverable Partitions
360 Specification</ulink>. For further information on supported disk images, see
361 <citerefentry><refentrytitle>systemd-nspawn</refentrytitle><manvolnum>1</manvolnum></citerefentry>'s
362 switch of the same name.</para>
363
364 <xi:include href="version-info.xml" xpointer="v255"/></listitem>
365 </varlistentry>
366
7054308a 367 <xi:include href="standard-options.xml" xpointer="help" />
99d8cbce 368 <xi:include href="standard-options.xml" xpointer="version" />
bdd36c00
DDM
369 <xi:include href="standard-options.xml" xpointer="no-pager"/>
370 <xi:include href="standard-options.xml" xpointer="json" />
04a8c2ce 371 <xi:include href="standard-options.xml" xpointer="image-policy-open" />
658e6cc4 372 <xi:include href="standard-options.xml" xpointer="no-legend"/>
7054308a
ZJS
373 </variablelist>
374 </refsect1>
375
376 <refsect1>
377 <title>Environment variables</title>
dcd9d196 378
f5f5047f
ZJS
379 <refsect2>
380 <title>Environment variables exported for plugins</title>
381
382 <para>If <option>--verbose</option> is used, <varname>$KERNEL_INSTALL_VERBOSE=1</varname> will be
383 exported for plugins. They may output additional logs in this case.</para>
384
cb5f21de
AAF
385 <para><varname>$KERNEL_INSTALL_IMAGE_TYPE=uki|pe|unknown</varname> is set for the plugins to specify the
386 type of the kernel image.</para>
387
388 <variablelist>
389 <varlistentry>
390 <term>uki</term>
391 <listitem>
392 <para>Unified kernel image.</para>
393
394 <xi:include href="version-info.xml" xpointer="v254"/>
395 </listitem>
396 </varlistentry>
397 <varlistentry>
398 <term>pe</term>
399 <listitem>
400 <para>PE binary.</para>
401
402 <xi:include href="version-info.xml" xpointer="v254"/>
403 </listitem>
404 </varlistentry>
405 <varlistentry>
406 <term>unknown</term>
407 <listitem>
408 <para>Unknown type.</para>
409
410 <xi:include href="version-info.xml" xpointer="v254"/>
411 </listitem>
412 </varlistentry>
413 </variablelist>
414
f5f5047f
ZJS
415 <para><varname>$KERNEL_INSTALL_MACHINE_ID</varname> is set for the plugins to the desired machine-id to
416 use. It's always a 128-bit ID. Normally it's read from <filename>/etc/machine-id</filename>, but it can
8b9f0921
ZJS
417 also be overridden via <varname>$MACHINE_ID</varname> (see below). If not specified via these methods,
418 a fallback value will generated by <command>kernel-install</command> and used only for a single
f5f5047f
ZJS
419 invocation.</para>
420
421 <para><varname>$KERNEL_INSTALL_ENTRY_TOKEN</varname> is set for the plugins to the desired entry
422 "token" to use. It's an identifier that shall be used to identify the local installation, and is often
423 the machine ID, i.e. same as <varname>$KERNEL_INSTALL_MACHINE_ID</varname>, but might also be a
424 different type of identifier, for example a fixed string or the <varname>ID=</varname>,
425 <varname>IMAGE_ID=</varname> values from <filename>/etc/os-release</filename>. The string passed here
426 will be used to name Boot Loader Specification entries, or the directories the kernel image and initial
427 RAM disk images are placed into.</para>
428
429 <para>Note that while <varname>$KERNEL_INSTALL_ENTRY_TOKEN</varname> and
430 <varname>$KERNEL_INSTALL_MACHINE_ID</varname> are often set to the same value, the latter is guaranteed
431 to be a valid 32 character ID in lowercase hexadecimals while the former can be any short string. The
432 entry token to use is read from <filename>/etc/kernel/entry-token</filename>, if it exists. Otherwise a
433 few possible candidates below <varname>$BOOT</varname> are checked for Boot Loader Specification Type 1
434 entry directories, and if found the entry token is derived from that. If that is not successful,
435 <varname>$KERNEL_INSTALL_MACHINE_ID</varname> is used as fallback.</para>
436
437 <para><varname>$KERNEL_INSTALL_BOOT_ROOT</varname> is set for the plugins to the absolute path of the
438 root directory (mount point, usually) of the hierarchy where boot loader entries, kernel images, and
439 associated resources should be placed. This usually is the path where the XBOOTLDR partition or the ESP
440 (EFI System Partition) are mounted, and also conceptually referred to as <varname>$BOOT</varname>. Can
441 be overridden by setting <varname>$BOOT_ROOT</varname> (see below).</para>
442
3d5f0bfe
GH
443 <para><varname>$KERNEL_INSTALL_LAYOUT=auto|bls|uki|other|...</varname> is set for the plugins to specify the
444 installation layout. Additional layout names may be defined by convention. If a plugin uses a special layout,
f5f5047f
ZJS
445 it's encouraged to declare its own layout name and configure <varname>layout=</varname> in
446 <filename>install.conf</filename> upon initial installation. The following values are currently
447 understood:</para>
448
449 <variablelist>
450 <varlistentry>
451 <term>bls</term>
452 <listitem>
db811444 453 <para>Standard <ulink url="https://uapi-group.org/specifications/specs/boot_loader_specification">Boot Loader
f5f5047f
ZJS
454 Specification</ulink> Type #1 layout, compatible with
455 <citerefentry><refentrytitle>systemd-boot</refentrytitle><manvolnum>7</manvolnum></citerefentry>:
456 entries in
457 <filename>$BOOT/loader/entries/<replaceable>ENTRY-TOKEN</replaceable>-<replaceable>KERNEL-VERSION</replaceable>[+<replaceable>TRIES</replaceable>].conf</filename>,
458 kernel and initrds under
459 <filename>$BOOT/<replaceable>ENTRY-TOKEN</replaceable>/<replaceable>KERNEL-VERSION</replaceable>/</filename></para>
460 <para>Implemented by <filename>90-loaderentry.install</filename>.</para>
aefdc112
AK
461
462 <xi:include href="version-info.xml" xpointer="v250"/>
f5f5047f
ZJS
463 </listitem>
464 </varlistentry>
0ccfd356
JB
465 <varlistentry>
466 <term>uki</term>
467 <listitem>
468 <para>Standard <ulink
469 url="https://uapi-group.org/specifications/specs/boot_loader_specification">Boot Loader
470 Specification</ulink> Type #2 layout, compatible with
471 <citerefentry><refentrytitle>systemd-boot</refentrytitle><manvolnum>7</manvolnum></citerefentry>:
472 unified kernel images under <filename>$BOOT/EFI/Linux</filename> as
473 <filename>$BOOT/EFI/Linux/<replaceable>ENTRY-TOKEN</replaceable>-<replaceable>KERNEL-VERSION</replaceable>[+<replaceable>TRIES</replaceable>].efi</filename>.</para>
474 <para>Implemented by <filename>90-uki-copy.install</filename>.</para>
ec07c3c8
AK
475
476 <xi:include href="version-info.xml" xpointer="v253"/>
0ccfd356
JB
477 </listitem>
478 </varlistentry>
f5f5047f
ZJS
479 <varlistentry>
480 <term>other</term>
481 <listitem>
482 <para>Some other layout not understood natively by <command>kernel-install</command>.</para>
aefdc112
AK
483
484 <xi:include href="version-info.xml" xpointer="v250"/>
f5f5047f
ZJS
485 </listitem>
486 </varlistentry>
3d5f0bfe
GH
487 <varlistentry>
488 <term>auto</term>
489 <listitem>
490 <para>Pick the layout automatically. If the kernel is a UKI set layout to
491 <option>uki</option>. If not default to <option>bls</option> if
492 <filename>$BOOT/loader/entries.srel</filename> with content <literal>type1</literal> or
493 <filename>$BOOT/<replaceable>ENTRY-TOKEN</replaceable></filename> exists, or
494 <option>other</option> otherwise.</para>
495 <para>Leaving layout blank has the same effect. This is the default.</para>
ec07c3c8
AK
496
497 <xi:include href="version-info.xml" xpointer="v254"/>
3d5f0bfe
GH
498 </listitem>
499 </varlistentry>
f5f5047f 500 </variablelist>
367165a4 501
85db5602
YW
502 <para><varname>$KERNEL_INSTALL_INITRD_GENERATOR</varname> and <varname>$KERNEL_INSTALL_UKI_GENERATOR</varname>
503 are set for plugins to select the initrd and/or UKI generator. This may be configured as
600362aa 504 <varname>initrd_generator=</varname> and <varname>uki_generator=</varname> in <filename>install.conf</filename>, see below.</para>
f5f5047f
ZJS
505
506 <para><varname>$KERNEL_INSTALL_STAGING_AREA</varname> is set for plugins to a path to a directory.
507 Plugins may drop files in that directory, and they will be installed as part of the loader entry, based
30dd8e74 508 on the file name and extension: Files named <filename>initrd*</filename> will be installed as <replaceable>INITRD-FILE</replaceable>s,
42210652 509 and files named <filename>microcode*</filename> will be prepended before <replaceable>INITRD-FILE</replaceable>s.</para>
30dd8e74 510
f5f5047f
ZJS
511 </refsect2>
512
513 <refsect2>
514 <title>Environment variables understood by <command>kernel-install</command></title>
515
91199185
ZJS
516 <para><varname>$KERNEL_INSTALL_CONF_ROOT</varname> can be set to override the location of the
517 configuration files read by <command>kernel-install</command>. When set,
db26d802
ZJS
518 <filename>install.conf</filename>, <filename>entry-token</filename>, and other files will be read from
519 this directory only. Note that this path is relative to the host, and in particular <emphasis>symlinks
520 in this directory are resolved relative to the host</emphasis>, even if
521 <option>--root=<replaceable>root</replaceable></option> is used. This means that it is generally
522 <emphasis>not</emphasis> correct to use this variable to specify a directory underneath
523 <replaceable>root</replaceable> if symlinks are used there.</para>
91199185 524
6755285c
ZJS
525 <para><varname>$KERNEL_INSTALL_PLUGINS</varname> can be set to override the list of plugins executed by
526 <command>kernel-install</command>. The argument is a whitespace-separated list of paths.
527 <literal>KERNEL_INSTALL_PLUGINS=:</literal> may be used to prevent any plugins from running.
528 </para>
529
f5f5047f
ZJS
530 <para><varname>$MACHINE_ID</varname> can be set for <command>kernel-install</command> to override
531 <varname>$KERNEL_INSTALL_MACHINE_ID</varname>, the machine ID.</para>
fe81e346 532
f5f5047f
ZJS
533 <para><varname>$BOOT_ROOT</varname> can be set for <command>kernel-install</command> to override
534 <varname>$KERNEL_INSTALL_BOOT_ROOT</varname>, the installation location for boot entries.</para>
fe81e346 535
91199185 536 <para>The last two variables may also be set in <filename>install.conf</filename>. Variables set in the
f5f5047f
ZJS
537 environment take precedence over the values specified in the config file.</para>
538 </refsect2>
7054308a
ZJS
539 </refsect1>
540
81516adc
HH
541 <refsect1>
542 <title>Exit status</title>
c4c50112 543 <para>If every executable returns 0 or 77, 0 is returned, and a non-zero failure code otherwise.</para>
81516adc
HH
544 </refsect1>
545
546 <refsect1>
547 <title>Files</title>
548 <variablelist>
549 <varlistentry>
7a9d86bc
ZJS
550 <term><filename>/etc/kernel/install.d/*.install</filename></term>
551 <term><filename>/usr/lib/kernel/install.d/*.install</filename></term>
552 <listitem>
553 <para>Drop-in files which are executed by <command>kernel-install</command>.</para>
ec07c3c8
AK
554
555 <xi:include href="version-info.xml" xpointer="v198"/>
7a9d86bc 556 </listitem>
81516adc 557 </varlistentry>
7a9d86bc 558
2d0614d3 559 <varlistentry>
7a9d86bc
ZJS
560 <term><filename>/etc/kernel/cmdline</filename></term>
561 <term><filename>/usr/lib/kernel/cmdline</filename></term>
562 <term><filename>/proc/cmdline</filename></term>
563 <listitem>
564 <para>Specifies the kernel command line to use. The first of the files that is found will be used.
565 <varname>$KERNEL_INSTALL_CONF_ROOT</varname> may be used to override the search path; see below for
566 details.</para>
ec07c3c8 567
aefdc112 568 <xi:include href="version-info.xml" xpointer="v198"/>
7a9d86bc
ZJS
569 </listitem>
570 </varlistentry>
571
572 <varlistentry>
573 <term><filename>/etc/kernel/devicetree</filename></term>
574 <term><filename>/usr/lib/kernel/devicetree</filename></term>
575 <listitem>
576 <para>Specifies the partial path to the file containing the device tree blob to install with the
577 kernel and use at boot. The first of the files that is found will be used.
578 <varname>$KERNEL_INSTALL_CONF_ROOT</varname> may be used to override the search path; see below for
579 details.</para>
580
581 <para>The <filename>devicetree</filename> file contains a path, and this path specifies a location
582 relative to the kernel install tree. A set of locations is checked, including in particular
583 <filename>/usr/lib/modules/<replaceable>KERNEL_VERSION</replaceable>/dtb/</filename>, which is the
584 recommended location to place the dtb files under. For example, with
585 <literal>broadcom/bcm2711-rpi-4-b.dtb</literal> in the <filename>devicetree</filename> file, the
586 device tree blob for the Raspberry Pi 4 Model B would be installed, and the actual file would be
587 <filename index='false'>/usr/lib/modules/<replaceable>KERNEL_VERSION</replaceable>/dtb/broadcom/bcm2711-rpi-4-b.dtb</filename>.
588 </para>
589
590 <xi:include href="version-info.xml" xpointer="v255"/>
591 </listitem>
4b2d80bb 592 </varlistentry>
7a9d86bc 593
4b2d80bb 594 <varlistentry>
7a9d86bc
ZJS
595 <term><filename>/etc/kernel/tries</filename></term>
596 <listitem>
597 <para>Read by <filename>90-loaderentry.install</filename> and
598 <filename>90-uki-copy.install</filename>. If this file exists, a numeric value is read from it and
599 the naming of the generated entry file or UKI is altered to include it as
600 <filename>$BOOT/loader/entries/<replaceable>ENTRY-TOKEN</replaceable>-<replaceable>KERNEL-VERSION</replaceable>+<replaceable>TRIES</replaceable>.conf</filename>
601 or
602 <filename>$BOOT/EFI/Linux/<replaceable>ENTRY-TOKEN</replaceable>-<replaceable>KERNEL-VERSION</replaceable>+<replaceable>TRIES</replaceable>.efi</filename>,
603 respectively. This is useful for boot loaders such as
604 <citerefentry><refentrytitle>systemd-boot</refentrytitle><manvolnum>7</manvolnum></citerefentry>
605 which implement boot attempt counting with a counter embedded in the entry file name.
606 <varname>$KERNEL_INSTALL_CONF_ROOT</varname> may be used to override the search path; see below for
607 details.</para>
ec07c3c8
AK
608
609 <xi:include href="version-info.xml" xpointer="v240"/>
7a9d86bc 610 </listitem>
2d0614d3 611 </varlistentry>
7a9d86bc 612
2d0614d3 613 <varlistentry>
7a9d86bc
ZJS
614 <term><filename>/etc/kernel/entry-token</filename></term>
615 <listitem>
616 <para>If this file exists it is read and used as "entry token" for this system, i.e. is used for
617 naming Boot Loader Specification entries. See <varname>$KERNEL_INSTALL_ENTRY_TOKEN</varname> above
618 for details. <varname>$KERNEL_INSTALL_CONF_ROOT</varname> may be used to override the search path; see
619 below for details.</para>
ec07c3c8 620
7a9d86bc
ZJS
621 <xi:include href="version-info.xml" xpointer="v251"/>
622 </listitem>
2d0614d3 623 </varlistentry>
7a9d86bc 624
357376d0
DDM
625 <varlistentry>
626 <term>
fe81e346 627 <filename>/etc/machine-id</filename>
357376d0
DDM
628 </term>
629 <listitem>
fe81e346
LP
630 <para>The content of this file specifies the machine identification
631 <replaceable>MACHINE-ID</replaceable>.</para>
ec07c3c8
AK
632
633 <xi:include href="version-info.xml" xpointer="v198"/>
357376d0
DDM
634 </listitem>
635 </varlistentry>
7a9d86bc 636
2d0614d3 637 <varlistentry>
7a9d86bc
ZJS
638 <term><filename>/etc/os-release</filename></term>
639 <term><filename>/usr/lib/os-release</filename></term>
fe81e346 640 <listitem>
7a9d86bc
ZJS
641 <para>Read by <filename>90-loaderentry.install</filename>. If available,
642 <varname>PRETTY_NAME=</varname> is read from these files and used as the title of the boot menu
643 entry. Otherwise, <literal>Linux <replaceable>KERNEL-VERSION</replaceable></literal> will be
644 used.</para>
ec07c3c8 645
7a9d86bc 646 <xi:include href="version-info.xml" xpointer="v198"/>
2d0614d3
HH
647 </listitem>
648 </varlistentry>
641e2124 649 <varlistentry>
7a9d86bc 650 <term><filename>/etc/kernel/install.conf</filename></term>
db26d802
ZJS
651 <term><filename>/run/kernel/install.conf</filename></term>
652 <term><filename>/usr/local/lib/kernel/install.conf</filename></term>
7a9d86bc 653 <term><filename>/usr/lib/kernel/install.conf</filename></term>
db26d802
ZJS
654 <term><filename>/etc/kernel/install.conf.d/*.conf</filename></term>
655 <term><filename>/run/kernel/install.conf.d/*.conf</filename></term>
656 <term><filename>/usr/local/lib/kernel/install.conf.d/*.conf</filename></term>
657 <term><filename>/usr/lib/kernel/install.conf.d/*.conf</filename></term>
7a9d86bc
ZJS
658 <listitem>
659 <para>Configuration file with options for <command>kernel-install</command>, as a series of
660 <varname>KEY=</varname><replaceable>VALUE</replaceable> assignments, compatible with shell syntax,
661 following the same rules as described in
662 <citerefentry><refentrytitle>os-release</refentrytitle><manvolnum>5</manvolnum></citerefentry>. The
663 first of the files that is found will be used. <varname>$KERNEL_INSTALL_CONF_ROOT</varname> may be
db26d802
ZJS
664 used to override the search path; see below for details. Drop-in files may also be used
665 to extend the configuration with overrides, see
666 <citerefentry><refentrytitle>systemd.unit</refentrytitle><manvolnum>5</manvolnum></citerefentry>.
667 </para>
7a9d86bc
ZJS
668
669 <para>Currently, the following keys are supported:
670 <varname>MACHINE_ID=</varname>,
671 <varname>BOOT_ROOT=</varname>,
672 <varname>layout=</varname>,
673 <varname>initrd_generator=</varname>,
674 <varname>uki_generator=</varname>.
675 See the Environment variables section above for details.</para>
ec07c3c8 676
7a9d86bc
ZJS
677 <xi:include href="version-info.xml" xpointer="v250"/>
678 </listitem>
641e2124 679 </varlistentry>
f5263dd0 680 <varlistentry>
7a9d86bc
ZJS
681 <term><filename>/etc/kernel/uki.conf</filename></term>
682 <listitem>
683 <para>Ini-style configuration file for
684 <citerefentry><refentrytitle>ukify</refentrytitle><manvolnum>1</manvolnum></citerefentry> which is
685 only effective when <varname>$KERNEL_INSTALL_LAYOUT</varname> or <varname>layout=</varname> in
686 <filename>install.conf</filename> is set to <option>uki</option> and
687 <varname>$KERNEL_INSTALL_UKI_GENERATOR</varname> or <varname>uki_generator=</varname> in
f712b11d 688 <filename>install.conf</filename> is set to <option>ukify</option>, or is unset.
7a9d86bc
ZJS
689 <varname>$KERNEL_INSTALL_CONF_ROOT</varname> may be used to override the search path; see below for
690 details.</para>
691
692 <xi:include href="version-info.xml" xpointer="v255"/>
693 </listitem>
f5263dd0 694 </varlistentry>
35f58f8c
LP
695
696 <varlistentry>
697 <term><filename>/usr/lib/modules/<replaceable>KERNEL-VERSION/</replaceable></filename></term>
698
699 <listitem>
700 <para>Location for installed kernel modules and other kernel related resources. For each locally
701 installed kernel a directory named after the kernel version (<command>uname -r</command>) is
702 kept.</para>
703
704 <xi:include href="version-info.xml" xpointer="v255"/>
705 </listitem>
706 </varlistentry>
707
708 <varlistentry>
709 <term><filename>/usr/lib/modules/<replaceable>KERNEL-VERSION/vmlinuz</replaceable></filename></term>
710
711 <listitem>
712 <para>Location for installed kernel images. This is the recommended location for OS package
713 managers to install kernel images into (as applicable), from which <command>kernel-install
714 add</command> then copies it into the final boot partition.</para>
715
716 <xi:include href="version-info.xml" xpointer="v255"/>
717 </listitem>
718 </varlistentry>
719
81516adc 720 </variablelist>
7a9d86bc
ZJS
721
722 <para>For various cases listed above, if the <varname>$KERNEL_INSTALL_CONF_ROOT</varname> environment
723 variable is set, it will override the search path. The files will be loaded <emphasis>only</emphasis>
724 from the directory specified by the environment variable. When the variable is not set, the listed paths
725 are tried in turn, and the first file that exists is used.</para>
81516adc
HH
726 </refsect1>
727
728 <refsect1>
729 <title>See Also</title>
13a69c12
DT
730 <para><simplelist type="inline">
731 <member><citerefentry><refentrytitle>machine-id</refentrytitle><manvolnum>5</manvolnum></citerefentry></member>
732 <member><citerefentry><refentrytitle>os-release</refentrytitle><manvolnum>5</manvolnum></citerefentry></member>
733 <member><citerefentry project='man-pages'><refentrytitle>depmod</refentrytitle><manvolnum>8</manvolnum></citerefentry></member>
734 <member><citerefentry><refentrytitle>systemd-boot</refentrytitle><manvolnum>7</manvolnum></citerefentry></member>
735 <member><citerefentry><refentrytitle>ukify</refentrytitle><manvolnum>1</manvolnum></citerefentry></member>
736 <member><ulink url="https://uapi-group.org/specifications/specs/boot_loader_specification">Boot Loader Specification</ulink></member>
737 </simplelist></para>
81516adc
HH
738 </refsect1>
739
740</refentry>