mirror of
https://github.com/truenas/scale-build.git
synced 2026-02-14 23:18:59 +00:00
Skip creating EFI boot entry on upgrades to avoid NVRAM exhaustion
The `efibootmgr -c` command always creates a new boot entry rather than
updating an existing one. Prior to commit c6ba53c, the GRUB installation
block only ran on fresh installs. That commit extended it to run on
upgrades when GRUB versions differ, which also caused `efibootmgr -c` to
run on upgrades, creating duplicate TrueNAS-X entries. While firmware
typically cleans up duplicate entries on reboot (as observed on TrueNAS
MINI hardware), EFI NVRAM has limited space and users with NVRAM already
full from other sources reported `No space left on device` error during
updates as creating a new entry fails before the next reboot can clean up.
The boot entry created during fresh installation remains valid across
upgrades since GRUB binaries are updated at the same path
(`/EFI/debian/grubx64.efi`). Only create the boot entry on fresh installs
where `old_root` is None.
This commit is contained in:
@@ -668,7 +668,9 @@ def main():
|
||||
run_command(["chroot", root, "cp", "/boot/efi/EFI/debian/grubx64.efi",
|
||||
"/boot/efi/EFI/boot/bootx64.efi"])
|
||||
|
||||
if os.path.exists("/sys/firmware/efi"):
|
||||
if os.path.exists("/sys/firmware/efi") and old_root is None:
|
||||
# Only create boot entry on fresh install.
|
||||
# On upgrades, the entry already exists from the original installation.
|
||||
run_command(["chroot", root, "efibootmgr", "-c",
|
||||
"-d", f"/dev/{disk}",
|
||||
"-p", f"{efi_partition_number}",
|
||||
|
||||
Reference in New Issue
Block a user