I don’t have windows. I dual boot between Fedora and Ubuntu. Somehow the grub gets modified only by Ubuntu, the modifications done to grub while being booted to Fedora does not show any effect after restart.
Is it possible to edit grub from both Ubuntu and Fedora installed in a system? Or we have to choose one and to be bound by it for any changes?
In my case somehow I can modify grub only from Ubuntu and when ever I do Fedora Kernel update (dnf offline upgrade method), the grub is built during the kernel update by Fedora. But it does not show up in the grub entries when I reboot. Only after booting to ubuntu if I do grub-update, I am able to see the new Fedora kernel.
How can I avoid this? I want both Ubuntu and Fedora to modify grub.
Note I have a separate efi partition shared by both ubuntu and fedora and separate /boot partitions one each for Ubuntu and Fedora.
$ lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINTS
zram0 252:0 0 8G 0 disk [SWAP]
nvme0n1 259:0 0 1.8T 0 disk
├─nvme0n1p1 259:1 0 768M 0 part
├─nvme0n1p2 259:2 0 768M 0 part /boot
├─nvme0n1p3 259:3 0 768M 0 part
├─nvme0n1p4 259:4 0 128M 0 part /boot/efi
└─nvme0n1p5 259:5 0 1.8T 0 part
In above nvme0n1p2 is /boot for Fedora, nvme0n1p1 is /boot for Ubuntu.
You cannot do so easily nor seamlessly. The last updated takes control.
Fedora is able to see ubuntu and add it into the grub menu.
Ubuntu does not allow fedora to be added into the grub menu, though you may manually create a menu entry for fedora in ubuntu then modify it with each fedora kernel upgrade. (If you choose to make the manual changes then it may be possible to allow both to update grub.)
Why one would need both to update grub is beyond me since both fight with each other and only fedora makes it seamless.
If you were to remove grub from ubuntu then fedora could manage the booting and both would be available. Otherwise you do some grub config manually or you use 2 different efi partitions on 2 different drives and select which to boot from the bios boot menu and not from grub.
You may note that fedora uses /boot/grub2/grub.cfg and ubuntu uses /boot/grub/grub.cfg.
A solution I have been using for quite a while to multiboot another Fedora version.
On fedora edit /etc/grub.d/40_custom to look something like
#!/usr/bin/sh
exec tail -n +3 $0
# This file provides an easy way to add custom menu entries. Simply type the
# menu entries you want to add after this comment. Be careful not to change
# the 'exec tail' line above.
menuentry 'SecondDisc' --class gnu-linux --class gnu --class os $menuentry_id_option 'Second-Disk' {
search --no-floppy --fs-uuid --set root be7e5f09-c8fc-4e64-addd-ddda9478b5f2
configfile ($root)/grub2/grub.cfg
}
You may need to change “grub2” to “grub” to actually math the file name used by UbUntu.
The UUID be7e5f09-c8fc-4e64-addd-ddda9478b5f2 should match the uuid of the boot file system on Unbuntu so get that information using lsblk -f.
What it does is to make fedora grub read the grub configuration from the ubuntu system.
If this doesn’t work with Ubuntu, then you need to run grub2-mkconfig on Fedora every time you installed a new Ubuntu kernel.
How to remove the grub that is controlled by Ubuntu?
After the latest Ubuntu 23.10 update the grub menu does not shows Ubuntu anymore, but only shows Fedora.
Is it possible to do it by using Fedora live usb? Please tell me what command do I need to type to delete the grub menu created by Ubuntu and create a fresh to be controlled by Fedora installed on the laptop (and not from the live-usb).
Or is it possible to do it from Fedora booted on the laptop?
Note I have a separate efi partition shared by both ubuntu and fedora and separate /boot partitions one each for Ubuntu and Fedora.
$ lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINTS
zram0 252:0 0 8G 0 disk [SWAP]
nvme0n1 259:0 0 1.8T 0 disk
├─nvme0n1p1 259:1 0 768M 0 part
├─nvme0n1p2 259:2 0 768M 0 part /boot
├─nvme0n1p3 259:3 0 768M 0 part
├─nvme0n1p4 259:4 0 128M 0 part /boot/efi
└─nvme0n1p5 259:5 0 1.8T 0 part
In above nvme0n1p2 is /boot for Fedora, nvme0n1p1 is /boot for Ubuntu. Should I do sudo rm -rf /boot/efi to force re-generation of grub menu? Is this safe and recommended?
No, Don’t. If it works as I expect, you can select the Fedora loader or the Ubuntu loader at the UEFI boot menu, and that would be far the easiest way do do this.
First I use LVM and that is why I wanted to do separate boot partition. And since traditionally /boot lies in the root partition of an operating system, the /boot if not separated as a separate partition, will still won’t be shared by Ubuntu and Fedora as they would be located in their own root partition (or logical volume) respectively.
Also, I didn’t wanted the boot configuration of one operating system to interfere with the other.
Test both of them, and keep the one that works and remove the other. If both works the same way, just remove one of them.
It works best if you just leave the grub configuration as they were when first installed. Perhaps even with auto-hide enabled so you only deal with the UEFI menu.