How to restore GRUB

It’s happened to almost every GNU/Linux and Windows dual boot user at some point: You have a nice installation GNU/Linux cross-booted with Windows. So far so good. But then, at some point, you reinstall Windows, perhaps because you upgraded to a new version, or perhaps you just did it to “clean up” Windows, reinstalling the original system files to make it a little more stable. When you reboot, however, you’ll find that if you had LILO running from your hard disk’s MBR, it has been killed, and Windows has claimed the MBR as its own. How will you reinstall your boot manager so you can get into GNU/Linux?

here is small tutorial on how to reinstall your gnu boot loader in that case. I chose GRUB here as now a days it’s very popular and powerful too. For those who use LILO, chekc out my next post ;)

—-

Boot into the rescue mode using install CD1 by typing “linux rescue” at the boot prompt. When it asks you if you want it to find your installation and mount it, let it by selecting “Continue”. Once you get to the sh prompt chroot into you installation with:

# chroot /mnt/sysimage

If the disk you boot from is /dev/hda then you should be able to reinstall grub with:

# grub-install /dev/hda

Just remember to exit the chroot’ed shell before you reboot. If you reboot by “Ctrl-Alt-Del” the installer will unmount your partitions. Although it probably wouldn’t hurt to try to unmount as many as you can yourself with something like:

# umount /dev/hd?[1-9]*

—–

:)

This entry was posted on Saturday, July 10th, 2004 at 12:56 pm and is filed under gnu/linux. You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or trackback from your own site.

Leave a Reply

You must be logged in to post a comment.