grub-install --removable for buggy UEFI


Friday, 8th November, 2024 3min #linux #debian

On my quest of ridding my family from Windows I was faced with a particularly interesting Debian 12 installation. What's so interesting about this one?

Apart from the dog slow HDD the Debian installer chugs along just fine—until...grub-install dummy. It doesn't fail, it just hangs.

Maybe get some cake and check on it afterwards... No, still hanging there. Battery-disconnect it is—click.

Reboot, hit up the live-USB's shell and see what the hell happened. Let's chroot into the broken install:

# from: https://unix.stackexchange.com/questions/541489/grub-fails-to-install-during-debian-10-installer-re-uefi-supermicro-motherboa
mkdir /target
mount /dev/sdX2 /target
mount /dev/sdX1 /target/boot/efi
mount -o rbind /dev /target/dev 
mount -t proc proc /target/proc 
mount -t sysfs sys /target/sys 
mount -t efivarfs efivarfs /target/sys/firmware/efi/efivars 
chroot /target/ 

Everything looks fine so let's fix that GRUB2 installation.

grub-install --verbose /dev/sdX

And...drum roll...it hangs—at trying to modprobe efivars. Huh, why's that?

Let's try something:

grub-install --verbose --no-nvram /dev/sdX

And...it works—in that it finishes without errors. But now the laptop fails to find the new Debian installation and only let's me boot back into the live-USB.

With the --no-nvram option we at least get through the GRUB2 installation. It appears the cheapo laptop's UEFI is bugged causing Linux trouble with editing the motherboard's NVRAM. Cool, why is that bad?

grub-install wants to make the UEFI aware of the new bootloader. It does so by storing the bootloader's location in non-volatile RAM of the motherboard. Then your shiny-new bootloader appears in the UEFI boot options and you can boot.

That doesn't work here, so what now?

--removable to the Rescue

Thing is, not all installation can rely on the NVRAM—for example a live-USB. When plugging in a live-USB the UEFI needs to be able to boot from it even though it has never seen it before. That's what the fallback bootloader path (EFI/boot/bootx64.efi) is for. The UEFI doesn't just look in it's NVRAM for bootloaders but also checks that path on all attached drives.

So let's do that instead:

grub-install --removable /dev/sdX
grub-update

And after a reboot we're greeted with the GRUB2 shell. Whoho! Progress! The GRUB2 shell is nice, but we need more. Apparently GRUB2 is missing something so let's again check with the live-USB. Reboot, chroot and run:

apt-get install grub-efi-amd64

So the installation was interrupted—makes sense I did disconnect the battery. Let's fix that:

# from: https://askubuntu.com/questions/425502/how-do-i-continue-configuration-if-apt-get-was-interrupted
apt-get clean
apt-get -f install
dpkg-reconfigure -a

Now GRUB2 installs correctly and appears to remember my wish to use --removable. Reboot and we actually boot into the new Debian installation. We just can't login yet because there's something missing still.

Finishing the Installation

As we interrupted the Debian installer there's one step left to do, the "Finish the installation" step. It appears the user is created by this step so skipping it leaves us without a user to login with. Fix that with:

useradd my_user
useradd sudo my_user
useradd netdev my_user

I also had to set the network to managed and remove the live-USB package repository from /etc/apt/sources.list.

If I had to do this again, I'd use the expert install mode and simply skip the automated GRUB2 installation step. That should allow me to run the original "Finish the installation" step before installing GRUB2 manually.

PS: The cheapo laptop was an Acer Aspire es 17 (aspire es1-732).

Similar Articles


Real-Time Linux on RISC-V

27th June, 2025 8min


Setting up Linux v6.12 on a StarFive VisionFive 2 with PREEMPT_RT. Also: How to setup your Linux laptop as a simple NAT router.

Installing Gentoo To My Liking

26th April, 2022 13min


Gentoo is a Linux distribution that offers as many options as possible. This article leads you through the decisions I took to end up with a system that best suits my needs.

Automatic Firmware Generation for Spaceflight Hardware based on Schematics

16th February, 2026 119min


Any satellite's Power Conditioning and Distribution Unit (PCDU) fulfills the same purpose, providing the subsystems with electrical power. However, because each satellite has a unique set of subsystems, differing PCDUs must realize differing power distributions. How do you efficiently develop firmware for such similar hardware? One approach is to group components and their PCB layout into a snippet, e.g., an Analog to Digital Converter (ADC) with supportive components. Each PCDU can reuse the same snippets arranged differently to create different power distributions. While this drastically speeds up the hardware design process, previous works failed at translating this speedup to the firmware development process. We propose the Group Netlist, a novel representation of the logical functions of hardware. This machine-readable file format enables automatic firmware generation while remaining agnostic to both programming-language and schematics editor. The electrical engineer annotates the schematics to produce not just the PCB layout but also the Group Netlist. Contrary to initial expectations, we show that the Group Netlist has uses beyond firmware generation. This includes but is not limited to harness specification and snippet based design analysis. We provide the reference implementation kicad_firmware_generation as a ready-to-use product for different projects even outside space-exploration.

Real-Time Application Development on Linux with PREEMPT RT

29th September, 2025 34min


While Linux is optimized for throughput and efficiency, real-time applications require bounded worst case latencies. However, with the merging of PREEMPT RT, mainline Linux converts to a real-time operating system (RTOS). Through presenting the application developer’s perspective and the changes PREEMPT RT introduces to the kernel, we review Linux’ real-time capabilities. Additionally, we investigate dynamic worst case execution time (WCET) analysis using a StarFive VisionFive 2 as a case study. Finally, we compare Linux to other RTOSes and argue that the lack of static WCET analysis is Linux’ main drawback for real-time applications.

All Articles