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 failed on USB boot: Modern shim bootloaders (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-install fatal error during installation: The OS files copy fine, but grub-install fails at the very end when efibootmgr tries 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.EFI and only boots a hardcoded entry in NVRAM pointing to \EFI\Microsoft\Boot\bootmgfw.efi on a specific GPT PARTUUID.
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:
lsblk -f
sudo mount /dev/sda2 /mnt
sudo mount /dev/sda1 /mnt/boot/efi
sudo mount --bind /dev /mnt/dev
sudo mount --bind /dev/pts /mnt/dev/pts
sudo mount --bind /proc /mnt/proc
sudo mount --bind /sys /mnt/sys
sudo chroot /mnt
grub-install --target=x86_64-efi --efi-directory=/boot/efi --bootloader-id=ubuntu --no-nvram --removable
update-grub
exit
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:
sudo mkdir -p /mnt/hdd_efi /mnt/usb_efi
sudo mount /dev/sda1 /mnt/hdd_efi
sudo mount /dev/sdb2 /mnt/usb_efi
sudo mkdir -p /mnt/hdd_efi/EFI/Microsoft/Boot
sudo cp /mnt/usb_efi/efi/boot/bootx64.efi /mnt/hdd_efi/EFI/Microsoft/Boot/bootmgfw.efi
sudo cp /mnt/usb_efi/efi/boot/mmx64.efi /mnt/hdd_efi/EFI/Microsoft/Boot/mmx64.efi
sudo cp /mnt/usb_efi/efi/boot/grubx64.efi /mnt/hdd_efi/EFI/Microsoft/Boot/grubx64.efi
sudo cp /mnt/hdd_efi/EFI/ubuntu/grub.cfg /mnt/hdd_efi/EFI/Microsoft/Boot/grub.cfg
sudo umount /mnt/hdd_efi /mnt/usb_efi
(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:
efibootmgr -v
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):
sudo sgdisk -u 1:<HARDCODED-NVRAM-PARTUUID> /dev/sda
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:
sudo dpkg-divert --add --rename --divert /usr/sbin/grub-install.real /usr/sbin/grub-install
echo -e '#!/bin/sh\n/usr/sbin/grub-install.real --no-nvram "\$@"' | sudo tee /usr/sbin/grub-install
sudo chmod +x /usr/sbin/grub-install
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!
</aigenerated>