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?


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)

Then reboot the system

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


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.


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...

Editing the grub boot list manually is not the greatest - it's annoying and not transparent. I recommend Grub Customizer. To use, type the following commands from terminal in sequence:

sudo add-apt-repository ppa:danielrichter2007/grub-customizer

sudo apt-get update

sudo apt-get install grub-customizer

Then Grub Customizer should be available in whatever front-end interface you're using. Makes it easy to change boot options and rearrange items/change the default boot OS.


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).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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