Can't boot to Fedora 38 after install Ubuntu

My laptop shipped with Windows 11.
I installed Fedora 38 (brtfs).
I installed Ubuntu 23.04 (ext4).
Now my pc boot with Ubuntu GRUB menu and there is no Fedora entry.
This is the output of fdisk:

sudo fdisk -l
/dev/nvme0n1p1 2048 534527 532480 260M EFI System
/dev/nvme0n1p2 534528 567295 32768 16M Microsoft reserved
/dev/nvme0n1p3 567296 753174527 752607232 358.9G Microsoft basic data
/dev/nvme0n1p4 753174528 754442239 1267712 619M Windows recovery environmen
/dev/nvme0n1p5 754442240 756539391 2097152 1G Linux filesystem
/dev/nvme0n1p6 756539392 817979391 61440000 29.3G Linux filesystem
/dev/nvme0n1p7 817979392 1000212479 182233088 86.9G Linux filesystem

I found out that:

  • Ubuntu’s GRUB is installed in /dev/nvme0n1p7/boot/grub (same device with Ubuntu)
  • Fedora’s GRUB is installed in /dev/nvme0n1p5/grub2 and Fedora is in /dev/nvme0n1p6/root

What I have tried:

  • Enabled OS-prober
  • sudo update-grub
  • Run boot-repair on Ubuntu
  • Manually add Fedora entry in /etc/grub.d/40_custom. If I choose this custom entry, my PC shows Fedora’s GRUB menu, but there is only option to boot to Windows in this menu.

Please help.

It seems that ubuntu’s grub overwrote fedora grub and does not see fedora for booting.

It may be necessary to boot to a live fedora media and mount the fedora partitions (probably btrfs on /dev/nvmeon1p6) with /boot as ext4 on p5 and /boot/efi on p1

Once everything is properly mounted then one would chroot into the fedora file system and reconfigure grub to boot fedora.

This is often a problem seen when installing multiple linux distros since the last one installed tends to take over grub for booting

Thanks for your reply.
Do you have any suggestion for the reconfigure grub procedure?
The best result for me will be Fedora showed up in Ubuntu’s grub menu.

Maybe you just need to re-enable OS prober, which by default is disabled on newer Ubuntu installs.

I enabled OS prober before.

OK so I boot into live fedora, mount all:

  • root btrfs on p6 to /mnt
  • boot on p5 to /mnt/boot
  • sys | proc | dev | run to /mnt/…
    Then chroot to /mnt and run:

grub2-mkconfig -o /boot/grub2/grub.cfg

Reboot. This is what happen:

  • Ubuntu grub menu showed up
  • I chose the Fedora custom entry I create using /etc/grub.d/40_custom
  • Fedora grub menu showed up, I noticed the Ubuntu entry added here (before there was only Windows 11 entry) but still no Fedora entry

You missed mounting the fedora /boot/efi in that list (which probably should be /dev/nvme0n1p1 and identified by its UUID in /etc/fstab). Thus the grub update did not properly configure the boot.

Also, one must confirm that /boot/efi is properly identified in /etc/fstab and that the proper efi partition is being used for boot.
If you enter the uefi setup screen which partition is shown as booting in the boot order list there.?
Also, what is the output of efibootmgr?

Sorry my bad, I did mount the efi partition to /mnt/boot/efi too but I forgot to type it. But to make it sure I just did it again. This is all the step:

sudo mount -t btrfs -o subvol=root,compress=zstd:1 UUID=5d0ed25f-9df2-4575-bb37-a474cb3ae3d3 /mnt
sudo mount /dev/nvme1n1p5 /mnt/boot
sudo mount /dev/nvme1n1p1 /mnt/boot/efi
sudo mount --bind /dev /mnt/dev
sudo mount --bind /sys /mnt/sys
sudo mount --bind /run /mnt/run
sudo mount --bind /proc /mnt/proc
sudo chroot /mnt
grub2-mkconfig -o /boot/grub2/grub.cfg

And the output:

Generating grub configuration file …
Found Windows Boot Manager on /dev/nvme1n1p1@/EFI/Microsoft/Boot/bootmgfw.efi
Found Ubuntu 23.04 (23.04) on /dev/nvme1n1p7
Adding boot menu entry for UEFI Firmware Settings …

Here is my Fedora /etc/fstab:

UUID=5d0ed25f-9df2-4575-bb37-a474cb3ae3d3 / btrfs subvol=root,compress=zstd:1 0 0
UUID=a5a3d49b-9b4e-47f7-8358-6bfb62b08370 /boot ext4 defaults 1 2
UUID=14E2-C3EA /boot/efi vfat umask=0077,shortname=winnt 0 2
UUID=5d0ed25f-9df2-4575-bb37-a474cb3ae3d3 /home btrfs subvol=home,compress=zstd:1 0 0

Fedora efibootmgr output:

EFI variables are not supported on this system.

Here is my Ubuntu /etc/fstab:

/dev/disk/by-uuid/67da00db-cb80-4718-b8bd-bdbd42534994 / ext4 defaults 0 1
/swap.img none swap sw 0 0
UUID=14E2-C3EA /boot/efi vfat defaults 0 1

Ubuntu efibootmgr output:

BootCurrent: 0000
Timeout: 0 seconds
BootOrder: 0000,0001,9999,0002
Boot0000* ubuntu
Boot0001* Windows Boot Manager
Boot0002* Internal Hard Disk
Boot9999* USB Drive (UEFI)

There are Ubuntu, Windows, Boot from EFI in the bios boot menu.

I do not understand why fedora would give that error for efibootmgr when the fstab shows an efi partition the same as ubuntu uses. It would appear this may be the underlying cause of fedora not being seen by grub.

Your output from grub2-mkconfig seems exactly what would be expected and as long as the bios can select the proper entry for grub it should work.

Ubuntu grub seems to have a problem booting fedora in several posts here, but fedora seems to not have problems with booting ubuntu once the system is set up properly and only uses the fedora grub.

One fix, though it seems extreme, may be to do a dnf reinstall grub2* shim* kernel* while booted into the chroot environment you show above. It would seem that one needs to get the bios to recognize fedora grub again.

I tried it but nothing changed. There is no Fedora entry in both Ubuntu and Fedora grub.
I tried grub2-mkconfig again but nothing changed too.
I just noticed there are a lot of warning when reinstall grub2 shim & kernel.
Here is the output log

This usually means that this OS has not been booted in UEFI mode. To reduce confusion, it might be a good idea to disable the CSM mode, that is, disable the ability to boot in non-UEFI mode.

OK so this is where the problem come from. the /sys/firmware/efi/efivars was not mounted.
This time I tried mount the /dev and /sys using –rbind instead of -bind:

sudo mount --rbind /sys /mnt/sys
sudo mount --rbind /dev /mnt/dev

Then run in chroot

efibootmgr --create --disk=/dev/nvme0n1 --part=1 --label=“Fedora” --loader=‘EFI/fedora/shimx64.efi’
grub2-mkconfig -o /boot/grub2/grub.cfg

And it’s worked ! Fedora is at least showed up in UEFI boot menu.

Strange. I have never needed to use rbind, but glad to know a solution was found…


OK I noticed something very weird. My pc has two Fedora grub menu.
If I access the grub from shimx64.efi it showed everything (Fedora entries, Ubuntu entries, Windows entry).
Once I’m inside Fedora, I ran grub customizer and all the Fedora entries disappeared:

This image describes exactly the Fedora grub menu if I access it through my Fedora custom entry on Ubuntu Grub.

This is what I added in Ubuntu’s /etc/grub.d/40_custom:

menuentry “Fedora GRUB” {
search --no-floppy --fs-uuid --set=dev a5a3d49b-9b4e-47f7-8358-6bfb62b08370 # fedora /boot
set prefix=($dev)/grub2
export $prefix
configfile $prefix/grub.cfg

Do you have any idea what is going on?

If I may make a guess, grub from Ubuntu does not understand the bls snippets you will find in Fedora’s grub. Otherwise, the added snippet looks fine to me. It is likely you can only multi-boot Fedora and Ubuntu by first loading Fedora’s grub2, and from there refer to the Ubuntu grub.cfg.

But the grub-customizer inside Fedora doesn’t show Fedora entries. Why’s that?

Is grub-customize a package from fedora? I don’t seem to find it or similar.
If it is from a 3rd party then it may not function within fedora as one might expect.

Correction: I found it as grub-customizer.
On my dual boot F38 system I see this:

Hmmm OK so my situation is normal :slight_smile:
Somehow I feel like the /boot/grub2/grub.cfg loads only other OS entries as default.

EDIT: ok I found the answer. So it’s all about the BLS option.

When BLS support is enabled (GRUB_ENABLE_BLSCFG=true), GRUB will read the BLS entries and configuration files to generate the GRUB menu. This allows for easier management of multiple kernel and initramfs images, including options like fallback images and kernel parameters defined in BLS.
On the other hand, when BLS support is disabled (GRUB_ENABLE_BLSCFG=false), GRUB will not consider BLS entries and will use the traditional configuration files (such as /etc/default/grub and /etc/grub.d/*) to generate the GRUB menu.

May I just ask, what is the output of your sudo os-prober ?