SilverWav's Journal

The best is yet to come…

Fix Ubuntu Boot After Windows Install – Reinstall Grub In 5min – 11.04 Natty

with 2 comments

The Quick Answer:

[Update: you may want to take a look at this first]

For version 1.99 (Ubuntu 11.04):

At a terminal in a LiveCD Desktop.

sudo grub-install --boot-directory=/media/0d104aff-ec8c-44c8-b811-92b993823444/boot /dev/sda

Warning! This will not be the correct information for your PC!

You will need to replace ‘0d104aff-ec8c-44c8-b811-92b993823444’ and possibly ‘/dev/sda’ see below for details:

________________________________________

Overwriting the Master Boot Record

Note: The existing MBR will be lost. In order to dual-boot your computer, we will be creating a new Master Boot Record to include all operating systems, including Ubuntu Linux and Microsoft Windows.

1. Download the latest version of Ubuntu Desktop edition from http://www.ubuntu.com/GetUbuntu/download and burn your Ubuntu CD.

2. Reboot your computer and boot into a live session.

________________________________________

Find your Ubuntu boot partition

You need to mount the partition with the ‘/boot’ folder in it.

1. Mount your Ubuntu partition from the Places menu.
Open “Home” and click an unmounted partition from the bar to the left.

2. As an example: I clicked on a 16G partition to mount it, then I went into the boot/grub directory to check for grub.cfg

________________________________________

Note the partition details.

Run this command:

mount | tail -1

You should see output similar to this:

/dev/sda2 on /media/0d104aff-ec8c-44c8-b811-92b993823444 type ext4 (rw,nosuid,nodev,uhelper=devkit)

Note the designation for the disk /dev/sda which you will be using later, and the directory in /media.

Hint: Use Tab Completion in Terminal to complete the path.
This automatically finishes file names, directory locations, and other long or hard to type file names.

________________________________________

Verify that your partition is the Ubuntu boot partition.

Run this command:

ls /media/0d104aff-ec8c-44c8-b811-92b993823444/boot

or

ls /media/0d104aff-ec8c-44c8-b811-92b993823444

But substitute the example’s UUID, 0d104aff-ec8c-44c8-b811-92b993823444, with your volume’s UUID which you found earlier.

In either case, the output should be something like this:

abi-2.6.38-8-generic         memtest86+_multiboot.bin
config-2.6.38-8-generic      System.map-2.6.38-8-generic
grub                         vmcoreinfo-2.6.38-8-generic
initrd.img-2.6.38-8-generic  vmlinuz-2.6.38-8-generic
memtest86+.bin

If what you have is not similar, unmount it and try another partition.

________________________________________

Reinstall GRUB

Now that everything is mounted, we just need to reinstall GRUB by specifying the correct directory and the correct drive name:

For version 1.99 (Ubuntu 11.04):

sudo grub-install --boot-directory=/media/0d104aff-ec8c-44c8-b811-92b993823444/boot /dev/sda

If you get BIOS warnings try:

sudo grub-install --boot-directory=/media/0d104aff-ec8c-44c8-b811-92b993823444/boot /dev/sda --recheck

Warning: 

Substitute /dev/sda with the location you want to install GRUB on.

Substitute the example’s UUID, 0d104aff-ec8c-44c8-b811-92b993823444, with your volume’s UUID which you found earlier

If all went well, you should see something like this:

“Installation finished. No error reported”

________________________________________

Reboot and Test

Reboot, making sure to boot to your hard drive and not to the live CD.

Grub should be installed and both Ubuntu and Windows should have been automatically detected and listed in the menu.

The Master Boot Record will execute Grub as the initial boot-loader.

The Windows boot-loader is contained within the Windows partition and will then be chain-loaded by the Grub boot-loader.

If your GRUB Boot Menu is out of date, run this command:

sudo update-grub

________________________________________

Notes:

Prior to version 1.99:

sudo grub-install --root-directory=/media/0d104aff-ec8c-44c8-b811-92b993823444 /dev/sda

If you get BIOS warnings try:

sudo grub-install --root-directory=/media/0d104aff-ec8c-44c8-b811-92b993823444 /dev/sda --recheck

Warning: 

Substitute /dev/sda with the location you want to install GRUB on.

Substitute the example’s UUID, 0d104aff-ec8c-44c8-b811-92b993823444, with your volume’s UUID which you found earlier

________________________________________

Based on RecoveringUbuntuAfterInstallingWindows.

Advertisements

Written by SilverWav

May 28, 2011 at 11:01 am

2 Responses

Subscribe to comments with RSS.

  1. thank you for your help !!!! You really saved me

    1111

    June 15, 2011 at 9:32 pm

  2. Thanks dude for helping me, it only takes 3 minutes actually :)

    fahmisite

    August 27, 2011 at 6:31 am


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: