Qubes Drive Not Bootable after removal / reinsertion

I have a Qubes installation which I’ve been using on my laptop for almost a couple of years now with pretty much no issues. Recently I needed to swap out the drive temporarily which I replaced with a drive running Ubuntu 22.04. After, I took out the Ubuntu drive and put my Qubes drive back in. Now the machine won’t recognize the drive as bootable. It can detect the drive (on the main BIOS screen, it lists the exact model as occupying the slot) but it won’t see it as bootable. I’ve thought maybe it’s the MBR (but that seems unlikely), or it’s just something with the BIOS / UEFI (boot mode is UEFI, no legacy). I don’t want to fiddle with the Qubes drive too much in case of messing something up. I tried booting again with the Ubuntu drive and it works fine. Wondering what the heck happened. I’d welcome any help or suggestions. Thanks.

It could be a missing EFI Boot entry. Can you boot from an USB drive check the output from

fdisk -l /dev/sda
fdisk -l /dev/sdb
fdisk -l /dev/nvme0n1


– one of those is probably the USB stick … but the other could be your Qubes OS drive. If one of your drives looks like:

Device           Start       End   Sectors   Size Type
/dev/nvme0n1p1    2048   1230847   1228800   600M EFI System
/dev/nvme0n1p2 1230848   3327999   2097152     1G Linux filesystem
/dev/nvme0n1p3 3328000 976773119 973445120 464.2G Linux filesystem

and you and do:

mount /dev/nvme0n1p1 /mnt/
ls /mnt/EFI/qubes/grubx64.efi

then you should be able to add an EFI boot entry with:

efibootmgr -c -d /dev/nvme0n1 -p 1 -L "QUBES" -l '\EFI\qubes\grubx64.efi'

The output of fdisk -l /dev/nvme0n1 is exactly as it is in your post. Is the partition EFI System not a boot sector?

I’m keen to add a boot entry but what I don’t understand is how the boot sector would have been deleted, if that is the case. How would removing the drive and reinserting it affect the boot sector? It booted just fine for months on end and then all of sudden stopped working after the swap.

Also, I don’t think it really matters, but Ubuntu did notify me about available firmware updates. Wondering if could have something to do with why the BIOS won’t recognize the drive but I don’t know that much about that stuff.

I don’t think the boot sector has been deleted (since it’s on the drive that you removed) – I believe the EFI entry has been deleted from the BIOS – I’ve seen this happen on my laptop. I think the computer boots and notice the missing drive/EFI Entry and then removes the entry from the menu.

To add it back to the BIOS/UEFI, you should be able to do:

efibootmgr -c -d /dev/nvme0n1 -p 1 -L "QUBES" -l '\EFI\qubes\grubx64.efi'

from the USB stick.

That worked! Added that EFI entry, unmounted and it booted up just fine after. Thank you!