sd-boot: add support for a sysfail entry (#34856)
Add support for a sysfail boot entry. Sysfail boot entries can be used
for optional tweaking the automatic selection order in case a failure
state of the system in some form is detected (boot firmware failure
etc).
The EFI variable `LoaderEntrySysFail` contains the sysfail boot loader
entry to use. It can be set using bootctl:
```
$ bootctl set-sysfail sysfail.conf
```
The `LoaderEntrySysFail` EFI variable would be unset automatically
during next boot by `systemd-boot-clear-sysfail.service` if no system
failure occured, otherwise it would be kept as it is and a system
failure reason will be saved to `LoaderSysFailReason` EFI variable.
`sysfail_check()` expected to be extented to support possibleconditions
when we should boot sysfail("recovery") boot entry.
Also add support for using a sysfail boot entry in case of UEFI firmware
capsule update failure [1]. The status of a firmware update is obtained
from the EFI System Resource Table (ESRT), which provides an optional
mechanism for identifying device and system firmware resources for the
purposes of targeting firmware updates to those resources.
Current implementation uses the value of LastAttemptStatus field from
ESRT, which describes the result of the last firmware update attempt for
the firmware resource entry. The field is updated each time an
`UpdateCapsule()` is attempted for an ESRT entry and is preserved across
reboots (non-volatile).
This can be be used in setups with support for A/B OTA updates, where
the boot firmware and Linux/RootFS might be updated synchronously.
The check is activated by adding "sysfail-firmware-upd" to loader.conf
[1]
https://uefi.org/specs/UEFI/2.10/23_Firmware_Update_and_Reporting.html
This commit is contained in:
@@ -102,6 +102,8 @@ Some EFI variables control the loader or exported the loaders state to the start
|
||||
| EFI Variables |
|
||||
|---------------|------------------------|-------------------------------|
|
||||
| LoaderEntryDefault | entry identifier to select as default at bootup | non-volatile |
|
||||
| LoaderEntrySysFail | sysfail entry identifier | non-volatile |
|
||||
| LoaderSysFailReason | system failure reason | volatile |
|
||||
| LoaderConfigTimeout | timeout in seconds to show the menu | non-volatile |
|
||||
| LoaderEntryOneShot | entry identifier to select at the next and only the next bootup | non-volatile |
|
||||
| LoaderDeviceIdentifier | list of identifiers of the volume the loader was started from | volatile |
|
||||
|
||||
@@ -58,6 +58,18 @@ variables. All EFI variables use the vendor UUID
|
||||
* The EFI variable `LoaderEntryDefault` contains the default boot loader entry
|
||||
to use. It contains a NUL-terminated boot loader entry identifier.
|
||||
|
||||
* The EFI variable `LoaderEntrySysFail` specifies the boot loader entry to be
|
||||
used in case of a system failure. System failure (SysFail) boot entries can
|
||||
optionally modify the automatic selection order in the event of a failure,
|
||||
such as a boot firmware update failure with the failure status recorded in
|
||||
the EFI system table. If a system failure occurs and `LoaderEntrySysFail` is set,
|
||||
systemd-boot will use this boot entry and store the actual SysFail reason in
|
||||
the `LoaderSysFailReason` EFI variable.
|
||||
|
||||
* The EFI variable `LoaderSysFailReason` contains the system failure reason.
|
||||
This variable is used in cooperation with `LoaderEntrySysFail` boot entry.
|
||||
If system failure doesn't occur `LoaderSysFailReason` is not set at all.
|
||||
|
||||
* Similarly, the EFI variable `LoaderEntryOneShot` contains the default boot
|
||||
loader entry to use for a single following boot. It is set by the OS in order
|
||||
to request booting into a specific menu entry on the following boot. When set
|
||||
|
||||
Reference in New Issue
Block a user