Grub installation. First potential Fedora killer

Chris Murphy lists at colorremedies.com
Sun Jan 12 22:21:16 UTC 2014


On Jan 12, 2014, at 1:58 PM, Jean Fran├žois Martinez <jfm512 at free.fr> wrote:

> Installer sees the partitions of other Linuxes.  But when rebooting after installation Fedora was the only choice.
> 
> Running grub2-mkconfig fixed it, ie other distribution became available.  Sort of.  Problems:
> 1)  Fedora was the default and there is no easy way (that is without reading the 150+ pages of Grub documentation to change that)
> 2)  If user does not know about grub2-mkconfig he will believe he is "trapped" in Fedora and will be very, very angry
> 3)  Every time he runs the other distribution and updates it he needs to rebooot into Fedora and run grub2-mkconfig 

Right, I didn't mean to indicate that multiboot on linux doesn't completely suck, or that linux distros are friendly to each other rather than behaving in a cannibalistic fashion by default. GRUB2 really isn't meant for mortal users, just for the members of the lunacy asylum, so this really should work better than it does yet here we are.

Is this computer by any chance UEFI firmware based? Or is it BIOS? That matters.

On BIOS what's supposed to happen is anaconda calls grub2-mkconfig which in turn uses os-prober to find other OS's and create something sensible in grub.cfg. That doesn't always work for various reasons, in particular on UEFI. What you're probably better off doing, is editing /etc/grub.d/40_custom to add a very basic entry to locate the CentOS grub.conf. Something like this:

menuentry 'CentOS menu'  {
search --no-floppy --fs-uuid --set=root --hint-bios=hd0,gpt4 --hint-efi=hd0,gpt4 --hint-baremetal=ahci0,gpt4  d7bc9d0e-7706-44f9-b1a7-ff24b7c360a7
legacyconfigfile $prefix/grub.conf
}


Not all hints are needed. Obviously change hd0,gpt4 with the right hint for the hard drive and partition and partition scheme for where CentOS /boot is located. The important one, really, is the UUID at the end, which is the file system UUID for the CentOS boot partition (or rootfs if /boot is a directory on root). The legacyconfigfile command allows GRUB2 to read legacy GRUB configuration files. $prefix you should replace with /boot/grub if /boot is a directory on rootfs or /grub if it's on its own partition.

Now grub2-mkconfig -o /boot/grub2/grub.cfg and this entry will be added to your Fedora 20 grub.cfg. You'll get an entry that points to the CentOS menu. If you choose it, the CentOS menu list of kernels should appear. If you want to make this a default behavior, you'll need to read about $menuentry_id_option for your CentOS menu entry in the Fedora grub.cfg. By giving it a unique ID, you can then specify it as the default by that same id in /etc/default/grub.

Yes it's like pulling teeth.


Chris Murphy


More information about the devel mailing list