]>
Commit | Line | Data |
---|---|---|
f37d3835 | 1 | <?xml version='1.0'?> <!--*-nxml-*--> |
3a54a157 | 2 | <!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" |
f37d3835 | 3 | "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd"> |
f37d3835 ZJS |
4 | <!-- SPDX-License-Identifier: LGPL-2.1+ --> |
5 | ||
70c8db75 | 6 | <refentry id="systemd-boot" conditional='ENABLE_EFI' |
f37d3835 ZJS |
7 | xmlns:xi="http://www.w3.org/2001/XInclude"> |
8 | <refentryinfo> | |
70c8db75 | 9 | <title>systemd-boot</title> |
f37d3835 | 10 | <productname>systemd</productname> |
f37d3835 ZJS |
11 | </refentryinfo> |
12 | ||
13 | <refmeta> | |
70c8db75 | 14 | <refentrytitle>systemd-boot</refentrytitle> |
f37d3835 ZJS |
15 | <manvolnum>7</manvolnum> |
16 | </refmeta> | |
17 | ||
18 | <refnamediv> | |
70c8db75 | 19 | <refname>systemd-boot</refname> |
f37d3835 ZJS |
20 | <refname>sd-boot</refname> |
21 | <refpurpose>A simple UEFI boot manager</refpurpose> | |
22 | </refnamediv> | |
23 | ||
24 | <refsect1> | |
25 | <title>Description</title> | |
26 | ||
c5fcaed8 LP |
27 | <para><command>systemd-boot</command> (short: <command>sd-boot</command>) is a simple UEFI boot |
28 | manager. It provides a graphical menu to select the entry to boot and an editor for the kernel command | |
29 | line. <command>systemd-boot</command> supports systems with UEFI firmware only.</para> | |
53ddb667 | 30 | |
39867bb9 LP |
31 | <para><command>systemd-boot</command> loads boot entry information from the EFI system partition (ESP), |
32 | usually mounted at <filename>/efi/</filename>, <filename>/boot/</filename>, or | |
33 | <filename>/boot/efi/</filename> during OS runtime, as well as from the Extended Boot Loader partition if | |
34 | it exists (usually mounted to <filename>/boot/</filename>). Configuration file fragments, kernels, | |
35 | initrds and other EFI images to boot generally need to reside on the ESP or the Extended Boot Loader | |
36 | partition. Linux kernels must be built with <option>CONFIG_EFI_STUB</option> to be able to be directly | |
37 | executed as an EFI image. During boot <command>systemd-boot</command> automatically assembles a list of | |
38 | boot entries from the following sources:</para> | |
53ddb667 LP |
39 | |
40 | <itemizedlist> | |
41 | <listitem><para>Boot entries defined with <ulink | |
c5fcaed8 LP |
42 | url="https://systemd.io/BOOT_LOADER_SPECIFICATION">Boot Loader Specification</ulink> description files |
43 | located in <filename>/loader/entries/</filename> on the ESP and the Extended Boot Loader | |
44 | Partition. These usually describe Linux kernel images with associated initrd images, but alternatively | |
45 | may also describe arbitrary other EFI executables.</para></listitem> | |
53ddb667 LP |
46 | |
47 | <listitem><para>Unified kernel images following the <ulink | |
c5fcaed8 LP |
48 | url="https://systemd.io/BOOT_LOADER_SPECIFICATION">Boot Loader Specification</ulink>, as executable EFI |
49 | binaries in <filename>/EFI/Linux/</filename> on the ESP and the Extended Boot Loader Partition. | |
48691dca | 50 | </para></listitem> |
53ddb667 LP |
51 | |
52 | <listitem><para>The Microsoft Windows EFI boot manager, if installed</para></listitem> | |
53 | ||
54 | <listitem><para>The Apple MacOS X boot manager, if installed</para></listitem> | |
55 | ||
56 | <listitem><para>The EFI Shell binary, if installed</para></listitem> | |
57 | ||
58 | <listitem><para>A reboot into the UEFI firmware setup option, if supported by the firmware</para></listitem> | |
59 | </itemizedlist> | |
60 | ||
39867bb9 LP |
61 | <para><command>systemd-boot</command> supports the following features:</para> |
62 | ||
63 | <itemizedlist> | |
64 | <listitem><para>Basic boot manager configuration changes (such as timeout | |
65 | configuration, default boot entry selection, …) may be made directly from the boot loader UI at | |
66 | boot-time, as well as during system runtime with EFI variables.</para></listitem> | |
67 | ||
68 | <listitem><para>The boot manager integrates with the <command>systemctl</command> command to implement | |
69 | features such as <command>systemctl reboot --boot-loader-entry=…</command> (for rebooting into a | |
70 | specific boot menu entry, i.e. "reboot into Windows") and <command>systemctl reboot | |
71 | --boot-loader-menu=…</command> (for rebooting into the boot loader menu), by implementing the <ulink | |
72 | url="https://systemd.io/BOOT_LOADER_INTERFACE">Boot Loader Interface</ulink>. See | |
73 | <citerefentry><refentrytitle>systemctl</refentrytitle><manvolnum>1</manvolnum></citerefentry> for | |
74 | details.</para></listitem> | |
75 | ||
76 | <listitem><para>An EFI variable set by the boot loader informs the OS about the ESP partition used | |
77 | during boot. This is then used to automatically mount the correct ESP partition to | |
78 | <filename>/efi/</filename> or <filename>/boot/</filename> during OS runtime. See | |
79 | <citerefentry><refentrytitle>systemd-gpt-auto-generator</refentrytitle><manvolnum>8</manvolnum></citerefentry> | |
80 | for details.</para></listitem> | |
81 | ||
82 | <listitem><para>The boot manager provides information about the boot time spent in UEFI firmware using | |
83 | the <ulink url="https://systemd.io/BOOT_LOADER_INTERFACE">Boot Loader Interface</ulink>. This | |
84 | information can be displayed using | |
85 | <citerefentry><refentrytitle>systemd-analyze</refentrytitle><manvolnum>1</manvolnum></citerefentry>. | |
86 | </para></listitem> | |
87 | ||
88 | <listitem><para>The boot manager implements boot counting and automatic fallback to older, working boot | |
89 | entries on failure. See <ulink url="https://systemd.io/AUTOMATIC_BOOT_ASSESSMENT">Automatic Boot | |
90 | Assessment</ulink>.</para></listitem> | |
91 | ||
92 | <listitem><para>The boot manager optionally reads a random seed from the ESP partition, combines it | |
11fcfc53 | 93 | with a 'system token' stored in a persistent EFI variable and derives a random seed to use by the OS as |
e9dd6984 | 94 | entropy pool initialization, providing a full entropy pool during early boot.</para></listitem> |
39867bb9 LP |
95 | </itemizedlist> |
96 | ||
97 | <para><citerefentry><refentrytitle>bootctl</refentrytitle><manvolnum>1</manvolnum></citerefentry> | |
c5fcaed8 LP |
98 | may be used from a running system to locate the ESP and the Extended Boot Loader Partition, list |
99 | available entries, and install <command>systemd-boot</command> itself.</para> | |
53ddb667 | 100 | |
39867bb9 LP |
101 | <para><citerefentry><refentrytitle>kernel-install</refentrytitle><manvolnum>8</manvolnum></citerefentry> |
102 | may be used to copy kernel images onto the ESP or the Extended Boot Loader Partition and to generate | |
103 | description files compliant with the Boot Loader | |
104 | Specification.</para> | |
f37d3835 ZJS |
105 | </refsect1> |
106 | ||
f37d3835 ZJS |
107 | <refsect1> |
108 | <title>Key bindings</title> | |
109 | <para>The following keys may be used in the boot menu:</para> | |
110 | ||
111 | <variablelist> | |
112 | <varlistentry> | |
8c073dde LP |
113 | <term><keycap>↑</keycap> (Up)</term> |
114 | <term><keycap>↓</keycap> (Down)</term> | |
115 | <term><keycap>j</keycap></term> | |
116 | <term><keycap>k</keycap></term> | |
117 | <term><keycap>PageUp</keycap></term> | |
118 | <term><keycap>PageDown</keycap></term> | |
119 | <term><keycap>Home</keycap></term> | |
120 | <term><keycap>End</keycap></term> | |
f37d3835 ZJS |
121 | <listitem><para>Navigate up/down in the entry list</para></listitem> |
122 | </varlistentry> | |
123 | ||
124 | <varlistentry> | |
8c073dde | 125 | <term><keycap>↵</keycap> (Enter)</term> |
904ebcb2 | 126 | <term><keycap>→</keycap> (Right)</term> |
f37d3835 ZJS |
127 | <listitem><para>Boot selected entry</para></listitem> |
128 | </varlistentry> | |
129 | ||
130 | <varlistentry> | |
8c073dde | 131 | <term><keycap>d</keycap></term> |
f37d3835 ZJS |
132 | <listitem><para>Make selected entry the default</para></listitem> |
133 | </varlistentry> | |
134 | ||
135 | <varlistentry> | |
8c073dde | 136 | <term><keycap>e</keycap></term> |
f37d3835 ZJS |
137 | <listitem><para>Edit the kernel command line for selected entry</para></listitem> |
138 | </varlistentry> | |
139 | ||
140 | <varlistentry> | |
8c073dde LP |
141 | <term><keycap>+</keycap></term> |
142 | <term><keycap>t</keycap></term> | |
f37d3835 ZJS |
143 | <listitem><para>Increase the timeout before default entry is booted</para></listitem> |
144 | </varlistentry> | |
145 | ||
146 | <varlistentry> | |
8c073dde LP |
147 | <term><keycap>-</keycap></term> |
148 | <term><keycap>T</keycap></term> | |
f37d3835 ZJS |
149 | <listitem><para>Decrease the timeout</para></listitem> |
150 | </varlistentry> | |
151 | ||
152 | <varlistentry> | |
8c073dde | 153 | <term><keycap>v</keycap></term> |
70c8db75 | 154 | <listitem><para>Show systemd-boot, UEFI, and firmware versions</para></listitem> |
f37d3835 ZJS |
155 | </varlistentry> |
156 | ||
157 | <varlistentry> | |
8c073dde | 158 | <term><keycap>P</keycap></term> |
f37d3835 ZJS |
159 | <listitem><para>Print status</para></listitem> |
160 | </varlistentry> | |
161 | ||
162 | <varlistentry> | |
8c073dde | 163 | <term><keycap>Q</keycap></term> |
f37d3835 ZJS |
164 | <listitem><para>Quit</para></listitem> |
165 | </varlistentry> | |
166 | ||
167 | <varlistentry> | |
8c073dde LP |
168 | <term><keycap>h</keycap></term> |
169 | <term><keycap>?</keycap></term> | |
a318a565 | 170 | <term><keycap>F1</keycap></term> |
f37d3835 ZJS |
171 | <listitem><para>Show a help screen</para></listitem> |
172 | </varlistentry> | |
173 | ||
174 | <varlistentry> | |
8c073dde | 175 | <term><keycombo><keycap>Ctrl</keycap><keycap>l</keycap></keycombo></term> |
f37d3835 ZJS |
176 | <listitem><para>Reprint the screen</para></listitem> |
177 | </varlistentry> | |
178 | </variablelist> | |
179 | ||
e14a0c21 LP |
180 | <para>The following keys may be pressed during bootup or in the boot menu to directly boot a specific |
181 | entry:</para> | |
f37d3835 ZJS |
182 | |
183 | <variablelist> | |
184 | <varlistentry> | |
8c073dde | 185 | <term><keycap>l</keycap></term> |
f37d3835 ZJS |
186 | <listitem><para>Linux</para></listitem> |
187 | </varlistentry> | |
188 | ||
189 | <varlistentry> | |
8c073dde | 190 | <term><keycap>w</keycap></term> |
f37d3835 ZJS |
191 | <listitem><para>Windows</para></listitem> |
192 | </varlistentry> | |
193 | ||
194 | <varlistentry> | |
8c073dde | 195 | <term><keycap>a</keycap></term> |
f37d3835 ZJS |
196 | <listitem><para>OS X</para></listitem> |
197 | </varlistentry> | |
198 | ||
199 | <varlistentry> | |
8c073dde | 200 | <term><keycap>s</keycap></term> |
f37d3835 ZJS |
201 | <listitem><para>EFI shell</para></listitem> |
202 | </varlistentry> | |
203 | ||
204 | <varlistentry> | |
8c073dde LP |
205 | <term><keycap>1</keycap></term> |
206 | <term><keycap>2</keycap></term> | |
207 | <term><keycap>3</keycap></term> | |
208 | <term><keycap>4</keycap></term> | |
209 | <term><keycap>5</keycap></term> | |
210 | <term><keycap>6</keycap></term> | |
211 | <term><keycap>7</keycap></term> | |
212 | <term><keycap>8</keycap></term> | |
213 | <term><keycap>9</keycap></term> | |
53ddb667 | 214 | <listitem><para>Boot entry number 1 … 9</para></listitem> |
f37d3835 ZJS |
215 | </varlistentry> |
216 | </variablelist> | |
217 | ||
e14a0c21 LP |
218 | <para>The boot menu is shown when a non-zero menu timeout has been configured. If the menu timeout has |
219 | been set to zero, it is sufficient to press any key — before the boot loader initializes — to bring up | |
220 | the boot menu, except for the keys listed immediately above as they directly boot into the selected boot | |
221 | menu item. Note that depending on the firmware implementation the time window where key presses are | |
222 | accepted before the boot loader initializes might be short. If the window is missed, reboot and try | |
223 | again, possibly pressing a suitable key (e.g. the space bar) continuously; on most systems it should be | |
224 | possible to hit the time window after a few attempts. To avoid this problem, consider setting a non-zero | |
225 | timeout, thus showing the boot menu unconditionally. Some desktop environments might offer an option to | |
226 | directly boot into the boot menu, to avoid the problem altogether. Alternatively, use the command line | |
227 | <command>systemctl reboot --boot-loader-menu=0</command> from the shell.</para> | |
228 | ||
f37d3835 ZJS |
229 | <para>In the editor, most keys simply insert themselves, but the following keys |
230 | may be used to perform additional actions:</para> | |
231 | ||
232 | <variablelist> | |
233 | <varlistentry> | |
8c073dde LP |
234 | <term><keycap>←</keycap> (Left)</term> |
235 | <term><keycap>→</keycap> (Right)</term> | |
236 | <term><keycap>Home</keycap></term> | |
237 | <term><keycap>End</keycap></term> | |
f37d3835 ZJS |
238 | <listitem><para>Navigate left/right</para></listitem> |
239 | </varlistentry> | |
240 | ||
241 | <varlistentry> | |
8c073dde | 242 | <term><keycap>Esc</keycap></term> |
f37d3835 ZJS |
243 | <listitem><para>Abort the edit and quit the editor</para></listitem> |
244 | </varlistentry> | |
245 | ||
246 | <varlistentry> | |
8c073dde | 247 | <term><keycombo><keycap>Ctrl</keycap><keycap>k</keycap></keycombo></term> |
f37d3835 ZJS |
248 | <listitem><para>Clear the command line</para></listitem> |
249 | </varlistentry> | |
250 | ||
251 | <varlistentry> | |
8c073dde LP |
252 | <term><keycombo><keycap>Ctrl</keycap><keycap>w</keycap></keycombo></term> |
253 | <term><keycombo><keycap>Alt</keycap><keycap>Backspace</keycap></keycombo></term> | |
f37d3835 ZJS |
254 | <listitem><para>Delete word backwards</para></listitem> |
255 | </varlistentry> | |
256 | ||
257 | <varlistentry> | |
8c073dde | 258 | <term><keycombo><keycap>Alt</keycap><keycap>d</keycap></keycombo></term> |
f37d3835 ZJS |
259 | <listitem><para>Delete word forwards</para></listitem> |
260 | </varlistentry> | |
261 | ||
262 | <varlistentry> | |
8c073dde | 263 | <term><keycap>↵</keycap> (Enter)</term> |
f37d3835 ZJS |
264 | <listitem><para>Boot entry with the edited command line</para></listitem> |
265 | </varlistentry> | |
266 | </variablelist> | |
267 | ||
70c8db75 | 268 | <para>Note that unless configured otherwise in the UEFI firmware, systemd-boot will |
f37d3835 ZJS |
269 | use the US keyboard layout, so key labels might not match for keys like +/-. |
270 | </para> | |
271 | </refsect1> | |
272 | ||
53ddb667 LP |
273 | <refsect1> |
274 | <title>Files</title> | |
275 | ||
c5fcaed8 LP |
276 | <para>The files <command>systemd-boot</command> processes generally reside on the UEFI ESP which is |
277 | usually mounted to <filename>/efi/</filename>, <filename>/boot/</filename> or | |
278 | <filename>/boot/efi/</filename> during OS runtime. It also processes files on the Extended Boot Loader | |
279 | partition which is typically mounted to <filename>/boot/</filename>, if it | |
280 | exists. <command>systemd-boot</command> reads runtime configuration such as the boot timeout and default | |
281 | entry from <filename>/loader/loader.conf</filename> on the ESP (in combination with data read from EFI | |
282 | variables). See | |
283 | <citerefentry><refentrytitle>loader.conf</refentrytitle><manvolnum>5</manvolnum></citerefentry>. Boot | |
284 | entry description files following the <ulink url="https://systemd.io/BOOT_LOADER_SPECIFICATION">Boot | |
285 | Loader Specification</ulink> are read from <filename>/loader/entries/</filename> on the ESP and the | |
286 | Extended Boot Loader partition. Unified kernel boot entries following the <ulink | |
287 | url="https://systemd.io/BOOT_LOADER_SPECIFICATION">Boot Loader Specification</ulink> are read from | |
39867bb9 LP |
288 | <filename>/EFI/Linux/</filename> on the ESP and the Extended Boot Loader partition. Optionally, a random |
289 | seed for early boot entropy pool provisioning is stored in <filename>/loader/random-seed</filename> in | |
290 | the ESP.</para> | |
53ddb667 LP |
291 | </refsect1> |
292 | ||
8eebff9e LP |
293 | <refsect1> |
294 | <title>EFI Variables</title> | |
295 | ||
296 | <para>The following EFI variables are defined, set and read by <command>systemd-boot</command>, under the vendor | |
297 | UUID <literal>4a67b082-0a4c-41cf-b6c7-440b29bb8c4</literal>, for communication between the OS and the boot | |
298 | loader:</para> | |
299 | ||
bc61c2b1 | 300 | <variablelist class='efi-variables'> |
8eebff9e LP |
301 | <varlistentry> |
302 | <term><varname>LoaderBootCountPath</varname></term> | |
303 | <listitem><para>If boot counting is enabled, contains the path to the file in whose name the boot counters are | |
304 | encoded. Set by the boot | |
305 | loader. <citerefentry><refentrytitle>systemd-bless-boot.service</refentrytitle><manvolnum>8</manvolnum></citerefentry> | |
306 | uses this information to mark a boot as successful as determined by the successful activation of the | |
307 | <filename>boot-complete.target</filename> target unit.</para></listitem> | |
308 | </varlistentry> | |
309 | ||
310 | <varlistentry> | |
311 | <term><varname>LoaderConfigTimeout</varname></term> | |
fe2579dd | 312 | <term><varname>LoaderConfigTimeoutOneShot</varname></term> |
3f9a0a52 | 313 | <listitem><para>The menu timeout in seconds. Read by the boot loader. <varname>LoaderConfigTimeout</varname> |
fe2579dd LP |
314 | is maintained persistently, while <varname>LoaderConfigTimeoutOneShot</varname> is a one-time override which is |
315 | read once (in which case it takes precedence over <varname>LoaderConfigTimeout</varname>) and then | |
316 | removed. <varname>LoaderConfigTimeout</varname> may be manipulated with the | |
e9dd6984 | 317 | <keycap>t</keycap>/<keycap>T</keycap> keys, see above.</para></listitem> |
8eebff9e LP |
318 | </varlistentry> |
319 | ||
320 | <varlistentry> | |
321 | <term><varname>LoaderDevicePartUUID</varname></term> | |
322 | ||
323 | <listitem><para>Contains the partition UUID of the EFI System Partition the boot loader was run from. Set by | |
324 | the boot | |
325 | loader. <citerefentry><refentrytitle>systemd-gpt-auto-generator</refentrytitle><manvolnum>8</manvolnum></citerefentry> | |
326 | uses this information to automatically find the disk booted from, in order to discover various other partitions | |
327 | on the same disk automatically.</para></listitem> | |
328 | </varlistentry> | |
329 | ||
330 | <varlistentry> | |
331 | <term><varname>LoaderEntries</varname></term> | |
332 | ||
333 | <listitem><para>A list of the identifiers of all discovered boot loader entries. Set by the boot | |
334 | loader.</para></listitem> | |
335 | </varlistentry> | |
336 | ||
337 | <varlistentry> | |
338 | <term><varname>LoaderEntryDefault</varname></term> | |
339 | <term><varname>LoaderEntryOneShot</varname></term> | |
340 | ||
341 | <listitem><para>The identifier of the default boot loader entry. Set primarily by the OS and read by the boot | |
342 | loader. <varname>LoaderEntryOneShot</varname> sets the default entry for the next boot only, while | |
343 | <varname>LoaderEntryDefault</varname> sets it persistently for all future | |
344 | boots. <citerefentry><refentrytitle>bootctl</refentrytitle><manvolnum>1</manvolnum></citerefentry>'s | |
345 | <option>set-default</option> and <option>set-oneshot</option> commands make use of these variables. The boot | |
346 | loader modifies <varname>LoaderEntryDefault</varname> on request, when the <keycap>d</keycap> key is used, see | |
f4e1a425 | 347 | above.</para></listitem> |
8eebff9e LP |
348 | </varlistentry> |
349 | ||
350 | <varlistentry> | |
351 | <term><varname>LoaderEntrySelected</varname></term> | |
352 | ||
353 | <listitem><para>The identifier of the boot loader entry currently being booted. Set by the boot | |
354 | loader.</para></listitem> | |
355 | </varlistentry> | |
356 | ||
5dd5f7cf LP |
357 | <varlistentry> |
358 | <term><varname>LoaderFeatures</varname></term> | |
359 | ||
360 | <listitem><para>A set of flags indicating the features the boot loader supports. Set by the boot loader. Use | |
361 | <citerefentry><refentrytitle>bootctl</refentrytitle><manvolnum>1</manvolnum></citerefentry> to view this | |
362 | data.</para></listitem> | |
363 | </varlistentry> | |
364 | ||
8eebff9e LP |
365 | <varlistentry> |
366 | <term><varname>LoaderFirmwareInfo</varname></term> | |
367 | <term><varname>LoaderFirmwareType</varname></term> | |
368 | ||
369 | <listitem><para>Brief firmware information. Set by the boot loader. Use | |
370 | <citerefentry><refentrytitle>bootctl</refentrytitle><manvolnum>1</manvolnum></citerefentry> to view this | |
371 | data.</para></listitem> | |
372 | </varlistentry> | |
373 | ||
374 | <varlistentry> | |
375 | <term><varname>LoaderImageIdentifier</varname></term> | |
376 | ||
377 | <listitem><para>The path of executable of the boot loader used for the current boot, relative to the EFI System | |
378 | Partition's root directory. Set by the boot loader. Use | |
379 | <citerefentry><refentrytitle>bootctl</refentrytitle><manvolnum>1</manvolnum></citerefentry> to view this | |
380 | data.</para></listitem> | |
381 | </varlistentry> | |
382 | ||
383 | <varlistentry> | |
384 | <term><varname>LoaderInfo</varname></term> | |
385 | ||
386 | <listitem><para>Brief information about the boot loader. Set by the boot loader. Use | |
387 | <citerefentry><refentrytitle>bootctl</refentrytitle><manvolnum>1</manvolnum></citerefentry> to view this | |
388 | data.</para></listitem> | |
389 | </varlistentry> | |
390 | ||
391 | <varlistentry> | |
392 | <term><varname>LoaderTimeExecUSec</varname></term> | |
393 | <term><varname>LoaderTimeInitUSec</varname></term> | |
394 | <term><varname>LoaderTimeMenuUsec</varname></term> | |
395 | ||
396 | <listitem><para>Information about the time spent in various parts of the boot loader. Set by the boot | |
397 | loader. Use <citerefentry><refentrytitle>systemd-analyze</refentrytitle><manvolnum>1</manvolnum></citerefentry> | |
39867bb9 LP |
398 | to view this data. </para></listitem> |
399 | </varlistentry> | |
400 | ||
401 | <varlistentry> | |
402 | <term><varname>LoaderRandomSeed</varname></term> | |
403 | ||
404 | <listitem><para>A binary random seed <command>systemd-boot</command> may optionally pass to the | |
405 | OS. This is a volatile EFI variable that is hashed at boot from the combination of a random seed | |
406 | stored in the ESP (in <filename>/loader/random-seed</filename>) and a "system token" persistently | |
407 | stored in the EFI variable <varname>LoaderSystemToken</varname> (see below). During early OS boot the | |
408 | system manager reads this variable and passes it to the OS kernel's random pool, crediting the full | |
409 | entropy it contains. This is an efficient way to ensure the system starts up with a fully initialized | |
410 | kernel random pool — as early as the initial RAM disk phase. <command>systemd-boot</command> reads | |
411 | the random seed from the ESP, combines it with the "system token", and both derives a new random seed | |
412 | to update in-place the seed stored in the ESP, and the random seed to pass to the OS from it via | |
413 | SHA256 hashing in counter mode. This ensures that different physical systems that boot the same | |
414 | "golden" OS image — i.e. containing the same random seed file in the ESP — will still pass a | |
415 | different random seed to the OS. It is made sure the random seed stored in the ESP is fully | |
416 | overwritten before the OS is booted, to ensure different random seed data is used between subsequent | |
93f59100 LP |
417 | boots.</para> |
418 | ||
419 | <para>See <ulink url="https://systemd.io/RANDOM_SEEDS">Random Seeds</ulink> for | |
420 | further information.</para></listitem> | |
39867bb9 LP |
421 | </varlistentry> |
422 | ||
423 | <varlistentry> | |
424 | <term><varname>LoaderSystemToken</varname></term> | |
425 | ||
e9dd6984 ZJS |
426 | <listitem><para>A binary random data field, that is used for generating the random seed to pass to |
427 | the OS (see above). Note that this random data is generally only generated once, during OS | |
428 | installation, and is then never updated again.</para></listitem> | |
8eebff9e LP |
429 | </varlistentry> |
430 | </variablelist> | |
39867bb9 LP |
431 | |
432 | <para>Many of these variables are defined by the <ulink | |
433 | url="https://systemd.io/BOOT_LOADER_INTERFACE">Boot Loader Interface</ulink>.</para> | |
8eebff9e LP |
434 | </refsect1> |
435 | ||
2b6cc3ca LP |
436 | <refsect1> |
437 | <title>Boot Counting</title> | |
438 | ||
439 | <para><command>systemd-boot</command> implements a simple boot counting mechanism on top of the <ulink | |
440 | url="https://systemd.io/BOOT_LOADER_SPECIFICATION">Boot Loader Specification</ulink>, for automatic and unattended | |
5238e957 | 441 | fallback to older kernel versions/boot loader entries when a specific entry continuously fails. Any boot loader |
2b6cc3ca LP |
442 | entry file and unified kernel image file that contains a <literal>+</literal> followed by one or two numbers (if |
443 | two they need to be separated by a <literal>-</literal>), before the <filename>.conf</filename> or | |
444 | <filename>.efi</filename> suffix is subject to boot counting: the first of the two numbers ('tries left') is | |
445 | decreased by one on every boot attempt, the second of the two numbers ('tries done') is increased by one (if 'tries | |
446 | done' is absent it is considered equivalent to 0). Depending on the current value of these two counters the boot | |
447 | entry is considered to be in one of three states:</para> | |
448 | ||
449 | <orderedlist> | |
450 | <listitem><para>If the 'tries left' counter of an entry is greater than zero the entry is considered to be in | |
451 | 'indeterminate' state. This means the entry has not completed booting successfully yet, but also hasn't been | |
452 | determined not to work.</para></listitem> | |
453 | ||
454 | <listitem><para>If the 'tries left' counter of an entry is zero it is considered to be in 'bad' state. This means | |
455 | no further attempts to boot this item will be made (that is, unless all other boot entries are also in 'bad' | |
456 | state), as all attempts to boot this entry have not completed successfully.</para></listitem> | |
457 | ||
458 | <listitem><para>If the 'tries left' and 'tries done' counters of an entry are absent it is considered to be in | |
459 | 'good' state. This means further boot counting for the entry is turned off, as it successfully booted at least | |
460 | once. The | |
461 | <citerefentry><refentrytitle>systemd-bless-boot.service</refentrytitle><manvolnum>8</manvolnum></citerefentry> | |
462 | service moves the currently booted entry from 'indeterminate' into 'good' state when a boot attempt completed | |
463 | successfully.</para></listitem> | |
464 | </orderedlist> | |
465 | ||
466 | <para>Generally, when new entries are added to the boot loader, they first start out in 'indeterminate' state, | |
467 | i.e. with a 'tries left' counter greater than zero. The boot entry remains in this state until either it managed to | |
468 | complete a full boot successfully at least once (in which case it will be in 'good' state) — or the 'tries left' | |
469 | counter reaches zero (in which case it will be in 'bad' state).</para> | |
470 | ||
471 | <para>Example: let's say a boot loader entry file <filename>foo.conf</filename> is set up for 3 boot tries. The | |
472 | installer will hence create it under the name <filename>foo+3.conf</filename>. On first boot, the boot loader will | |
473 | rename it to <filename>foo+2-1.conf</filename>. If that boot does not complete successfully, the boot loader will | |
474 | rename it to <filename>foo+1-2.conf</filename> on the following boot. If that fails too, it will finally be renamed | |
475 | <filename>foo+0-3.conf</filename> by the boot loader on next boot, after which it will be considered 'bad'. If the | |
476 | boot succeeds however the entry file will be renamed to <filename>foo.conf</filename> by the OS, so that it is | |
477 | considered 'good' from then on.</para> | |
478 | ||
479 | <para>The boot menu takes the 'tries left' counter into account when sorting the menu entries: entries in 'bad' | |
e6190e28 | 480 | state are ordered at the beginning of the list, and entries in 'good' or 'indeterminate' at the end. The user can |
2b6cc3ca | 481 | freely choose to boot any entry of the menu, including those already marked 'bad'. If the menu entry to boot is |
e6190e28 DF |
482 | automatically determined, this means that 'good' or 'indeterminate' entries are generally preferred (as the bottom |
483 | item of the menu is the one booted by default), and 'bad' entries will only be considered if there are no 'good' or | |
2b6cc3ca LP |
484 | 'indeterminate' entries left.</para> |
485 | ||
486 | <para>The <citerefentry><refentrytitle>kernel-install</refentrytitle><manvolnum>8</manvolnum></citerefentry> kernel | |
487 | install framework optionally sets the initial 'tries left' counter to the value specified in | |
488 | <filename>/etc/kernel/tries</filename> when a boot loader entry is first created.</para> | |
489 | </refsect1> | |
490 | ||
f37d3835 ZJS |
491 | <refsect1> |
492 | <title>See Also</title> | |
493 | <para> | |
494 | <citerefentry><refentrytitle>bootctl</refentrytitle><manvolnum>1</manvolnum></citerefentry>, | |
495 | <citerefentry><refentrytitle>loader.conf</refentrytitle><manvolnum>5</manvolnum></citerefentry>, | |
2b6cc3ca | 496 | <citerefentry><refentrytitle>systemd-bless-boot.service</refentrytitle><manvolnum>8</manvolnum></citerefentry>, |
39867bb9 | 497 | <citerefentry><refentrytitle>systemd-boot-system-token.service</refentrytitle><manvolnum>8</manvolnum></citerefentry>, |
2b6cc3ca | 498 | <citerefentry><refentrytitle>kernel-install</refentrytitle><manvolnum>8</manvolnum></citerefentry>, |
a0848495 | 499 | <ulink url="https://systemd.io/BOOT_LOADER_SPECIFICATION">Boot Loader Specification</ulink>, |
2fe82132 | 500 | <ulink url="https://systemd.io/BOOT_LOADER_INTERFACE">Boot Loader Interface</ulink> |
f37d3835 ZJS |
501 | </para> |
502 | </refsect1> | |
503 | </refentry> |