Skip to content

Commit e2be5dc

Browse files
committed
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
1 parent c118083 commit e2be5dc

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

nixos/modules/system/boot/loader/systemd-boot/systemd-boot-builder.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -222,9 +222,12 @@ def main():
222222
gens += get_generations(profile)
223223
remove_old_entries(gens)
224224
for gen in gens:
225-
write_entry(*gen, machine_id)
226-
if os.readlink(system_dir(*gen)) == args.default_config:
227-
write_loader_conf(*gen)
225+
try:
226+
write_entry(*gen, machine_id)
227+
if os.readlink(system_dir(*gen)) == args.default_config:
228+
write_loader_conf(*gen)
229+
except OSError as e:
230+
print("ignoring profile '{}' in the list of boot entries because of the following error:\n{}".format(profile, e), file=sys.stderr)
228231

229232
memtest_entry_file = "@efiSysMountPoint@/loader/entries/memtest86.conf"
230233
if os.path.exists(memtest_entry_file):

0 commit comments

Comments
 (0)