Tomi Chen

Repairing the NixOS Bootloader after BIOS/Windows Updates

By Tomi Chen December 23, 2025

I’ve been using NixOS as my main OS for nearly 3 years now, but I still dual-boot Windows for work and some software compatibility. After a Windows update overwrote my Linux bootloader and a recent BIOS update did it again, I decided to write down the steps I took to fix the issue for future reference. Your mileage may vary depending on the specifics of what happened, but here are the general steps.

Creating a Live USB

The first step is to create a NixOS live USB to boot into an environment with the correct tools. You can download the latest ISO image from the NixOS website. I selected the “Minimal” image since it’s smaller (~1.5 GB). Use a tool like Ether or USBImager to write the ISO to a USB stick.

Booting from the Live USB

Insert the USB stick into your computer and boot from it. You may need to change the boot order in your BIOS/UEFI settings. On my laptop, you get there by spamming F2 during startup.

Once you launch the installer, you should be dropped into a terminal.

Check partition layout

Identify your main disk under the /dev directory. Then check the partition layout to make sure things look correct:

sudo fdisk -l /dev/nvme0n1   # or /dev/sda, etc.

Identify the NixOS root partition and the EFI boot partition. It’ll probably be something like /dev/nvme0n1p3 for root and /dev/nvme0n1p1 for EFI, but double check to be sure.

Mount partitions

If you have full-disk encryption with LUKS, unlock the encrypted partition first:

sudo cryptsetup luksOpen /dev/<whatever-partition> tmp-root

Then mount the NixOS root partition:

sudo mount /dev/mapper/tmp-root /mnt

Mount the EFI partition:

sudo mount /dev/<whatever-efi-partition> /mnt/boot

Enter the system and reinstall the bootloader

See the NixOS wiki for more info.

sudo nixos-enter
NIXOS_INSTALL_BOOTLOADER=1 /nix/var/nix/profiles/system/bin/switch-to-configuration boot

Reboot

Hopefully that worked and you can now reboot/modify boot order if necessary/profit!

Troubleshooting

If for whatever reason the partitions don’t look correct or cannot be mounted, you may need to try some repair steps. This forum post has some info.

If fdisk reports a broken GPT table, it may need repairing: Run sudo gdisk /dev/nvme0n1, then use r for the recovery menu, b to rebuild the GPT table from the backup, and w to write and exit.

PREV POST