diff options
author | Antoine Eiche <lewo@abesis.fr> | 2022-12-16 20:43:22 +0100 |
---|---|---|
committer | Antoine Eiche <lewo@abesis.fr> | 2023-04-04 09:16:41 +0200 |
commit | 2638fb722ec78b51695b6be2aa5affef97263c4c (patch) | |
tree | b4fef1b4e0c9e446d8899ad8f8bf3c5986ab6412 /nixos/modules/system/boot/loader/systemd-boot/systemd-boot-builder.py | |
parent | e077b75a15b3cef3412909a985848580e0ae6232 (diff) |
systemd-boot-builder only ignores OSError "invalid argument"
In order to fix
https://github.com/NixOS/nixpkgs/issues/114552 (profile name with
special characters), all OSError have been ignored while only the OSError
with errno 22 (invalid argument) could has been ignored.
The drawback of ignoring all OSError is that the "No space left on
device" error is also ignored. When the /boot doesn't have enough
available disk space, the switch-to-configuration script succeeds
while the boot menu has not been updated: the user thinks it's system
has been updated, but on the next reboot it is actually rollbacked.
Diffstat (limited to 'nixos/modules/system/boot/loader/systemd-boot/systemd-boot-builder.py')
-rwxr-xr-x | nixos/modules/system/boot/loader/systemd-boot/systemd-boot-builder.py | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/nixos/modules/system/boot/loader/systemd-boot/systemd-boot-builder.py b/nixos/modules/system/boot/loader/systemd-boot/systemd-boot-builder.py index c92451997203..a040518a5a57 100755 --- a/nixos/modules/system/boot/loader/systemd-boot/systemd-boot-builder.py +++ b/nixos/modules/system/boot/loader/systemd-boot/systemd-boot-builder.py @@ -302,8 +302,12 @@ def main() -> None: if is_default: write_loader_conf(*gen) except OSError as e: - profile = f"profile '{gen.profile}'" if gen.profile else "default profile" - print("ignoring {} in the list of boot entries because of the following error:\n{}".format(profile, e), file=sys.stderr) + # See https://github.com/NixOS/nixpkgs/issues/114552 + if e.errno == errno.EINVAL: + profile = f"profile '{gen.profile}'" if gen.profile else "default profile" + print("ignoring {} in the list of boot entries because of the following error:\n{}".format(profile, e), file=sys.stderr) + else: + raise e for root, _, files in os.walk('@efiSysMountPoint@/efi/nixos/.extra-files', topdown=False): relative_root = root.removeprefix("@efiSysMountPoint@/efi/nixos/.extra-files").removeprefix("/") |