summaryrefslogtreecommitdiffstats
path: root/nixos/modules/system/boot/loader/systemd-boot/systemd-boot-builder.py
diff options
context:
space:
mode:
authorKai Harries <kai.harries@posteo.de>2021-02-28 11:45:03 +0100
committerKai Harries <kai.harries@posteo.de>2021-03-02 20:17:57 +0100
commite2be5dc1f4f12eaab10ae2311d293c114868ca1b (patch)
tree3fb077413c6daa26d3d8e021b93319e207576434 /nixos/modules/system/boot/loader/systemd-boot/systemd-boot-builder.py
parentc1180834cf5a9cd8b73fcf58a4efc81661620c76 (diff)
systemd-boot-builder: gracefully ignore errors during entry creation
Catch and ignore errors during writing of the boot entries. These errors could stem from profile names that are not valid filenames on vfat filesystems. fixes #114552
Diffstat (limited to 'nixos/modules/system/boot/loader/systemd-boot/systemd-boot-builder.py')
-rw-r--r--nixos/modules/system/boot/loader/systemd-boot/systemd-boot-builder.py9
1 files changed, 6 insertions, 3 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 6bee900c6830..c47a5a81fb2e 100644
--- a/nixos/modules/system/boot/loader/systemd-boot/systemd-boot-builder.py
+++ b/nixos/modules/system/boot/loader/systemd-boot/systemd-boot-builder.py
@@ -222,9 +222,12 @@ def main():
gens += get_generations(profile)
remove_old_entries(gens)
for gen in gens:
- write_entry(*gen, machine_id)
- if os.readlink(system_dir(*gen)) == args.default_config:
- write_loader_conf(*gen)
+ try:
+ write_entry(*gen, machine_id)
+ if os.readlink(system_dir(*gen)) == args.default_config:
+ write_loader_conf(*gen)
+ except OSError as e:
+ print("ignoring profile '{}' in the list of boot entries because of the following error:\n{}".format(profile, e), file=sys.stderr)
memtest_entry_file = "@efiSysMountPoint@/loader/entries/memtest86.conf"
if os.path.exists(memtest_entry_file):