Linux – (RHEL 4 or 5) : unable to login to machine, as grub is corrupt and you are in grub prompt


You have dual operating systems on your laptop: Windows 7/XP and Linux on the same machine, you choose GRUB as boot loader while installation.

Some day, you may reinstall the windows or change the partition on your machine, grub gets corrupted and you find difficulty in resolving this issue.

But the solution is to simple and you need to follow below steps:
1. Run “find /boot/grub/stage1” in grub prompt:
(Remember that for grub (hd0,1) means hda (primary controller master), second partition.)

grub> find /boot/grub/stage1

you may receive the output something like below:
hd0,7

Then run “setup (hd0,7)” and “reboot” commands

grub> setup (hd0,7)
grub> reboot

System will reboot and you will be redirected to list page.

If you want to make some changes to the boot menu, press “e” to edit you must edit the file: /boot/grub/menu.lst

A sample file on my machine:
default=0
timeout=5
splashimage=(hd0,7)/boot/grub/splash.xpm.gz
hiddenmenu
title Red Hat Linux (2.6.9-78)
root (hd0,7)
kernel /boot/vmlinuz-2.6.9-78.ELsmp ro root=LABEL=/ rhgb quiet
initrd /boot/initrd-2.6.9-78.ELsmp.img
title Red Hat Linux (2.6.9-78)
root (hd0,7)
kernel /boot/vmlinuz-2.6.9-78.EL ro root=LABEL=/ rhgb quiet
initrd /boot/initrd-2.6.9-78.EL.img
title Other
rootnoverify (hd0,0)
chainloader +1

It will change the page for temporarily so that you can login.
Once you login edit /boot/grub/menu.lst to change it permanently.

That should fix it.

Advertisements

Leave a comment

Filed under Linux

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s