Fixing my broken boot configuration

16.6.2025

I have set up my computer with grub to choose between Linux and Windows at startup. These days this usually works fine, but recently stopped working. I got some error messages and then Windows booted without giving me a choice.

I learned that I am using the EFI boot system (which means having a special partition on the hard disk where each operating system can place a folder to define how it can be booted). I figured out how to mount that partition in Windows, but only to discover that the ubuntu folder had disappeared. I was not able to recreate the folder from Windows.

I booted an Ubuntu image from a USB stick, choosing to "explore" Linux, rather than install it. I was able to find the partition with my Linux installation, which seemed to still be alright. I tried various calls to grub to try to get it to install a new EFI folder, but without success. Finally, I found this question on askubuntu.com, which explains how to rebind the devices (and other system functionality mapped into the filesystem) and then chroot into your partition. With my SSD, the device name is nvme0n1, and my Linux happens to be on partition 7, hence the p1 suffix:

mount /dev/nvme0n1p7 /mnt
mount --rbind /dev  /mnt/dev
mount --rbind /proc /mnt/proc
mount --rbind /sys  /mnt/sys
chroot /mnt bash
grub-install /dev/nvme0n1

chroot makes it so that grub-install is using all the information from my regular installation, and the --rbind instructions make it so that the devices are still available after chroot.

I still don't know why the EFI folder disappeared in the first place. But at least I can boot into Linux again.

linux