In the new version of GRUB2 that comes with Ubuntu 11.04 (GRUB 1.99) there has been a change in the commands needed to reinstall GRUB2 from the LiveCD.
Firstly, if you are using these instructions to reinstall GRUB2 (1.99) from a LiveCD for an Ubuntu 11.04 (Natty) installation, you must do it from an Ubuntu 11.04 LiveCD.
- Boot from the LiveCD, open a terminal and enter:
sudo fdisk -l
You will get an output similar to:
Device Boot Start End Blocks Id System /dev/sda1 * 1 23620 189727618 83 Linux /dev/sda2 23620 24322 5638815 5 Extended /dev/sda5 23620 24322 5638815 82 Linux swap
Now look for a linux partition with the appropriate size (/dev/sda1 in above example).
Note: The device/drive is designated by sdX, with X being the device designation. sda is the first device, sdb is the second, etc. For most users the MBR will be installed to sda, the first drive on their system. The partition is designated by the Y. The first partition is 1, the second is 2. Note the devices and partitions are counted differently.
When you know the device and partition…
- Mount the partition containing the Ubuntu installation:
sudo mount /dev/sdXY /mnt
(where XY are the drive/partition… /dev/sda1 in above example, but be SURE to use YOUR drive/partition)
Note: If the user has a separate /boot partition, this must be mounted to /mnt/boot
Note: If the user has a separate /home partition, this must be mounted to /mnt/home.
Encrypted home partitions should work.
The next command is the one that has changed for Ubuntu 11.04 with GRUB2 1.99
“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”
3) Run the grub-install command to reinstall the GRUB2 files from the mounted partition to the proper location and to the MBR of the designated drive:
sudo grub-install --boot-directory=/mnt/boot /dev/sdX
(where X is the drive who’s MBR will be overwritten by the new (stage 1) GRUB bootloader).
-
Reboot
-
Open a terminal and enter:
sudo update-grub
(to update the GRUB menu and configuration with any detected OS’s)
For GRUB2 versions prior to 1.99 (ie. as used in Karmic, Lucid, and Maverick), the command in Step 3) should read:
sudo grub-install --root-directory=/mnt /dev/sdX
Further information here:
https://help.ubuntu.com/community/Grub2#Copy_LiveCD_Files