Debian Codegraph @

man/loader.conf.xml

raw
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.5/docbookx.dtd">
4 <!-- SPDX-License-Identifier: LGPL-2.1-or-later -->
5
6 <refentry id="loader.conf" conditional='ENABLE_BOOTLOADER'
7 xmlns:xi="http://www.w3.org/2001/XInclude">
8 <refentryinfo>
9 <title>loader.conf</title>
10 <productname>systemd</productname>
11 </refentryinfo>
12
13 <refmeta>
14 <refentrytitle>loader.conf</refentrytitle>
15 <manvolnum>5</manvolnum>
16 </refmeta>
17
18 <refnamediv>
19 <refname>loader.conf</refname>
20 <refpurpose>Configuration file for systemd-boot</refpurpose>
21 </refnamediv>
22
23 <refsynopsisdiv>
24 <para><filename><replaceable>ESP</replaceable>/loader/loader.conf</filename></para>
25 </refsynopsisdiv>
26
27 <refsect1>
28 <title>Description</title>
29
30 <para>
31 <citerefentry><refentrytitle>systemd-boot</refentrytitle><manvolnum>7</manvolnum></citerefentry> reads
32 <filename><replaceable>ESP</replaceable>/loader/loader.conf</filename>. This file configures whether the
33 menu is shown and for how long, the font, audible beep, types of menu entries to show, the default
34 choice, and some aspects of Secure Boot enrollment and firmware handling. See the list of available
35 options below.</para>
36
37 <para>The file uses UTF-8 encoding and consists of series of lines separated by "line feed" (i.e. ASCII
38 code 10). Lines that are empty or start with the comment sign (<literal>#</literal>) are ignored. Other
39 lines consist of an option name, followed by whitespace, and the option value.
40 </para>
41
42 <para>Boolean arguments may be written as
43 <literal>yes</literal>/<literal>y</literal>/<literal>true</literal>/<literal>t</literal>/<literal>on</literal>/<literal>1</literal>
44 or
45 <literal>no</literal>/<literal>n</literal>/<literal>false</literal>/<literal>f</literal>/<literal>off</literal>/<literal>0</literal>.
46 </para>
47
48 <para>Note: <command>systemd-boot</command> will also read boot loader entry files,
49 type #1 (<filename><replaceable>ESP</replaceable>/loader/entries/*.conf</filename> and
50 <filename><replaceable>XBOOTLDR</replaceable>/loader/entries/*.conf</filename>)
51 and type #2 (<filename><replaceable>ESP</replaceable>/EFI/Linux/*.uki</filename>
52 and <filename><replaceable>XBOOTLDR</replaceable>/EFI/Linux/*.uki</filename>).
53 Those files are described by the
54 <ulink url="https://uapi-group.org/specifications/specs/boot_loader_specification">UAPI.1 Boot Loader
55 Specification</ulink>.</para>
56
57 <para>Note: the behaviour of <command>systemd-boot</command> is also influenced by EFI variables. Some of
58 the settings specified in this file can be overridden by those, for example the default boot menu entry
59 or the menu timeouts. See
60 <citerefentry><refentrytitle>systemd-boot</refentrytitle><manvolnum>7</manvolnum></citerefentry> for
61 details.</para>
62 </refsect1>
63
64 <refsect1>
65 <title>Options</title>
66
67 <para>The following configuration are supported in <filename>loader.conf</filename>:</para>
68
69 <variablelist>
70 <varlistentry>
71 <term>default</term>
72
73 <listitem><para>A glob pattern to select the default entry by id, which is the
74 file name including literal suffix <literal>.conf</literal>. The default entry
75 may be changed in the boot menu itself, in which case the name of the
76 selected entry will be stored as an EFI variable, overriding this option.
77 </para>
78
79 <para>If set to <literal>@saved</literal> the chosen entry will be saved as an EFI variable
80 on every boot and automatically selected the next time the boot loader starts.</para>
81
82 <table>
83 <title>Automatically detected entries will use the following names:</title>
84
85 <tgroup cols='2'>
86 <colspec colname='name' />
87 <colspec colname='expl' />
88 <thead>
89 <row>
90 <entry>Name</entry>
91 <entry>Description</entry>
92 </row>
93 </thead>
94 <tbody>
95 <row>
96 <entry>auto-efi-default</entry>
97 <entry>EFI Default Loader</entry>
98 </row>
99 <row>
100 <entry>auto-efi-shell</entry>
101 <entry>EFI Shell</entry>
102 </row>
103 <row>
104 <entry>auto-osx</entry>
105 <entry>macOS</entry>
106 </row>
107 <row>
108 <entry>auto-poweroff</entry>
109 <entry>Power Off The System</entry>
110 </row>
111 <row>
112 <entry>auto-reboot</entry>
113 <entry>Reboot The System</entry>
114 </row>
115 <row>
116 <entry>auto-reboot-to-firmware-setup</entry>
117 <entry>Reboot Into Firmware Interface</entry>
118 </row>
119 <row>
120 <entry>auto-windows</entry>
121 <entry>Windows Boot Manager</entry>
122 </row>
123 </tbody>
124 </tgroup>
125 </table>
126
127 <para>Supported glob wildcard patterns are <literal>?</literal>, <literal>*</literal>, and
128 <literal>[…]</literal> (including ranges). Note that these patterns use the same syntax as
129 <citerefentry project='man-pages'><refentrytitle>glob</refentrytitle><manvolnum>7</manvolnum></citerefentry>,
130 but do not support all features. In particular, set negation and named character classes are not
131 supported. The matching is done case-insensitively on the entry ID (as shown by <command>bootctl
132 list</command>).</para>
133
134 <xi:include href="version-info.xml" xpointer="v239"/></listitem>
135 </varlistentry>
136
137 <varlistentry>
138 <term>timeout</term>
139
140 <listitem><para>How long the boot menu should be shown before the default
141 entry is booted, in seconds. This may be changed in the boot menu itself and
142 will be stored as an EFI variable in that case, overriding this option.
143 </para>
144
145 <para>If set to <literal>menu-disabled</literal> or <literal>menu-hidden</literal> or <literal>0</literal>
146 (the default), no menu is shown and the default entry will be booted immediately. Unless
147 <literal>menu-disabled</literal> is used, the menu can be shown
148 by pressing and holding a key before systemd-boot is launched. Setting this to
149 <literal>menu-force</literal> disables the timeout while always showing the menu.</para>
150
151 <xi:include href="version-info.xml" xpointer="v239"/>
152 </listitem>
153 </varlistentry>
154
155 <varlistentry>
156 <term>console-mode</term>
157
158 <listitem><para>This option configures the resolution of the console. This may be changed in
159 the boot menu itself and will be stored as an EFI variable in that case, overriding this
160 option.</para>
161
162 <para>Takes a number or one of the special values listed below. The following
163 values may be used:</para>
164
165 <variablelist>
166 <varlistentry>
167 <term>0</term>
168 <listitem>
169 <para>Standard UEFI 80x25 mode</para>
170
171 <xi:include href="version-info.xml" xpointer="v239"/>
172 </listitem>
173 </varlistentry>
174
175 <varlistentry>
176 <term>1</term>
177 <listitem>
178 <para>80x50 mode, not supported by all devices</para>
179
180 <xi:include href="version-info.xml" xpointer="v239"/>
181 </listitem>
182 </varlistentry>
183
184 <varlistentry>
185 <term>2</term>
186 <listitem>
187 <para>the first non-standard mode provided by the device
188 firmware, if any</para>
189
190 <xi:include href="version-info.xml" xpointer="v239"/>
191 </listitem>
192 </varlistentry>
193
194 <varlistentry>
195 <term>auto</term>
196 <listitem>
197 <para>Pick a suitable mode automatically using heuristics</para>
198
199 <xi:include href="version-info.xml" xpointer="v239"/>
200 </listitem>
201 </varlistentry>
202
203 <varlistentry>
204 <term>max</term>
205 <listitem>
206 <para>Pick the highest-numbered available mode</para>
207
208 <xi:include href="version-info.xml" xpointer="v239"/>
209 </listitem>
210 </varlistentry>
211
212 <varlistentry>
213 <term>keep</term>
214 <listitem>
215 <para>Keep the mode selected by firmware (the default)</para>
216
217 <xi:include href="version-info.xml" xpointer="v239"/>
218 </listitem>
219 </varlistentry>
220 </variablelist>
221
222 <xi:include href="version-info.xml" xpointer="v239"/>
223
224 </listitem>
225 </varlistentry>
226
227 <varlistentry>
228 <term>editor</term>
229
230 <listitem><para>Takes a boolean argument. Enable (the default) or disable the
231 editor. The editor should be disabled if the machine can be accessed by
232 unauthorized persons.</para>
233
234 <xi:include href="version-info.xml" xpointer="v239"/></listitem>
235 </varlistentry>
236
237 <varlistentry>
238 <term>auto-entries</term>
239
240 <listitem><para>Takes a boolean argument. Enable (the default) or disable
241 entries for other boot entries found on the boot partition. In particular,
242 this may be useful when loader entries are created to show replacement
243 descriptions for those entries.</para>
244
245 <xi:include href="version-info.xml" xpointer="v239"/></listitem>
246 </varlistentry>
247
248 <varlistentry>
249 <term>auto-firmware</term>
250
251 <listitem><para>A boolean controlling the presence of the <literal>Reboot Into Firmware
252 Interface</literal> entry (enabled by default). If this is disabled, the firmware interface may still
253 be reached by using the <keycap>f</keycap> key.</para>
254
255 <xi:include href="version-info.xml" xpointer="v239"/></listitem>
256 </varlistentry>
257
258 <varlistentry>
259 <term>auto-reboot</term>
260
261 <listitem><para>A boolean controlling the presence of the <literal>Reboot The System</literal>
262 entry (disabled by default). Even if this is disabled, the system may still be rebooted by pressing
263 <keycombo><keycap>Shift</keycap><keycap>b</keycap></keycombo>.</para>
264
265 <xi:include href="version-info.xml" xpointer="v255"/></listitem>
266 </varlistentry>
267
268 <varlistentry>
269 <term>auto-poweroff</term>
270
271 <listitem><para>A boolean controlling the presence of the <literal>Power Off The System</literal>
272 entry (disabled by default). Even if this is disabled, the system may still be powered off by
273 pressing <keycombo><keycap>Shift</keycap><keycap>o</keycap></keycombo>.</para>
274
275 <xi:include href="version-info.xml" xpointer="v255"/></listitem>
276 </varlistentry>
277
278 <varlistentry>
279 <term>beep</term>
280
281 <listitem><para>Takes a boolean argument. If timeout enabled beep every second, otherwise beep n
282 times when n-th entry in boot menu is selected (default disabled). Currently, only x86 is supported,
283 where it uses the PC speaker.</para>
284
285 <xi:include href="version-info.xml" xpointer="v251"/></listitem>
286 </varlistentry>
287
288 <varlistentry>
289 <term>secure-boot-enroll</term>
290
291 <listitem><para>Danger: this feature might soft-brick your device if used improperly.</para>
292
293 <para>Controls enrollment of secure boot keys found on the ESP if the system is in setup mode:
294 <variablelist>
295 <varlistentry>
296 <term><option>if-safe</option></term>
297 <listitem><para>This is the default. Same behavior as <option>manual</option>, but will try to automatically
298 enroll the key named <literal>auto</literal> if it is considered to be safe. Currently, this is only
299 the case if the system is running inside a virtual machine.</para>
300
301 <xi:include href="version-info.xml" xpointer="v253"/></listitem>
302 </varlistentry>
303
304 <varlistentry>
305 <term><option>manual</option></term>
306 <listitem><para>Boot entries for found secure boot keys are created that allow manual
307 enrollment.</para>
308
309 <xi:include href="version-info.xml" xpointer="v253"/></listitem>
310 </varlistentry>
311
312 <varlistentry>
313 <term><option>off</option></term>
314 <listitem><para>No action is taken.</para>
315
316 <xi:include href="version-info.xml" xpointer="v253"/></listitem>
317 </varlistentry>
318
319 <varlistentry>
320 <term><option>force</option></term>
321 <listitem><para>Always enroll the <literal>auto</literal> key if found. Note that a warning
322 message with a timeout will still be shown if this operation is unknown to be safe.</para>
323
324 <xi:include href="version-info.xml" xpointer="v253"/></listitem>
325 </varlistentry>
326 </variablelist>
327 </para>
328
329 <para>The different sets of variables can be set up under
330 <filename>/loader/keys/<replaceable>NAME</replaceable></filename> where
331 <replaceable>NAME</replaceable> is the name that is going to be used as the name of the entry. This
332 allows one to ship multiple sets of Secure Boot variables and choose which one to enroll at runtime.
333 </para>
334
335 <para>Supported Secure Boot variables are one database for authorized images, one for the key
336 exchange key (KEK) and one for the platform key (PK). For more information, refer to the
337 <ulink url="https://uefi.org/specifications">UEFI specification</ulink>, under Secure Boot and Driver
338 Signing. Another resource that describe the interplay of the different variables is the
339 <ulink url="https://edk2-docs.gitbook.io/understanding-the-uefi-secure-boot-chain/secure_boot_chain_in_uefi/uefi_secure_boot">
340 EDK2 documentation</ulink>.</para>
341
342 <para>A complete set of UEFI variable includes <filename>db.auth</filename>, <filename>KEK.auth</filename>
343 and <filename>PK.auth</filename>. Note that these files need to be authenticated UEFI variables. See
344 below for an example of how to generate them from regular X.509 keys.</para>
345
346 <programlisting>uuid=$(systemd-id128 new --uuid)
347 for key in PK KEK db; do
348 openssl req -new -x509 -subj "/CN=${key}/" -keyout "${key}.key" -out "${key}.pem"
349 openssl x509 -outform DER -in "${key}.pem" -out "${key}.der"
350 sbsiglist --owner "${uuid}" --type x509 --output "${key}.esl" "${key}.der"
351 done
352
353 # See also: <ulink url="https://learn.microsoft.com/en-us/windows-hardware/manufacture/desktop/windows-secure-boot-key-creation-and-management-guidance">Windows Secure Boot Key Creation and Management Guidance</ulink>
354 curl --location \
355 "https://go.microsoft.com/fwlink/p/?linkid=321192" -o ms-db-2011.der \
356 "https://go.microsoft.com/fwlink/p/?linkid=321185" -o ms-kek-2011.der \
357 "https://go.microsoft.com/fwlink/p/?linkid=321194" -o ms-uefi-db-2011.der \
358 "https://go.microsoft.com/fwlink/p/?linkid=2239776" -o ms-db-2023.der \
359 "https://go.microsoft.com/fwlink/p/?linkid=2239775" -o ms-kek-2023.der \
360 "https://go.microsoft.com/fwlink/p/?linkid=2239872" -o ms-uefi-db-2023.der
361 sha1sum -c &lt;&lt;END
362 580a6f4cc4e4b669b9ebdc1b2b3e087b80d0678d ms-db-2011.der
363 31590bfd89c9d74ed087dfac66334b3931254b30 ms-kek-2011.der
364 46def63b5ce61cf8ba0de2e6639c1019d0ed14f3 ms-uefi-db-2011.der
365 45a0fa32604773c82433c3b7d59e7466b3ac0c67 ms-db-2023.der
366 459ab6fb5e284d272d5e3e6abc8ed663829d632b ms-kek-2023.der
367 b5eeb4a6706048073f0ed296e7f580a790b59eaa ms-uefi-db-2023.der
368 END
369 for key in ms-*.der; do
370 sbsiglist --owner 77fa9abd-0359-4d32-bd60-28f4e78f784b --type x509 --output "${key%der}esl" "${key}"
371 done
372
373 # Optionally add Microsoft Windows certificates (needed to boot into Windows).
374 cat ms-db-*.esl >>db.esl
375
376 # Optionally add Microsoft UEFI certificates for firmware drivers / option ROMs and third-party
377 # boot loaders (including shim). This is highly recommended on real hardware as not including this
378 # may soft-brick your device (see next paragraph).
379 cat ms-uefi-*.esl >>db.esl
380
381 # Optionally add Microsoft KEK certificates. Recommended if either of the Microsoft keys is used as
382 # the official UEFI revocation database is signed with this key. The revocation database can be
383 # updated with <citerefentry project='man-pages'><refentrytitle>fwupdmgr</refentrytitle><manvolnum>1</manvolnum></citerefentry>.
384 cat ms-kek-*.esl >>KEK.esl
385
386 attr=NON_VOLATILE,RUNTIME_ACCESS,BOOTSERVICE_ACCESS,TIME_BASED_AUTHENTICATED_WRITE_ACCESS
387 sbvarsign --attr "${attr}" --key PK.key --cert PK.pem --output PK.auth PK PK.esl
388 sbvarsign --attr "${attr}" --key PK.key --cert PK.pem --output KEK.auth KEK KEK.esl
389 sbvarsign --attr "${attr}" --key KEK.key --cert KEK.pem --output db.auth db db.esl
390 </programlisting>
391
392 <para>This feature is considered dangerous because even if all the required files are signed with the
393 keys being loaded, some files necessary for the system to function properly still won't be. This
394 is especially the case with Option ROMs (e.g. for storage controllers or graphics cards). See
395 <ulink url="https://github.com/Foxboron/sbctl/wiki/FAQ#option-rom">Secure Boot and Option ROMs</ulink>
396 for more details.</para>
397
398 <xi:include href="version-info.xml" xpointer="v252"/></listitem>
399 </varlistentry>
400
401 <varlistentry>
402 <term>secure-boot-enroll-action</term>
403 <listitem>
404 <para>Specifies the action to take after the automatic enrollment of secure boot keys is completed.</para>
405 <variablelist>
406 <varlistentry>
407 <term>reboot</term>
408 <listitem>
409 <para>Reboot the system after enrollment. This is the default.</para>
410 </listitem>
411 </varlistentry>
412 <varlistentry>
413 <term>shutdown</term>
414 <listitem>
415 <para>Shut down the system after enrollment.</para>
416 </listitem>
417 </varlistentry>
418 </variablelist>
419 <para>This option is only relevant if <literal>secure-boot-enroll</literal> is enabled.</para>
420 <xi:include href="version-info.xml" xpointer="v258"/>
421 </listitem>
422 </varlistentry>
423
424 <varlistentry>
425 <term>secure-boot-enroll-timeout-sec</term>
426 <listitem>
427 <para>How long the warning should be shown in seconds before the key enrollment process starts.</para>
428 <para>If set to <literal>hidden</literal> or <literal>0</literal>, no warning is shown and the keys
429 will be enrolled immediately. The default timeout (if not set explicitly) is 15 seconds.</para>
430 <para>This option is only relevant if <literal>secure-boot-enroll</literal> is enabled.</para>
431 <xi:include href="version-info.xml" xpointer="v259"/>
432 </listitem>
433 </varlistentry>
434
435 <varlistentry>
436 <term>reboot-for-bitlocker</term>
437
438 <listitem><para>Caveat: This feature is experimental, and is likely to be changed (or removed in its
439 current form) in a future version of systemd.</para>
440
441 <para>Work around BitLocker requiring a recovery key when the boot loader was updated (disabled by
442 default).</para>
443
444 <para>Try to detect BitLocker encrypted drives along with an active TPM. If both are found and
445 Windows Boot Manager is selected in the boot menu, set the <literal>BootNext</literal> EFI variable
446 and restart the system. The firmware will then start Windows Boot Manager directly, leaving the TPM
447 PCRs in expected states so that Windows can unseal the encryption key. This allows
448 <citerefentry><refentrytitle>systemd-boot</refentrytitle><manvolnum>7</manvolnum></citerefentry> to
449 be updated without having to provide the recovery key for BitLocker drive unlocking.</para>
450
451 <para>Note that the PCRs that Windows uses can be configured with the
452 <literal>Configure TPM platform validation profile for native UEFI firmware configurations</literal>
453 group policy under <literal>Computer Configuration\Administrative Templates\Windows Components\BitLocker Drive Encryption</literal>.
454 When Secure Boot is enabled, changing this to PCRs <literal>0,2,7,11</literal> should be safe.
455 The TPM key protector needs to be removed and then added back for the PCRs on an already
456 encrypted drive to change. If PCR 4 is not measured, this setting can be disabled to speed
457 up booting into Windows.</para>
458
459 <xi:include href="version-info.xml" xpointer="v251"/></listitem>
460 </varlistentry>
461
462 <varlistentry>
463 <term>reboot-on-error</term>
464
465 <listitem><para>Controls auto reboot in case the selected entry fails to start.
466
467 <variablelist>
468 <varlistentry>
469 <term><option>yes</option></term>
470 <listitem><para>Reboot the system if the selected boot entry failed to start.</para></listitem>
471 </varlistentry>
472
473 <varlistentry>
474 <term><option>no</option></term>
475 <listitem><para>Don't reboot - pass control back to EFI firmware.</para></listitem>
476 </varlistentry>
477
478 <varlistentry>
479 <term><option>auto</option></term>
480 <listitem>
481 <para>Perform the reboot if and only if boot counting is enabled for this entry and the tries
482 left counter wasn't already at 0.</para>
483
484 <para>This is the default, as it is typically a safe option, that ensures a clean measurement log
485 on each boot attempt, but also does not risk an unbounded reboot loop.</para>
486 </listitem>
487 </varlistentry>
488
489 </variablelist>
490 </para>
491
492 <xi:include href="version-info.xml" xpointer="v258"/></listitem>
493 </varlistentry>
494
495 <varlistentry>
496 <term>log-level</term>
497
498 <listitem><para>Controls the log level used by
499 <citerefentry><refentrytitle>systemd-boot</refentrytitle><manvolnum>7</manvolnum></citerefentry>.
500 </para>
501
502 <para>Valid values are <literal>emerg</literal>, <literal>alert</literal>, <literal>crit</literal>,
503 <literal>err</literal>, <literal>warning</literal>, <literal>notice</literal>,
504 <literal>info</literal>, and <literal>debug</literal>.</para>
505
506 <para>If unspecified, <literal>info</literal> will be used, unless one has already been configured
507 via an SMBIOS Type 11 string, see
508 <citerefentry><refentrytitle>smbios-type-11</refentrytitle><manvolnum>7</manvolnum></citerefentry>.
509 </para>
510
511 <para>Note that the configured level will only be used after <filename>loader.conf</filename> has
512 been parsed, so log messages generated before that point may be unaffected by this setting.</para>
513
514 <xi:include href="version-info.xml" xpointer="v259"/></listitem>
515 </varlistentry>
516 </variablelist>
517 </refsect1>
518
519 <refsect1>
520 <title>Example</title>
521
522 <programlisting># /boot/efi/loader/loader.conf
523 timeout 0
524 default 01234567890abcdef1234567890abdf0-*
525 editor no
526 </programlisting>
527
528 <para>The menu will not be shown by default (the menu can still be shown by
529 pressing and holding a key during boot). One of the entries with files with a
530 name starting with <literal>01234567890abcdef1234567890abdf0-</literal> will be
531 selected by default. If more than one entry matches, the one with the highest
532 priority will be selected (generally the one with the highest version number).
533 The editor will be disabled, so it is not possible to alter the kernel command
534 line.</para>
535 </refsect1>
536
537 <refsect1>
538 <title>See Also</title>
539 <para><simplelist type="inline">
540 <member><citerefentry><refentrytitle>systemd-boot</refentrytitle><manvolnum>7</manvolnum></citerefentry></member>
541 <member><citerefentry><refentrytitle>bootctl</refentrytitle><manvolnum>1</manvolnum></citerefentry></member>
542 </simplelist></para>
543 </refsect1>
544 </refentry>