GRUB PROBLEM SOLUTION


This is how I fixed it:

1) Boot from a Live CD
2) Reinstall grub as explained here: https://wiki.ubuntu.com/Grub2#Recover%20Grub%202%20via%20LiveCD

Just in case the link above stops working, this is what I did:

# sudo mount /dev/sda4 /mnt
(“/dev/sda4” is where my linux data partition -containing also “/boot”- can be found. The other three previous ones are OSX stuff).

#sudo mount /dev/sda2 /mnt/boot

# sudo mount –bind /dev/ /mnt/dev
# sudo chroot /mnt
# update-grub
# grub-install /dev/sda
(yes… this is “/dev/sda”, without the “4”)

Once it boots again, the “update manager” does not find any new grub package… so I guess this won’t happen again (after all the new grub was installed, we just re-created its config file)

==========================================

gksu gedit /boot/grub/menu.lst

Reinstall Ubuntu Grub Bootloader After Windows Wipes it Out

If you run a dual-boot system with Linux and Windows, this has happened to you. You had to do your monthly reinstall of Windows, and now you don’t see the linux bootloader anymore, so you can’t boot into Ubuntu or whatever flavor of linux you prefer.

Here’s the quick and easy way to re-enable Grub.

1) Boot off the LiveCD

2) Open a Terminal and type in the following commands, noting that the first command will put you into the grub “prompt”, and the next 3 commands will be executed there. Also note that hd0,0 implies the first hard drive and the first partition on that drive, which is where you probably installed grub to during installation. If not, then adjust accordingly.

sudo grub

> root (hd0,0)

> setup (hd0)

> exit

Reboot (removing the livecd), and your boot menu should be back.

Only read below if Windows is now missing from the boot menu

If you installed Ubuntu before you installed Windows, then Ubuntu will not have anything in the grub configuration for Windows. This is where you’ll have to do a bit of manual editing to the grub boot menu file.

If you open the file /boot/grub/menu.lst with the following command:

sudo gedit /boot/grub/menu.lst

You’ll see a sample section for Windows, which you’ll want to uncomment and add to the boot menu list in whatever position you want it in. (uncomment by removing the #’s)

# title   Windows 95/98/NT/2000
# root   (hd0,0)
# makeactive
# chainloader   +1

Note that you should also verify that hd0,0 is the correct location for Windows. If you had installed Windows on the 4th partition on the drive, then you should change it to (hd0,3)

================================================

Today I decided to give Ubuntu 9.10 (Karmic Koala) a try. I’m using my old laptop for testing purposes. At the moment I have there Windows 7 and Ubuntu 9.04 installed and I can use them both with dual booting. I had no vital documents on my Ubuntu partition so I decided to do a clean install. Karmic Alpha 2 was just released and compared to Alpha 1 it was now using GRUB 2. Install went smoothly with no particular issues so I booted to Karmic and messed around a bit. Then logged off again rebooted, ready to use Windows. Imagine my surprise when there was no boot to Windows option in GRUB.
Here’s what I did to add it. I booted up to Karmic again. Now I only had 1 hard drive, but several partitions. I needed to find out which one was my windows partition. To do that I started a terminal and used the following command:

# sudo fdisk -l /dev/sda

According to this my Windows partition is hda1. To continue with my plan to add Windows boot option I typed in the following line:

# sudo nano /etc/grub.d/11_Windows

This created a new a new file. I then added the following lines:

#! /bin/sh -e
echo “Adding Windows” >&2
cat << EOF
menuentry “Windows 7″ {
set root=(hd0,1)
chainloader +1
}
EOF

Now save the 11_Windows file.

Bare in mind that in earlier version of GRUB, if your Windows was installed on first partition then you need to give root=(hd0,0). Thats how GRUB used to number partitions. Starting from GRUB 2, you need to give root=(hd0,1), if your Windows is installed on first partition. So under GRUB 2 it looks like this:

First partition (/dev/sda1): root=(hd0,1)

Next type the following command:

# sudo chmod a+x /etc/grub.d/11_Windows

Next type in the following command:

# sudo update-grub

You should be able to see something like this:

# sudo update-grub
Generating grub.cfg …
Found linux image: /boot/vmlinuz-2.6.30-9-generic
Found initrd image: /boot/initrd.img-2.6.30-9-generic
Found linux image: /boot/vmlinuz-2.6.30-8-generic
Found initrd image: /boot/initrd.img-2.6.30-8-generic
Adding Windows
Found memtest86+ image: /boot/memtest86+.bin
done

Now close all the open programs and type in the following command to your terminal:

# sudo reboot

If all went well you should see Windows 7 option in your GRUB2.

-Eric

http://erickoo.wordpress.com/tag/karmic-koala/


Sincerely Yours,

Hary Mulyadi

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: