How to fix a broken bootloader configuration after a Fedora Linux upgrade

By
Posted on
Tags: linux, fedora, grub, sysadmin, note-to-self

It seems that every time I upgrade Fedora on one of my workstations, anaconda somehow manages to screw up the bootloader configuration, and when the upgrade is “complete” and the system reboots, I’m left starting at a GRUB prompt. So this is a little note to myself for how to fix the broken configuration. (If you find my note helpful, great, but if you try anything in it, you do so at your own risk.)

First, find out where GRUB thinks the /boot partition is:

grub> find /grub/grub.conf
find /grub/grub.conf
 (hd0,0)
 (hd1,0)

Here, GRUB found two potential /boot partitions, which is actually correct because I keep /boot on a RAID-1 md device and GRUB is finding the device’s underlying partitions.

Next, tell GRUB to use the desired /boot partition as its root device:

grub> root (hd0,0)
root (hd0,0)
 Filesystem type is ext2fs, partition type 0xfd

Finally, tell GRUB to set itself up on the hard drive that contains the partition (which, for my workstations, is the correct place):

grub> setup (hd0)

That’s it, all done.

At this point, you can tell GRUB to “boot” using the configuration or “reboot” from scratch to test the configuration from a system restart.