Grub2 notes

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.

Making changes.

One doesn't edit /boot/grub2/grub.cfg. Instead, one edits /etc/default/grub. There, one can remove, for example, the rhgb and quiet entries in the menu, so that one can see what's happening during boot, or change the default timeout. After editing it, one must then run
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.

Adding entries to your grub menu.

RH based systems have always been pretty bad at detecting other Linux installations. I don't know if this has changed with grub2 or not, but at least through F15, it only automatically detects other RH based and Windows installations. If you want to add another entry, add an entry to /etc/grub.d/40_custom. While old grub would count disks and partitions starting at 0, so that /dev/sda1 would be hd0,0, grub2, while still counting disks at 0, starts partitions at 1. So, /dev/sda1 will be sd0,1. Assuming you have installed, for example, ArchLinux on /dev/sda6
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.

Alternate method

Some folks, including at least one person on the Fedora testing list, found that editing 40_custom and running grub2-mkconfig didn't work. That person posted an alternate method, that worked for them.

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.