How to Repair Grub while dual booting ( win7 / ubuntu 11.10)
I've installed windows 7 and then Ubuntu 11.10, and then set up everything on easyBCD.
When I select Ubuntu on the boot menu, I end-up in grub prompt (like "grub>" in a black screen) instead of loading Ubuntu directly.
I have to run:
grub> root (dh0,4)
grub> kernel /vmlinuzblahblah root=/dev/sda6
grub> boot
Every time to boot Ubuntu(where vmlinuz is a long filename I always tab).
How could I skip this process?
My "Fix-Grub-routine" is as follows:
- Boot from an Ubuntu LiveCD (USB key usually)
- Mount the
/root
and/boot
partition of my original install in the live environment. Lets say my root is mounted in/tmp/myRoot/
and boot in/tmp/myBoot/
- Mount/bind a few important directories
sudo mount --bind /dev /tmp/myRoot/dev
sudo mount --bind /proc /tmp/myRoot/proc
sudo mount --bind /sys /tmp/myRoot/sys
sudo mount --bind /tmp/myBoot /tmp/myRoot/boot - Chroot into my original installation
sudo chroot /tmp/myRoot/
- Now I'd usually do
update-grub
but since you messed up your bootsystem using some weird third-party application, I think it might be better to re-install grub usinggrub-install /dev/sda
*. - When done,
exit
the chroot and reboot the system (without your live-media)
Note: Replace
/dev/sda
with the drive you want grub to be installed on!Note2: Most of this information used to be on an Ubuntu wikipage called RecoveringUbuntuAfterInstallingWindows. While finding this page to link to in this post I noticed the page has had quite a change. The chrooting and stuff is not described anymore but instead a boot-repair utility is available on some live cds. I have not experience with it, but I suppose it's worth a shot.