r/linuxquestions • u/Imaginary_Peanut_639 • 4d ago
¿Has anyone run into problems installing modern Linux on an older laptop with a write-locked BIOS/NVRAM chip: "SbatLevel variable initialization failed" + "grub-install failed"?
I have spend too many hours trying to install linux in an old hp laptop with the BIOS blocked and unable to disable safe mode or entering legacy boot mode. With the help o AI it ended up working. As a final step I asked it a guide, that I proceed to share here, in case someone encounters a similar problem:
<aigenerated family="Gemini" flavour="4 Hydrogen">If you have an older laptop (especially 2014–2018 HP InsydeH2O models) where BIOS settings refuse to save, modern Linux ISOs crash with SbatLevel variable initialization failed, and the installer fails with The execution of grub-install /dev/sda failed, your motherboard isn't dead—its BIOS SPI flash (NVRAM) chip is likely write-locked or worn out.
Most forum threads say this requires desoldering the BIOS chip and flashing it with a hardware programmer. Here is how to bypass the locked NVRAM completely using software alone and run a fully updated modern Linux distro (tested on an HP Notebook 17-y010ns running Xubuntu).
Why Everything Fails (The 4 Symptoms)
- BIOS changes revert on every reboot: Even on AC power, disabling Secure Boot or enabling Legacy Support never saves because NVRAM rejects writes. Secure Boot is permanently stuck Enabled.
SbatLevel variable initialization failedon USB boot: Modernshimbootloaders (shim 15.6+, Ventoy, Ubuntu 22.04+, 24.04+) try to write SBAT security variables to NVRAM on startup and crash when the chip refuses.grub-installfatal error during installation: The OS files copy fine, butgrub-installfails at the very end whenefibootmgrtries to register a new boot entry in NVRAM.- Boot loop after manual GRUB install: Even with
--no-nvram, older HP firmware often ignores\EFI\BOOT\BOOTX64.EFIand only boots a hardcoded entry in NVRAM pointing to\EFI\Microsoft\Boot\bootmgfw.efion a specific GPTPARTUUID.
Step 1: Boot Using a Pre-SBAT ISO (shim 15.4 or earlier)
Because Secure Boot is stuck Enabled, you need a Microsoft-signed shim created before SBAT NVRAM writes were introduced in late 2022:
- Download Ubuntu / Xubuntu 20.04.0 through 20.04.4 from
://ubuntu.com(do not use 20.04.5+, 22.04+, or Ventoy). - Flash it directly to a USB stick using
dd(or Rufus/BalenaEtcher). - Boot via F9 -> EFI USB Device and install normally. (Note: You can upgrade in-place to 22.04 -> 24.04 -> 26.04 afterward).
Step 2: Finish GRUB Installation Without Touching NVRAM
When the installer throws the fatal grub-install error at the end, stay in the Live session, open a terminal, and install GRUB with --no-nvram:
Step 3: Copy Working shim 15.4 Binaries to the Hardcoded Windows Path
During installation, Ubuntu often downloads an updated shim from the internet onto your hard drive, which will trigger SbatLevel again on reboot. Furthermore, locked HP BIOSes usually look for \EFI\Microsoft\Boot\bootmgfw.efi.
While still in the Live USB session, copy the working shim 15.4 binaries from your USB stick's EFI partition (e.g., /dev/sdb2) into \EFI\Microsoft\Boot\ on your hard drive:
(Note: Depending on your USB image, /efi/boot/ filenames may be uppercase or lowercase).
Step 4: Match Your EFI Partition's PARTUUID to NVRAM
If the laptop still loops on reboot instead of booting automatically, boot manually once via F9 -> Boot From EFI File -> \EFI\Microsoft\Boot\bootmgfw.efi.
Once inside your installed desktop, check what PARTUUID your locked NVRAM is hardcoded to look for:
Look at the first entry in BootOrder (usually Boot0001). You will see a string like:
HD(1,GPT,<HARDCODED-NVRAM-PARTUUID>,0x800,0x82000)/File(\EFI\Microsoft\Boot\bootmgfw.efi)
Because formatting /dev/sda1 during installation gave it a new random PARTUUID, the BIOS skips it. Change /dev/sda1's GPT PARTUUID to match what your NVRAM expects (this does not affect filesystem UUIDs or /etc/fstab):
Step 5: Protect Future Updates & Release Upgrades (dpkg-divert)
To prevent apt upgrade or do-release-upgrade from crashing when grub-install tries to write to NVRAM, divert /usr/sbin/grub-install so it always runs with --no-nvram:
|
Ubuntu will only ever update \EFI\ubuntu\, leaving your working shim 15.4 inside \EFI\Microsoft\Boot\bootmgfw.efi untouched—allowing seamless upgrades all the way to 24.04 / 26.04 LTS!
2
u/Netblock 4d ago
how much space does
/sys/firmware/efi/efivarshave?Also try updating your bios?
Replace the coin battery?
1
u/Imaginary_Peanut_639 4d ago
IMPORTANT. IN THE STEP 1
With F9, EFI USB Device failed. shimx64.efi was the only only one working and must be selected manually from the USB with the option select EFI file.
IMPORTANT. IN THE STEP 3