There's nothing magical about it, you can easily Google it up, but I always forget the "find /boot/grub..." part and there are many other ways people explain this procedure, so I'm adding a screenshot as I'm doing it yet another time.
This is a best and easiest way to fix MBR after Windows f*ck it up.
In short:
1. boot from Ubuntu live CD (or any other live cd)
2. start a terminal
3.
sudo grub
find /boot/grub/stage1
root (hdX,Y)
setup (hdX)
quit
If you've got several drives you should check if your Windows partition is bootable and the other ones are not, otherwise if you install grub into linux partition, Windows will "fix" itself by changing bootable flag. To view and change bootable flags in Ubuntu Live go to System > Administration > Partition Editor (or run sudo gparted in terminal). The rest is illustrated below.
If grub loads but boot fails, it means grub detected your partitions incorrectly. Hit 'e' on linux entry, change the "root (hd1,0)" to "root (hd0,0)" or vice versa and press 'b' to attempt a modified boot. Repeat the "sudo grub" procedure when booted, but choose "setup (hdX)" target the oposite of your "root", i.e., if you did "root (hd1,0)", do "setup (hd0)" instead of "setup (hd1)". You should also edit /boot/grub/menu.lst afterwards and change all (hd0 to (hd1 and (hd1 to (hd0 to fix the boot menu.
Does all software have to suck?..
Very helpful post. I installed Windows 7 RC1 in place of Windows 7 Beta on my triple boot (ubuntu, Vista (for work)) system and it killed GRUB. This helped me fix it quickly. I didn't have to manage flags or anything, either (because of previous setup?).
ReplyDeleteThanks loads!
Nick C
http://chapmanIT.com
Great post, thank you! Very clear instructions!
ReplyDeleteHelped me a lot. This is by far the best instructions ever. Other forums leave the manage flags part out!! Kudos!
ReplyDeleteThis saved my ass. You are the man.
ReplyDeleteHi
ReplyDeleteI have tried that this is what I get:
ubuntu@ubuntu:~$ sudo grub
sudo: grub: command not found
Thanks
Try sudo /sbin/grub
ReplyDeleteThank you. Well done and easy to follow.
ReplyDeletethank you.. excellently done
ReplyDeleteGood post!
ReplyDeleteIf you installed Ubuntu on a different disk, you need to use setup (hd0) though, not the hd returned by the root command.
Thanks, it was very helpful for me.
ReplyDeleteBut a friend has the same problem but he don't has a cd reader. How can he fix his problem?
Delete> But a friend has the same problem but he don't has a
> cd reader. How can he fix his problem?
You can make an USB version of Ubuntu Live Cd by installing package usb-creator-gtk and using it to install a live cd image to an usb thumbdrive: https://help.ubuntu.com/community/Installation/FromUSBStick
Hi
ReplyDeleteI have tried that this is what I get:
ubuntu@ubuntu:~$ sudo grub
sudo: grub: command not found
I also get this error, it seems the grub is not installed, and the sudo /sbin/grub also doen not work. any tips?
Try finding your grub then:
ReplyDeletefind / -name grub
You can install packages with the Live CD if needed bug Grub should be on eveyone's system. If you run gparted does it say your file systems are healthy? Can you mount them?
ReplyDeleteIf you have a SCSI controller do you need to use sda instead or is that just for linux itself?
ok I'm in grub but when I do step two (find /boot/grub/stage1) I get the following message "Error 15: File not found" Any ideas?
ReplyDeleteHey all my friends you can find best solution of this problem over here:http://goo.gl/HXsZv
ReplyDelete