Since most of the documentation I see on Grub2 at this point is written for Ubuntu, and Fedora does it differently, this page is more of a reminder to myself.
These commands are for Fedora 16 in its alpha stage. I don't know how many of them will change. Please consider this a work in progress.
grub2-mkconfig -o /boot/grub2/grub.cfg |
The -o is for the output file--if you don't give it, then no changes are actually made.
menuentry "ArchLinux" {
set root='(hd0,6)'
linux /boot/vmlinuz-linux
initrd /boot/initramfs-linux.img
}
|
If using chainloading then,after the setroot line, instead of linux and initrd, it would look like
menuentry "ArchLinux" {
set root='(hd0,6)'
chainloader (hd0,6)+1
}
|
When done, once again, one would run grub2-mkconfig -o /boot/grub/grub.cfg.
Instead of adding those lines to /etc/grub.d/40_custom, one can create a file /boot/grub2/custom.cfg. If one looks at /etc/grub.d/41_custom (as opposed to 40_custom) in Fedora, they will see that it says if /boot/grub2/custom.cfg exists, then source it. So, if one creates a custom.cfg file with the entry given above, i.e.
menuentry "ArchLinux" {
set root='(hd0,6)'
linux /boot/vmlinuz-linux
initrd /boot/initramfs-linux.img
}
|
upon reboot, the ArchLinux line should be visible. One advantage of having a custom.cfg file is that one doesn't have to run grub2-mkconfig after making any changes, the file will always be read upon boot.
If usng FreeBSD as another system, the chainloader syntax should work For example with FreeBSD on partition 3
menuentry "FreeBSD" {
set root='(hd0,3)'
chainloader (hd0,3)+1
}
|
Note that there is no space between the (hd0,3) and the +1. I found that if I put in the space, that is, wrote it as (hd0,3) +1, it wouldn't work, giving me an error of
invalid file name `'. |
I've found that both Ubuntu and Fedora seem to sometimes, though not always, have issues finding other systems. In addition, if you're using, say, Ubuntu's grub, then update Fedora, it might not find it until you once again update grub in Ubuntu. So, my personal preference is to decide upon one as the main grub. In /etc/default/grub, I will then add the line
GRUB_DISABLE_OS_PROBER=true
|