Thursday, January 5, 2012

Reinstalling GRUB2

Howto reinstal GRUB2 with UBUNTU LTS LiveCD

Boot the LiveCD Desktop.
Open a terminal by selecting Applications, Accessories, Terminal from the menu bar.
Determine the partition with the Ubuntu installation. The fdisk option "-l" is a lowercase "L".
Mount the partition containing the Ubuntu installation.
sudo mount /dev/sdXY /mnt




  • Run the grub-install command as described below. This will reinstall the GRUB 2 files on the mounted partition to the proper location and to the MBR of the designated device.
    sudo grub-install --root-directory=/mnt /dev/sdX
    Example: sudo grub-install --root-directory=/mnt /dev/sda

    In Grub 1.99, introduced with Ubuntu 11.04, Natty Narwhal, a new switch is available which more clearly defines where the grub folder is placed. The command above will still work with Grub 1.99, but the following command is preferred by the developers. The target directory in the command is the command into which the grub folder will be installed. By default, and without the switch, the location is /boot/grub. In these instructions, since the Ubuntu partition is mounted on /mnt, the target would be /mnt/boot/grub.
    • sudo grub-install --boot-directory=/mnt/boot /dev/sdX
      Example: sudo grub-install --boot-directory=/mnt/boot/ /dev/sda
      Reboot

      Refresh the GRUB 2 menu with sudo update-grub