Rescuing your Linux system from a failed grub install

It is bound to happen at some point. You’ve installed the latest kernel or you’re attempting an upgrade and now your system just won’t boot. The screen shows nothing more than GRUB. If your system isn’t able to get past the GRUB prompt and it isn’t because of a hard drive failure then chances are very good that you can rescue your system. This routine will work best if you created a non LVM boot partition or if your rescue cd includes the LVM tools.

This post assumes you are running a RedHat or Fedora based system but the concepts apply to all systems that use grub to boot. It also assumes you have a relatively recent install cd.

To get started, insert your install cd. In my rescue scenario I used a CentOS install cd. When the install has loaded to the initial screen enter ‘linux rescue’ and press enter. The cd will boot like normal and ask about your preferred language and keyboard layout. Continue until you are asked if the rescue routine should find any installed systems. If your root directory exists in LVM you should say no, unless you the rescue cd you using includes LVM tools. It isn’t important to mount root anyway, just your boot partition.

When you are at a prompt, create a boot directory at / and mount your boot partition there. In a typical RedHat/Fedora setup it will be on /dev/[h|s]da1. Next, rename the current device.map files to some other name. We’re now ready to reinstall grub.

Type grub and press enter. You’ll now be in the grub interface. Type ‘root (hd0,0)’ and press enter. Next, type ‘setup (hd0)’ and press enter. Some text will flash by with, hopefully a success message. If you see success you should now be able to reboot into your Linux system.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.