Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I had Windows XP and Ubuntu both installed. I could easily boot into either until Windows "fixed" the bootloader so that it now only boots into Windows.

I guess there is no way to prevent Windows from doing this. So instead when it happens how do I quickly restore the GRUB bootloader?

Also while I'm here: How do I edit the GRUB menu, to hide options I don't want and to change the default boot OS?

share|improve this question
add comment

4 Answers

Sometimes in windows partitioning & formating there's a change in partition's number. Eg: /dev/sda3 become /dev/sda4
So if U get on booting an error 17... "cannot mount selected partition"... Fix it like that:

  1. On grub splash select the line of your entry and press "e" to edit
  2. Change the number of the partition... Ex: (hd0,2) -> (hd0,3) and press "enter"
  3. Reboot
  4. When you can reboot on your system fix menu.lst with new settings...
share|improve this answer
add comment
up vote 2 down vote accepted

Boot off a live CD (gparted is quick), then in a terminal window enter, (substituting your (drive,partition) pair):

sudo grub
find /boot/grub/stage1
root (hd0,0)
setup (hd0)
quit

Then reboot the system

As root edit /boot/grub/menu.lst, it's fairly self explanatory.

share|improve this answer
add comment

Follow the Ubuntu Community instructions on restoring or recovering from a boot-loader problem. Essentially, you'll have to chroot into your hard drive environment using your live CD and use grub-install to reinstall GRUB. There are multiple ways to do this as suggested by the document - choose your pick.

from this earlier answer.

You can find GRUB's menu at /boot/grub/menu.lst on Ubuntu systems.

If you just installed Windows, it's normal for it to overwrite the MBR. You might get the same thing if you just did an automated repair or recovery on your Windows partition. If this isn't a fresh install and you didn't just repair the system, something else is going on -- Windows doesn't usually "fix" the MBR for no reason.

share|improve this answer
add comment

The GRUB menu is kept in a file called menu.lst. On a lot of systems it is called grub.conf, but that should be a symbolic link to menu.lst, and you can edit either one since the symlink just takes you to the real file anyway.

To put the GRUB boot back, you can boot from a live CD or recovery disk, and work from there. But I'll avoid explaining this as I don't have exact details (and it's too dangerous to guess at).

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.