Originally posted at WebUpD8.org
But recovering GRUB2 (after breaking the GRUB2 or installing Windows – which breaks GRUB2, etc.) is just as easy. Here is what you need to do
Note: This tutorial should work for any Linux distribution which uses GRUB2, not just Ubuntu.
You need a live CD of Ubuntu Karmic (Lucid will work too – or any other Linux distribution which uses Grub2) from which you need to boot. Once you boot to the LIVE CD, open a terminal an and type these commands:
sudo fdisk -l
(in my case, it’s “sda1″)
b) Now, we must mount this partition:
sudo mount /dev/sda1 /mnt
Where “sda1″ is the partition where you installed Ubuntu (or any other Linux distro). It could be “sda5″, “sda6″, etc. for you.
c) Install grub to the partition you’ve mounted:
sudo grub-install -–root-directory=/mnt/ /dev/sda
Important: Please notice that it’s “/dev/sda”, not “/dev/sda1″. “sda” is the hard disk on which your Linux distribution is installed!
d) Restart your computer. As previous Grub2 entries are removed, run the following command to restore them:
sudo update-grub
Here is all the process (without step “d)” which takes place after restart) in a single screenshot:
