Debian Codegraph @

man/kernel-install.xml

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