# how to rebuild the ubuntu boot loader



## Miguel2013 (Aug 16, 2012)

I was using the boot loader that ubuntu installed to load linux and windows xp individually, but after I tried to reinstall xp using a bootable usb drive it erased my boot loader information leaving xp as the only os to boot.

I want to know what are the commands that I need to input maybe inside a live ubuntu so I can use my existing ubuntu instalation as well as xp like it was before this accident.


----------



## temp02 (Aug 16, 2012)

grub-install should do the trick.


----------



## ThE_MaD_ShOt (Aug 16, 2012)

Yes grub will work.


----------



## Drone (Aug 16, 2012)

If you have problems with grub here's a straightforward guide from ubuntu forums:

Open terminal and type

*sudo grub*

This will get you a "grub>" prompt (i.e. the grub shell). At grub>. enter this

*find /boot/grub/stage1*

This will return a location. If you have more than one, select the installation that you want to provide the grub files. THIS IS IMPORTANT, whatever was returned for the find command use it in the next line (you are still at grub>. when you enter the next 3 commands)

*root (hd?,?)*

Again use the value from the find command i.e. if find returned (hd0,1) then you would enter root (hd0,1). Next enter the command to install grub to the mbr

*setup (hd0)*

Finally exit the grub shell

*quit*

That is it. Grub will be installed to the mbr.
When you reboot, you will have the grub menu at startup.

http://ubuntuforums.org/showthread.php?t=224351


----------



## GoFigureItOut (Aug 19, 2012)

For simplicity, sake I use a CD called Boot-Repair-disk.


----------



## SIGSEGV (Aug 21, 2012)

boot with the ubuntu installation cd, open terminal, find root hdd for linux booting and mbr hdd partition then mounting and re-mapping it to grub, finally re-installing grub by typing #grub-install /mount-dir/mapped-mbr-partition /dev/orig-mbr-partition.

note : if you have 2 different disk locations for linux partition and windows mbr partition, while on successfully grub booting you should edit grub parameter by pressing 'e' then do manual re-map linux root partition


----------

