How to restore Grub boot loader after installing Windows

If you run a dual-boot system with Linux and Windows, this case generally occurs. Window crashes and you have to reinstall Windows but it wipes out the MBR. Now you don’t see the linux bootloader anymore, so
you can’t boot into Ubuntu or whatever flavor of linux you prefer. I am using Ubuntu so I am here talking about Ubuntu.
So, this will help you to restore grub and get boot loader menu of Linux.
First boot your machine with Live Ubuntu CD. This can be the live installer cd or the older live session Ubuntu cds.
When you get to the desktop open a terminal and enter.

sudo grub

This will get you a “grub>” prompt (i.e. the grub shell). At grub> enter these commands

find /boot/grub/stage1

this will return a location. If you have more than one, select the installation that you want to provide the grub files.
Next, THIS IS IMPORTANT, whatever was returned for the find command use
it in the next line (you are still at grub>. when you enter the next 3
commands)

root (hd?,?)

Again use the value from the find command i.e. if find returned (hd0,1) then you would enter root (hd0,1) Next enter the command to install grub to the mbr

setup (hd0)

Finally exit the grub shell

quit

That is it. Grub will be installed to the mbr.
When you reboot, you will have the grub menu at startup.
Cheers.

Leave a Reply

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