Help Restoring Bootloader using Live ISO for Dual Boot System

I had successfully set up a dual boot system of Windows 10 and Fedora following this tutorial. However, when messing with the GRUB config in an attempt to set it to boot whichever OS I last used, I somehow caused Fedora to disappear in GRUB, meaning I can now only boot to Windows.

I attempted to follow this guide to try and reinstall GRUB through a Live ISO, but am stuck at the step where it says:

  1. Mount the /boot partition (e.g. /dev/sda2).

I setup Fedora by following the first tutorial, which instructed me to create three partitions: /boot/efi, /root, and swap. I could be missing something, but none of these appear to be the /boot partition that the guide is instructing me to mount. What should I do here?

(I’m new to Linux/Fedora so please bear with me if I struggle to explain something, thanks!)

Since you didn’t create a separate boot partition, you can skip that step. As long as the kernel files are present under /mnt/boot, the remaining steps should work. You can use the command ls /mnt/boot to verify that the system files are present there. If, however, that directory appears to be empty, then you will need to figure out what partition contains the required files and mount it there.

Note that there is a problem with the tutorial you linked in that it is recommending the creation of another EFI system partition on a drive that already has one. That isn’t allowed according to the spec and it may lead to unexpected problems (You can have multiple EFI system partitions on the same disk. The Windows instal... | Hacker News).

Ideally, all operating systems would share the same ESP. Unfortunately, Microsoft has been unkind and made the default size for the ESP just large enough to contain their operating system’s boot loader and no others. Consequently, to “correctly” configure a dual boot system with MS Windows, you would either have to delete the small ESP created by Microsoft and create a whole new one of adequate size elsewhere on the drive and restore the Microsoft bootloader files (extremely difficult unless you really know what you are doing) or you need to install a friendly Linux OS first so that the size of the ESP at the start of the disk will be adequate for subsequent operating system installations (be they MS Windows or otherwise).

1 Like

I tried skipping step 3 per your advice as was able to get through all the steps. However, when running grub2-mkconfig -o /boot/grub2/grub.cfg, it was only able to find the Windows Boot Manager (output below):

root@localhost-live /]# sudo grub2-mkconfig -o /boot/grub2/grub.cfgv
Generating grub configuration file ...
Found Windows Boot Manager on /dev/nvme0n1p1@/efi/Microsoft/Boot/bootmgfw.efi
Adding boot menu entry for UEFI Firmware Settings ...

Likewise, after rebooting only Windows shows up in GRUB.

In regards to your second point, every tutorial I see seems to suggest that I should install Windows first and then Linux? I’m a little confused if I should be doing that the other way around. Thanks again!

Likely, the reason that GRUB is only seeing the MS Windows boot manager is because it is only looking for one ESP (again, per the spec) and it is stopping after it finds the first one on the drive (which happens to be the small ESP that was created by MS Windows). I don’t know how to “force” GRUB to see the other ESP. And if it did, then it would only see the files on that ESP (the ones for Fedora Linux) and you wouldn’t see MS Windows in your GRUB boot menu.

I haven’t done a dual boot setup with MS Windows in a long time, so I don’t know what the complications would be if you installed Linux first. I’m guessing that the tutorials demo it that way because Microsoft has deals with most vendors to pre-install MS Windows on the PCs and re-installing MS Windows isn’t what most users want to do.

If it were me, I would attempt to transfer the MS Windows boot files from the first ESP to the second, larger one and then delete the first ESP. But that is extremely risky and I don’t know if it would even work. At the very least, you’d have to be ready to go into your system’s BIOS, delete the references to the EFI binaries on the former ESP and re-create pointers to the same binaries on the new ESP.

Sorry that this is so complicated, but the problem has been created by Microsoft (presumably by design). There isn’t much we can do about it.

Thanks for the advice! Hopefully I don’t need to touch the Windows boot files since I’m not confident enough that I won’t break something.

This is the part that intrigues me. While I understand the reasoning, earlier I successfully had both Windows and Fedora in my GRUB menu, and was able to boot to either. However, after messing with the GRUB config files (and obviously breaking something), os-prober is only able to see my Windows installation. If anyone has any ideas on how to get os-prober to detect Fedora again that would be great.

(Once again very little experience so not sure if the following is important/useful)

Running efibootmgr returns the following:

[root@localhost-live /]# efibootmgr
BootCurrent: 0007
Timeout: 0 seconds
BootOrder: 0002,0005,0001,0000,0003,0006,0007
Boot0000* Windows Boot Manager  HD(1,GPT,bc627d47-6177-4579-9b00-c519f3f31a16,0x800,0x32000)/File(\EFI\Microsoft\Boot\bootmgfw.efi)57494e444f5753000100000088000000780000004200430044004f0042004a004500430054003d007b00390064006500610038003600320063002d0035006300640064002d0034006500370030002d0061006300630031002d006600330032006200330034003400640034003700390035007d0000002e000100000010000000040000007fff0400
Boot0001* ubuntu        HD(1,GPT,bc627d47-6177-4579-9b00-c519f3f31a16,0x800,0x32000)/File(\EFI\ubuntu\shimx64.efi)
Boot0002* Fedora        HD(6,GPT,f4f44b0a-284a-4b50-aa8c-00e657308d64,0xb7fc2800,0x200000)/File(\EFI\fedora\shimx64.efi)
Boot0003* Internal Hard Disk    PciRoot(0x0)/Pci(0x2,0x4)/Pci(0x0,0x0)/NVMe(0x1,AC-E4-2E-00-26-6A-2D-5A)/HD(1,GPT,bc627d47-6177-4579-9b00-c519f3f31a16,0x800,0x32000)0000424f
Boot0005* Fedora        HD(6,GPT,f4f44b0a-284a-4b50-aa8c-00e657308d64,0xb7fc2800,0x200000)/File(\EFI\fedora\shimx64.efi)
Boot0006* Internal Hard Disk    PciRoot(0x0)/Pci(0x2,0x4)/Pci(0x0,0x0)/NVMe(0x1,AC-E4-2E-00-26-6A-2D-5A)/HD(6,GPT,f4f44b0a-284a-4b50-aa8c-00e657308d64,0xb7fc2800,0x200000)0000424f
Boot0007* USB Drive (UEFI) - SanDisk    PciRoot(0x0)/Pci(0x8,0x1)/Pci(0x0,0x4)/USB(5,0)/USB(2,0)/HD(2,MBR,0xc3579629,0x1d25e00,0x10000)0000424f

Likewise, through my BIOS boot menu I am able to see two instances of Fedora (presumably two different kernals?), however, trying to boot either of them puts me into GRUB, in which the only option is once again Windows.

Those two entries appear to be completely redundant. They both point to the same EFI binary (\EFI\fedora\shimx64.efi) on the same partition (f4f44b0a-284a-4b50-aa8c-00e657308d64).

I believe os-prober is only for detecting “third-party” operating systems. The scripts under /etc/grub.d are responsible for setting up the other menu entries. If you can make sense of them, you might be able to figure out what is going wrong. Unfortunately, they are very complex.

BTW, the target file is incorrect in your above excerpt (it should be grub.cfg, not grub.cfgv). Also, are you sure it isn’t adding entries for the local OS? It’s been so long since I used GRUB I’m not sure if it lists everything it adds to the config file when it runs. You can look at the generated config file with less /boot/grub2/grub.cfg right after you run grub2-mkconfig to see if it shows any “menuentry” sections for the current OS.

Edit: Use the q key to quit the “less” command when you are done viewing the file.

One should be able to boot fedora by setting the boot order using efibootmgr and putting it as
efibootmgr -o 0002,0005,0001

It would appear that the fedora efi partition is #6 and the windows/ubuntu efi partition is #1.

Since it appears you have both fedora and ubuntu installed (or in the past had ubuntu installed) that may cause additional problems in the future.

He said he selected them manually via the BIOS menu and neither worked:

For simplicity and reliability those tutorials are correct. Windows does not like installing on a drive that already contains an OS and will always mess with the ability to boot if installed second.

That is normal. The Fedora entries are no longer stored in the grub.cfg file but in files found in /boot/loader/entries. That is unique to the Fedora version of grub.

The grub-customizer can be buggy and could have messed up your grub configuration. As a side note, I have seen that although grub-customizer seems to come from Ubuntu originally, Ubunto no longer provides it.

Thanks everyone for their suggestions and advice!

I ended up messing around with things a little more and all of a sudden Fedora has reappeared in GRUB! Although I’m not too sure what was 100% responsible for the fix, my guess is that removing the GRUB config files before reinstalling was the reason (as described here).

Ultimately, I still ended up reinstalling Fedora as the tutorial I originally followed did not instruct to create a /boot partition which Fedora seems to suggest is recommended, as although it would boot, an error of sparse file not allowed would be returned. A reinstall using Fedora’s automatic partitions seemed to do the trick.

When manually partitioning and using btrfs for the root partition it seems the extra /boot is required. The automatic install creates that as ext4 since the boot loader can read that but does not easily access a btrfs file system to load the kernel. BTRFS is a sparse file system as you have noted.