Fedora/GRUB disappeared from dual boot after Windows 11 update

From this list, I would say that /dev/nvme0n1p1 is your ESP (EFI System Partition, which exists on GPT formated drives) and /dev/nvme0n1p5 is a BTRFS volume, which most likely has a number of subvolumes, including for your /, possibly /home and others that are automatically created in /var. (AFAIK, Fedora does not create a separate /boot anymore since GRUB2 can find everything it needs in a BTRFS subvolume. So, your /boot is probably just a regular directory in your / BTRFS subvolume.) In any case, this should all be pretty irrelevant since this was caused by a Windows update, which usually just messes up the boot entries in your UEFI. In particular, it should not touch any binary in \ESP\fedora\.

Looking at your first post, you wrote that there is a Fedora entry in your UEFI but that selecting it boots Windows. In your next post you wrote that “Fedora doesn’t appear in the boot order list”. Which one is it, do you have a UEFI entry for Fedora or not?
From your third post, with the output of efibootmgr -v, I would believe that you actually have a Fedora entry. The \EFI\fedora\shimx64.efi path that you mention there references the ESP. At this point, I would suggest that you check the ESP and make sure that it actually contains these binaries. You can use a slight variation of the commands that @josevillani suggested to do that from a live system:

$ sudo mkdir /mnt/efi
$ sudo mount /dev/nvme0n1p1 /mnt/efi
$ sudo ls -la /mnt/efi
$ sudo ls -la /mnt/efi/EFI/fedora

The last one should show you shimx64.efi and grubx64.efi (assuming that you are on a x86-64 system); shim is used for Secure Boot support, it is signed by Microsoft and it verifies the signature of the GRUB2 binary before handing over control to it, which then in turn loads the kernel, initramfs, etc.

Let’s see what the situation is and then we can look at the next steps.

I used to dual-boot Linux with Windows 7 and had this happen after every Windows Update. It’s basically the same process:

  1. Use a live image from a USB drive to boot to a live session
  2. Mount your root filesystem from Linux to the Live session
  3. chroot to the mounted volume
  4. Run the grub command to repair the boot loader
  5. Reboot into your Linux system

These steps work but may be overkill. The official Fedora documentation to restore GRUB2 lists multiple steps, with conditional ones depending on things like LUKS or lvm, then bind-mounting /dev, /proc, etc, before finally chrooting. All of this might be intimidating or error-prone for someone new to Linux.
Since the reason for this is usually just the Windows setup making its bootloader the default, I would really try to resolve this with a more targeted approach before breaking out the big guns.

Sorry for the confusion. I hope these pictures better explain what I was trying to say


Booting Fedora from this menu opens Windows instead


This menu does not have Fedora

As for checking ESP, I am met with this when running the commands:

liveuser@localhost-live:~$ sudo mount /dev/nvme0n1p1 /mnt/efi
liveuser@localhost-live:~$ sudo ls -la /mnt/efi
total 10
drwxr-xr-x. 7 root root 1024 Dec 31  1969  .
drwxr-xr-x. 3 root root 4096 Aug  5 19:42  ..
drwxr-xr-x. 2 root root 1024 Aug  3 22:15  dev
drwxr-xr-x. 5 root root 1024 Nov 13  2023  EFI
drwxr-xr-x. 2 root root 1024 Aug  3 22:15  proc
drwxr-xr-x. 2 root root 1024 Aug  3 22:15  sys
drwxr-xr-x. 2 root root 1024 Oct 22  2023 'System Volume Information'
liveuser@localhost-live:~$ sudo ls /mnt/efi
 dev   EFI   proc   sys  'System Volume Information'
liveuser@localhost-live:~$ sudo ls -la /mnt/efi/EFI/fedora
ls: cannot access '/mnt/efi/EFI/fedora': No such file or directory
liveuser@localhost-live:~$ sudo ls /mnt/efi/EFI
Boot  HP  Microsoft

OK, what I get from your pictures and your first posts is that

  1. when selecting the advanced boot options in Windows, it shows an entry “Fedora”, but selecting that boots straight back into Windows
  2. in your UEFI boot menu, there is no entry “Fedora”, but
  3. when running efibootmgr from a live system, there is indeed an entry named “Fedora”, pointing to \EFI\fedora\shimx64.efi.

Is this summary correct? If it is, observations 2 and 3 have me scratching my head. My only explanation for that is that the UEFI implementation does some filtering of the list and removes non-functional entries. Your investigation of the ESP shows that there is no \EFI\fedora, so no shim or GRUB2 binaries either, which leaves the “Fedora” boot entry unable to boot (this is also consistent with the first observation => after booting with advanced settings from your Windows installation, the UEFI does not find the binary for the “Fedora” entry and then proceeds to boot the default one, back into Windows).

To fix the missing \EFI\fedora directory and binaries, I think you actually need to follow Fedora’s documentation. I will adjust the steps to match what we have seen so far, but will keep the same numbering, so you can compare the steps:

  1. Boot a live system. Since you need to download some RPMs towards the end, I suggest you set up networking at this point, too (plug in an Ethernet cable, connect to an access point, open the pidgeon cages, …).
  2. Open a terminal; note: the documentation shows all steps running from a root terminal (indicated by the # in front of the command); I list everything from a user terminal (indicated by $), with sudo prefix. Alternatively, you can elevate your prompt with sudo -i and leave out sudo in the following steps.
  3. Skip, you have already posted the output and my adjustments are based on that.
  4. This step depends on whether you have encrypted your root with LUKS; from what I can tell, you have not, but just for completeness
$ sudo modprobe dm-crypt
$ sudo cryptsetup luksOpen /dev/nvme0n1p5 rootfs
  1. Mount your root partition; if you are using LUKS, replace /dev/nvme0n1p5 with /dev/mapper/rootfs in the second command:
$ sudo mkdir /mnt/fedora
$ sudo mount /dev/nvme0n1p5 /mnt/fedora -o subvol=root
  1. Skip, you have a BTRFS partition, not an LVM one.
  2. Skip, I do not see a separate /boot partition in your lsblk output. However, you might have a separate subvolume for that in your BTRFS volume. Unfortunately, I am not sure about Fedora Workstation’s default BTRFS layout – mine are customized – and the documentation is not helpful, as it talks about a separate ext4 /boot, which you clearly do not have. I am going to assume that your /boot is either a directory in your root subvolume or a nested subvolume underneath your root subvolume and is mounted automatically. To check, see if /mnt/fedora/boot contains any files. If it is empty, we need to mount something there. In this case, pause here and post the output of the second and third command:
$ ls /mnt/fedora/boot
$ cat /mnt/fedora/etc/fstab
$ sudo btrfs subvolume list /mnt/fedora
  1. (Bind) Mount runtime directories from the live system inside your Fedora rootfs:
$ sudo mount -o bind /dev /mnt/fedora/dev
$ sudo mount -o bind /proc /mnt/fedora/proc
$ sudo mount -o bind /sys /mnt/fedora/sys
$ sudo mount -o bind /run /mnt/fedora/run
  1. Some more mount points for UEFI systems:
$ sudo mount -o bind /sys/firmware/efi/efivars /mnt/fedora/sys/firmware/efi/efivars
$ sudo mount /dev/nvme0n1p1 /mnt/fedora/boot/efi
  1. Almost there, let’s chroot (change root) into the system on your internal drive (because of the sudo command here, the resulting shell has root privileges and I will leave out sudo in the following steps):
$ sudo chroot /mnt/fedora
  1. Reinstall GRUB2 and shim (in fact, because we are now inside the system on your disk, anything special about your config – like which partition is your rootfs – is now transparent and all the remaining steps are exactly the same as the ones in the official documentation):
# dnf reinstall shim-\* grub2-efi-\* grub2-common
  1. Regenerate the config file:
# grub2-mkconfig -o /boot/grub2/grub.cfg
  1. Write everything to disk, take one last look at your ESP to make sure you now have /EFI/fedora and the binaries inside, and leave the chroot environment:
# sync
# ls -la /boot/efi/EFI/fedora
# exit
  1. Reboot and keep your fingers crossed.
1 Like

I think it more likely that Windows installs a backup or default list after encountering some error.

I have strangely had the boot order changing twice now without having booted into Windows prior. So either something in Fedora triggered it or the EFI bios decided to do it on it’s own. It’s pretty strange, i’m not sure how to debug something like that…

I have seen UEFI implementations that automatically add boot entries for the Windows bootloader.

But the point I was trying to make is that Windows shows a “Fedora” entry, efibootmgr shows a “Fedora” entry, but the UEFI boot menu does not show that entry. And my only explanation is that the UEFI performs some basic sanity checks on the entries, such as “Is the binary this entry references even available? No. OK, no point showing it then.”

I would probably start by recording the output of efibootmgr and then compare the recorded state to the latest one if/when it happens again. This will show you if it is only the boot order changing or if an entry is removed and a new one created.

There could be another ESP file system that has the Fedora loader and shim installed. lsblk -fp did show two VFAT file systems if approximately the size a ESP would have.

The efibootmgr also shows the partition UUID, which can be matched with the output of lsblk -o NAME,PARTUUID. The partition UUID is not the same as the file system UUID. The latter is what you find in grub.cfg and /etc/fstab.

You can see both partition and file system UUIDs when using lsblk -f

I see no partition UUID, only the file system UUID

[vek@newbox ~]$ lsblk -f
NAME        FSTYPE FSVER LABEL    UUID                                 FSAVAIL FSUSE% MOUNTPOINTS
loop0                                                                        0   100% /var/lib/snapd/snap/core/17200
zram0                                                                                 [SWAP]
nvme0n1                                                                               
├─nvme0n1p1 vfat   FAT32 efiboot  3056-3376                                 2G     0% /boot/efi
├─nvme0n1p2 ext4   1.0   homedisk 2ceb9488-262e-490b-91d9-f9bc93e6275c    180G    38% /home
├─nvme0n1p3 ext4   1.0   rootdisk 56a83e29-1e98-44f6-a33e-8988906ef2a1   47,2G    60% /
└─nvme0n1p4 swap   1     swapdisk 96621d97-5b40-497f-b0ce-d09430076c0c                [SWAP]
[vek@newbox ~]$ 

Unfortunately this didn’t work :frowning:
There were no errors when I ran the commands (I changed /mnt/sys/firmware/efi/efivars to /mnt/fedora/sys/firmware/efi/efivars in step 9). After reboot, computer still opens windows, still no working fedora entries in the boot menus. I am at a loss to what could be causing this

I am pretty sure that you can have only one EFI System Partition on a single disk. You could have a “Linux extended boot” partition (XBOOTLDR) but, first, that is not the same as an ESP and, second, I would consider this an advanced configuration, which shouldn’t be created automatically without the OP knowing about it and mentioning it.

What was the final state of your <ESP>\EFI\fedora directory? And can you please post the output of efibootmgr?

Oh, and I made a few assumptions about your system and partition layout, can you also please post the contents of your /etc/fstab?

Good catch. I fixed that in the original post, just in case somebody else finds it and uses it in the future.

The specs is not entirely clear on that, and some say that the boot loaders don’t need to be installed in an ESP file system, as long as it is installed in a (V)FAT file system and a corresponding boot entry is stored in the UEFI non-volatile memory.

Then you have quite a few different implementations of UEFI and some may tolerate multi ESP partitions on one disk and some may not. Apart from that, Windows as well as Linux systems may get confused with two ESPs and that could be the cause of the problem in the first place.

Only the output of lsblk -o NAME,PARTTYPENAME,PARTUUID from the system with the problem can tell you what you do have or don’t have. Also the output from efibootmgr can help with that. Without that, it is anyone’s guess what is going on.

Also, the contents of both nvme0n1p1 and nvme0n1p4 should be checked.

1 Like

True, there is no explicit statement that any disk can only contain a single ESP. But since it also does not define behavior for when there are more than one, I would consider having more than one on a disk a really bad idea™. But yeah, ultimately it’s all just bits and bytes and there is nothing stopping you from adding the ESP GUID to other, random partitions, even to ones that aren’t VFAT.

This comes back to the spec not defining behavior for multiple ESPs, which is why none of the mainstream tooling I know would do that for you (things like a Windows installer or any of the Linux distros). Something like parted can probably do it but I doubt this would happen by accident.

After the recovery steps, I expect nvme0n1p1 to contain both shim and GRUB2 binaries in EFI\fedora. But yes, we have not seen exactly which partition the existing “Fedora” boot entry references. And taking a look at the contents of nvm0n1p4 (and also fstab to see if and how it is used in Fedora) will provide more information.

Have you tried this? So far it still helped me in similar cases. Rescatux

Thanks, already suggested. OP wasn’t able to boot it. Probably due to extra steps to install to USB key. It’s designed IIRC to be installed on a CD.

Here are the contents you requested:

I am not sure why there is an Ubuntu entry. At one point I had a dual boot Windows/Ubuntu, but I switched to Fedora. Maybe it wasn’t properly deleted