From 8dcd9878d76ab4843ca77b4c51376c9efa9dcfdc Mon Sep 17 00:00:00 2001 From: Ameer Hamza Date: Thu, 5 Feb 2026 19:45:53 +0500 Subject: [PATCH] Skip creating EFI boot entry on upgrades to avoid NVRAM exhaustion (#984) 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. --- truenas_install/__main__.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/truenas_install/__main__.py b/truenas_install/__main__.py index a5af1ef..92aae1d 100644 --- a/truenas_install/__main__.py +++ b/truenas_install/__main__.py @@ -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}",