There are times when you inadvertently overwrite your Master Boot Record. The end result being that you are unable to boot into Linux. This is especially true when you are dual booting between windows and Linux OSes or installing/upgrading your windows OS
This is what you do to restore the GRUB2 boot loader when faced with the above problem. First you need a Linux distribution CD, Ubuntu Jaunty, Karmic Live CD.
Insert Ubuntu 9.10 karmic live cd or higher and select "Try ubuntu without any change to current system" option, Open Accessories > terminal and type following command to restore your GRUB2 boot loader
Firstly, you need to find out on which partition your Linux system is installed:
sudo fdisk -lthe above command will list all the partition on your disk, from this list figure out your ubuntu root partition.
Now, we must mount this partition:
sudo mount /dev/sda1 /mntWhere "sda1" is the partition where I have installed Ubuntu. It could be "sda5", "sda6", etc. for you.
Install grub to the partition you've mounted:
sudo grub-install --root-directory=/mnt/ /dev/sdaRestart your computer. As previous Grub2 entries are removed, run the following command to restore them back: