22 September 2012
How To Repair GRUB2 In A System With Broken Recovery Mode - Ubuntu 12.10/12.04
Have you installed another OS (Windows for example) with Ubuntu and lost GRUB2, or have you changed some settings that caused GRUB2 to disappear?
Your problem can be fixed with the Ubuntu installation CD that will allow us to reinstall GRUB2 using some terminal commands. Booting in Recovery Mode is not possible in this case because the GRUB boot menu is no longer available.
Boot into the Ubuntu 12.10/12.04 Live CD and click "Try Ubuntu without installing":
After the desktop is loaded, we need to mount the root partition so that we grant the live cd user read/write permissions on your system files and folders. Let's first identify the partition where Ubuntu is installed with this command:
sudo fdisk -l
Note: The Terminal can be started by pressing CTRL+ALT+T.
The Ubuntu partition we will work on will be labeled with the word "Linux" as shown in the screenshot given below:
Run now this sequence of commands to mount the root partition:
sudo mkdir -p /media/ubuntu
sudo mount /dev/sda1 /media/ubuntu
Then you need to mount these system folders to use them on your current desktop environment:
sudo mount --bind /dev /media/ubuntu/dev
sudo mount --bind /proc /media/ubuntu/proc
sudo mount --bind /sys /media/ubuntu/sys
Now chroot into your hard drive with this command:
sudo chroot /media/ubuntu
You have now read/write permissions on your root partition. To install GRUB2, you need to use one of these two commands:
grub-install --root-directory=/media/ubuntu /dev/sda
Note: the "sudo" is not required since you are logged in as root now. Also keep /dev/sda as is.
root@ubuntu:/# grub-install /dev/sda
Installation finished. No error reported.
Update GRUB2 with this command:
Now Remove the Ubuntu installation CD and reboot your system to see if the GRUB2 boot menu is restored or not. You can also use the Boot Repair application to repair GRUB2 as shown here.