How to multiboot Fedora using existing GRUB2 bootloader?

I want to install Fedora alongside my existing operating systems, but without overwriting the current GRUB. At the moment I have

  • Windows 10
  • Manjaro KDE (installed after Windows 10)

and am using the GRUB that was installed by Manjaro. I have read this topic that suggests preventing Fedora from installing grub from the installation media. I have done this and installed Fedora. When running update-grub from Manjaro, os-prober detects Fedora but it is never added as an entry to the grub.cfg. I haven’t yet been able to boot Fedora. Is there a better way to achieve this multiboot setup (with Manjaro as the main OS controlling GRUB), can I manually add Fedora to the grub config, or is it only possible to have Fedora control the bootloader?

I am trying to install the Fedora 36 beta but I don’t think this is specific to beta and should apply to 35, etc.

I’ve just published this

that describes how to setup a multiboot with grub (in particular, Fedora, being able to boot also Kubuntu and EndeavourOS). It also describes the source of the problem you experience.

Hope this helps :slight_smile:

3 Likes

Thanks a lot for making this post, it answered a lot of the questions I had. I’ve read a few of your posts in the past and they’ve been very helpful (touchpad gestures specifically), so thank you very much for that too.

To make the following more clear, this is my disk layout:

Total    240G
hd0,gpt1 100M   EFI System
hd0,gpt2 16M    Windows reserved
hd0,gpt3 120G   Microsoft basic data
hd0,gpt5 66.71G Manjaro root
hd0,gpt6 1G     Fedora boot
hd0,gpt7 30.25G Fedora root
hd0,gpt4 508M   Microsoft recovery

Also, I’m using UUIDs to specify partitions. This is how I’m refering to them:

FEDORA_BOOT   - the ext4 boot partition created by Fedora.
FEDORA_ROOTFS - brtfs partiton root partition created by Fedora.

The main thing that makes this situation difficult is that Fedora can’t boot Manjaro without using Manjaro’s grub and Manjaro doesn’t create an entry for Fedora, even though os-prober detects it. This topic has a similar situation, but os-prober in Manjaro does not detect Fedora, so os-prober doesn’t seem reliable. I’m trying to solve Manjaro → Fedora but I’ll come back to Fedora → Manjaro later.

Before you posted, I tried botching together a boot stanza that directly loads the Fedora kernel, but it fails.

# DOESN'T WORK
menuentry "Fedora Workstation Live 36 Beta" {
    search --set=root --fs-uuid FEDORA_BOOT
    linux /vmlinuz-5.17.0-0.rc7.116.fc36.x86_64 root=UUID=FEDORA_BOOT rw
    initrd /initramfs-5.17.0-0.rc7.116.fc36.x86_64.img
}

Grub doesn’t mount or form any association from the fstab so FEDORA_ROOTFS can’t be used to access /boot. Using FEDORA_BOOT, the kernel loads but crashes with initrd-switch-root.service failed.

After you posted, I tried what you suggested and changed my 40_custom to load the Fedora grub.cfg.

menuentry "Fedora Workstation Live 36 Beta" {
    insmod part_gpt
    insmod btrfs
    insmod ext2
    rmmod tpm
    search --set=root --fs-uuid FEDORA_BOOT
    configfile /grub2/grub.cfg
}

It loads the menu entries from the Fedora config but for some reason there’s no entry for Fedora, only for Manjaro and Windows. When I select Manjaro it just freezes on a black screen.

I’m confused about how grub works when the boot partition for other OSes is separate because everything I’ve read seems to suggest that it’s a good idea for it to be so, but the documentation for grub2 multibooting, which even itself says to create a seperate partition for grub, seems to assume that the boot folders for other OSes are on their respective main partitions.

I reinstalled Fedora with the bootloader option enabled and after a reboot my device went to Fedora grub. This time, however, it displayed an entry for Fedora (as well as Manjaro and Windows). Booting Fedora works fine but Manjaro still freezes on a black screen. I changed the boot order in my UEFI settings to Manjaro first. After changing the UUIDs to match the new partitions, my custom entry (still using your configfile method) has exactly the same behaviour as before (Fedora’s grub style but no entry for Fedora). I can only assume that Fedora’s grub creates this entry depending on which bootloader is reading it but I can’t find any documentation about it (nor can I even begin to understand most of the config file).

For this situation specifically, the best solution I’ve found is to chainload Fedora’s grub from Manjaro’s grub. This should also work Fedora to Manjaro. I’ve written all this in the hope it will help the next person who has a similar issue; the actual solution is in the next reply.

Chainloading Fedora from Manjaro:

  1. With Manjaro already installed, install Fedora with all options left default (don’t disable the bootloader install).
  2. Reboot and make sure Fedora is bootable from Fedora grub.
  3. Reboot into UEFI settings and put Manjaro at the top of the boot order.
  4. Reboot into Manjaro and edit /etc/grub.d/40_custom, appending this stanza:
menuentry "Fedora Workstation Live 36 Beta" {
    insmod part_gpt

    set root='hd0,gpt1'
    chainloader /EFI/fedora/grubx64.efi
}
  1. Save the file and run sudo update-grub.
  2. Reboot and select Fedora from the Manjaro grub menu. It should load the Fedora grub menu, from which you can select Fedora.
  3. To remove the os-prober entries in the Fedora menu, as suggested by @lorebett, add the line GRUB_DISABLE_OS_PROBER=true to /etc/default/grub and run sudo grub2-mkconfig -o /boot/grub2/grub.cfg to update the Fedora grub configuration.
  4. Reboot and select Fedora. It should now skip the menu, which is fine because after selecting Fedora there is no need to choose anything else.

A few notes:

  • I didn’t use UUID to identify the partition because EFI is almost always the first partition and isn’t going to change.
  • I removed the rmmod tpm line because it created a ‘no such module’ error. Add it if you get the errors in @lorebett’s post.
  • Chainloading like this hopefully shouldn’t be necessary for other distro combinations. Manjaro and Fedora don’t go well together apparently.
1 Like

thegooselord if you follow my tutorial you should get a working solution without further tweaks. Please remember that if you want to boot Fedora from another main grub configuration (which is not Fedora) you have to disable blscfg. Moreover, please remember that “chainloader” is not the same as “configfile”.

When I disable blscfg (while using ‘configfile’) it causes an error ‘cannot find blscfg’ when booting Fedora, and then goes to UEFI. Do you know why this might be? I thought I had misread the instructions about this so removed the disable line in /etc/default/grub on Fedora.
Anyway, Manjaro needs to be booted from its own modified version of grub, so in that case chainloading or some other method would be necessary. For Manjaro booting Fedora, I’m not sure why it doesn’t work. Maybe there is something I missed?

Actually, I haven’t tried disabling blscfg myself in Fedora. I thought it’d be enough to disable it in the /etc/default/grub but maybe I’m wrong.

Concerning booting Manjaro, I tried that myself and it worked. Are you using anything specific in Manjaro? Maybe btrfs with automatic snapshots in grub? In any case, if it works with chainloading then it’s fine :slight_smile:

1 Like

Any changes made in /etc/default/grub will not take affect until you have run sudo grub2-mkconfig -o /boot/grub2/grub.cfg so the new changes to the kernel command line are in that file.

Sorry I wasn’t clear: I know that grub.cfg must be regenerated after changing /etc/default/grub. I was answering the previous post where I seem to understand that disabling blscfg (and of course regenerating grub.cfg) is not enough to make things work.

My Manjaro is ext4 and everything default/normal, so there shouldn’t be anything weird. I’ve probably done something wrong because I couldn’t get Fedora to boot Manjaro when I tried, but yeah whatever works with whatever setup is fine.

Sorry to resurrect an old thread, but the suggestions and other guides in this thread didn’t quite work for me and I required some further trial-and-error, so I thought posting my solution might help others struggling on this topic.

My setup is a Windows computer that I partitioned to dual-boot Manjaro, and then this morning replaced Windows with Fedora. During the Fedora install I used the advanced drive setup GUI to make a new btrfs partition in the empty space where I had already deleted Windows via Manjaro’s partition manager, and set a mountpoint of /boot/efi for my existing EFI partition - I made no further changes to drives or partitions. On reboot I was presented with Fedora’s ugly unthemed grub menu and tested the Manjaro option to make sure it worked… which it didn’t, I have to use the fallback option, but I want to use the Manjaro grub as default anyway so I’ll fix that later.

In order to get Fedora booting from Manjaro’s grub, these are the final steps that worked for me:

  1. disable blscfg in /etc/default/grub on Fedora and regen the config file with sudo grub2-mkconfig -o /boot/grub2/grub.cfg
  2. flip Manjaro back to position one in the boot sequence in BIOS / UEFI
  3. on Manjaro, add a menuentry block in /etc/grub.d/40_custom as described above but using search --set=root --fs-uuid <UUID> instead of set root='hd0,gpt1' as suggested in this thread
  4. regen Manjaro’s grub with sudo os-prober && sudo update-grub

I have found two configurations for Manjaro’s /etc/grub.d/40_custom which work and seem to do the same thing, load to Fedora’s ugly unthemed grub menu, but there must be something different going on under the hood given the different commands and files used. I’ve decided to make the grub.cfg version my default with the other as a fallback just in case, but your mileage may vary.

menuentry "Fedora" {
    insmod part_gpt
    insmod btrfs
    insmod ext2
    rnmod tpm
    search --set=root --fs-uuid <UUDI of Fedora>
    configfile /boot/grub2/grub.cfg
}

menuentry "Fedora (alternate)" {
    insmod part_gpt
    insmod btrfs
    search --set=root --fs-uuid <UUID of EFI>
    chainloader /EFI/fedora/grubx64.efi
}

My next step will be getting Fedora’s grub to correctly launch Manjaro, as it currently only works if I use the fallback option, and then I’ll see about making it not look like dirt.

I mean, come on, this is 2022 and Fedora is a renowned, solid system with a growing reputation as the shining example of the modern Linux desktop! Why is their grub menu at a stupidly low resolution in stark black-and-white with an ugly font?! Manjaro’s takes full advantage of my 2560x1440 primary monitor with a beautifully simple green and grey theme.

Is Manjaro or Fedora, or both, use btrfs? My blog post above assumes you always use ext4. For btrfs things have to be adjusted, I’ll update the post soon.

Manjaro is using ext4, Fedora is on btrfs.

With fedora it does not matter, since the default workstation config creates an ext4 partition for /boot so grub does not need to deal with btrfs. BTRFS is only in affect after the kernel loads from vmlinuz and the initramfs image.

The main thing that will be an issue in dual booting this way is that fedora automatically updates grub when a new kernel is installed (which happens frequently). If you want to use the manjaro grub you will need to be aware when fedora updates the kernel and take action with manjaro.

From the post I seem to understand that the user did not let the installation create a separate ext4 boot partition

I’ve updated my blog post. For configfile related to a grub.cfg in a BTRFS partition, you must specify the subvolume label. For example, if root has label “@”:

menuentry "Arch" {
    insmod gzio
    insmod part_gpt
    insmod btrfs
    insmod ext2
    rmmod tpm
    set root='hd0,gpt13'
    configfile /@/boot/grub/grub.cfg
}

Note the “/@”

That line should be configfile /@/boot/grub2/grub.cfg on fedora

If you boot Fedora from Arch then yes.
In this example, I’m booting Arch from Fedora, so you must specify the path of Arch’s grub.cfg

And by the way, by default Fedora does not use @ as the label for the root subvolume, so you have to adapt the entry accordingly.

Very true. Fedora uses root as the subvolume name for the volume mounted at / and the fstab entry on my VM to mount it is UUID=2eb221b2-5371-479f-97f2-5b3aaa04b13a / btrfs subvol=root,compress=zstd:1 0 0
Similarly the subvolume for /home is home and its fstab entry is UUID=2eb221b2-5371-479f-97f2-5b3aaa04b13a /home btrfs subvol=home,compress=zstd:1 0 0
With the same UUID it is necessary on a btrfs volume to specify the subvolume name as well as the compression used (if any) when mounting.

I hope anyone reading this thread can manage to work that out since it is significantly different than when using ext4 and LVM