The information in this thread has been moved to https://help.ubuntu.com/community/Re...ta/7Bootloader A thread for discussion of the wiki page only can be found here http://ubuntuforums.org/showthread.php?t=2012409 Thread closed. How to restore the Ubuntu/XP/Vista/7 bootloader (Updated for Ubuntu 11.10) This How-to is for windows dual booters who reinstall an operating system only to find that it has taken away access to their other operating system. Whether you want to restore the XP, Vista, 7 or Ubuntu (Grub) bootloader, this guide will walk you through it. All three parts of this tutorial require that you boot from a cd. If you don't know how to do this, check here. If you have made a mistake and want to revert the changes, simply follow the instructions for reinstalling the previous bootloader. For example, if you have installed vista over ubuntu, try to get the ubuntu bootloader back, but want to get the vista bootloader back, simply follow my instructions for installing the vista bootloader. How to restore the Ubuntu grub bootloader (9.10 and beyond) First you need to find out what your drives are called. You can do this by going to a terminal and typing: Code: sudo fdisk -l From that you need to find the device name of your Ubuntu drive, something like “/dev/sda5″. So, still in the terminal, type: Code: sudo mkdir /media/sda5 sudo mount /dev/sda5 /media/sda5 And then, to reinstall the grub: Code: sudo grub-install --root-directory=/media/sda5 /dev/sda Push enter and you’re done! Of course you need to replace “/dev/sda5″ and “/dev/sda” with what you found in the fdisk output. How to restore the Ubuntu grub bootloader (9.04 and older) First of all, all credit for this part of the tutorial goes to catlet. I am simply rewriting his tutorial to have all three bootloaders in this tutorial. So, lets begin. To restore the grub, you must boot off the ubuntu live cd. Any ubuntu live cd will do. Once there, open a terminal (Applications>Accessories>Terminal) and type this: Code: sudo grub Next, you need to find which hard drive ubuntu and the grub is installed to. You do this by running this command: Code: find /boot/grub/stage1 Take note of what it returns (something like (hd0,1).) Now you need to tell Grub where it is installed. Using the output of the last command, change this one and run it: Code: root (hd<a>,<b>) Replacing <a> and <b> with what you got back before. For example, if "find /boot/grub/stage1" gave me "(hd0,1)", you would run "root (hd0,1)" Ok, so thats the configuration over and done with. Now we just need to run one command to install the Grub to your hard drive: Code: setup (hd0) Now to quit and check if it has worked: Code: quit Code: sudo reboot Make sure you have taken the live cd out of your disc tray. All going well, you should start back up and see the grub once again. How to restore the Windows XP bootloader For this you will need your Windows XP installation CD. Boot into it now. You will get to a part where it asks if you want to repair or recover. To do so, press "r". If prompted, enter your Windows XP administrator password. This will leave you at at a command line, so type in the following two commands: Code: fixboot Code: fixmbr Then type Code: exit then remove your XP cd. If everything has gone well, you should come to your XP bootloader. How to restore the Windows Vista or 7 bootloader To restore the Windows Vista/7 bootloader, you must first boot off your Windows Vista/7 installation DVD. If you have one of the many OEM computers that didnt come with a Vista/7 installation disk, you can get the same effect with a Vista recovery disk, which you can download for Vista or Win 7. When you get to the Regional settings, select your Location/Keyboard setting then click next. On the next page you must click on "Repair your computer." On the next page, if it finds your Windows Vista/7 installation, make sure it is UNSELECTED before clicking next. Then click on "Command prompt". From there, type in the folowing: Code: bootrec.exe /fixboot Code: bootrec.exe /fixmbr Now close the two windows and click "Restart." Take out your Vista/7 DVD and hopefully, you will be left with your Windows Vista/7 Bootloader.
sudo fdisk -l
sudo mkdir /media/sda5 sudo mount /dev/sda5 /media/sda5
sudo grub-install --root-directory=/media/sda5 /dev/sda
sudo grub
find /boot/grub/stage1
root (hd<a>,<b>)
setup (hd0)
quit
sudo reboot
fixboot
fixmbr
exit
bootrec.exe /fixboot
bootrec.exe /fixmbr
Last edited by Elfy; June 29th, 2012 at 09:17 AM.
First they ignore you, then they laugh at you, then they fight you, then you win ~ Mahatma Gandhi
Hi, Nice tutorial there, I will work on it, but, I am not sure if the situation I find myself is same or not. I have Dell Studio with preinstalled Vista Home SP1. I made a 20 GB raw partion and installed Linux with Grub Bootloader. On the initial boot screen (Grub), I see option of selecting Linux or Windows. Next, using EasyBCD, I configured the Vista bootloader to show boot option of Microsoft Vista and Linux. Currently, this is how the boot sequence is on my notebook. ->Initial boot screen : Grub (1-Linux, 2-Windows Vista) ->Once I select Windows, I get is another boot selection option 1-Microsoft Vista, 2-Linux. What I prefer is to have only one boot option screen that is second one (Which i suppose is Windows Vista's bootloader), at the same time I want to keep Linux partition intact. Simply putting it, I want to get rid of Grub bootloader, without getting rid of Linux partition. If I follow your tutorial will I be able to achieve it ??? What is the standard procedure to install Linux, on a system with MS Vista, without disturbing the bootloader? thanks in advance. cheers!!
Originally Posted by maxideci Hi, Nice tutorial there, I will work on it, but, I am not sure if the situation I find myself is same or not. I have Dell Studio with preinstalled Vista Home SP1. I made a 20 GB raw partion and installed Linux with Grub Bootloader. On the initial boot screen (Grub), I see option of selecting Linux or Windows. Next, using EasyBCD, I configured the Vista bootloader to show boot option of Microsoft Vista and Linux. Currently, this is how the boot sequence is on my notebook. ->Initial boot screen : Grub (1-Linux, 2-Windows Vista) ->Once I select Windows, I get is another boot selection option 1-Microsoft Vista, 2-Linux. What I prefer is to have only one boot option screen that is second one (Which i suppose is Windows Vista's bootloader), at the same time I want to keep Linux partition intact. Simply putting it, I want to get rid of Grub bootloader, without getting rid of Linux partition. If I follow your tutorial will I be able to achieve it ??? What is the standard procedure to install Linux, on a system with MS Vista, without disturbing the bootloader? thanks in advance. cheers!! Ok, the easiest thing to do is to use easybcd to remove the option of linux, then to reinstall the grub bootloader, which should give you your one bootloader screen, and still allow you to access both ubuntu and windows. Your other option is to reinstall the vista bootloader, and edit the grub so it only has one option. It is up to you
Ok, so I hosed something up... System: Dell D820, 2 GB RAM, 80GB HD, T5500 processor I've been playing with both XP and Ubuntu, and finally settled on a dual boot. So, I read through all the threads and it seemed to say that it was best to start with WinXP and then boot up in to ubuntu and tell it to do a side by side install> Put in the WinXP disk, had it wipe all the partitions (there were many) back to 1 big partition. Got XP set up. Then put in the Ubuntu disk, told it to side by side install - it did, then said it needed to reboot... now I get GRUB Loading stage1.5. GRUB loading, please wait... Error 22 I tried the above thread to reload the Ubuntu grub - no joy, still get the Error 22. So I loaded the Ubuntu CD and ran fdisk -l: ubuntu@ubuntu: ~$ sudo fdisk -l Disk /dev/sda:80.0 GB, 80026361856 bytes 255 heads, 63 sectors/track, 9729 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes Disk identifier: 0x41ab2316 Device Boot Start End Blocks Id System /dev/sda1 * 1 9729 78148161 7 HPFS/NTFS I'm not an expert, but to me, I don't see where there's a Ubuntu partition here...am I missing something?
Ok, might have solved my own problem. I ran the above WinXP recovery, including fixboot and fixmbr, and it booted fine. Then, in Computer Management, I looked at Disk Management, and it ONLY shows the C: partition...guess I messed up the Ubuntu load...will let you know after I try again! Thanks!
Yeah! So it worked - actually followed the dual-boot instructions and setup the partitions ahead of time...all is well now! Thanks for the thread.
No problem, always glad to help!
Hey member me??!!! Good to know I bookmarked this as reference! Needed it this evening
Lenovo ThinkPad X200Tablet Lenovo ThinkPad T500 W7/Ubuntu 13.04
Originally Posted by emeraldgirl08 Hey member me??!!! Good to know I bookmarked this as reference! Needed it this evening Haha, cool, happy to help again. I will be making a few screencasts to accompany this post, so that should be done in a few days.
Put xp on an old laptop of mines that already had ubuntu, and obviously the GRUB menu has gone. Followed these steps and i've gotten this error message- Checking if "/boot/grub/stage1" exists... yes Checking if "/boot/grub/stage2" exists... yes Checking if "/boot/grub/e2fs_stage1_5" exists... yes Running "embed /boot/grub/e2fs_stage1_5 (hd0)"... 17 sectors are embedded. succeeded Running "install /boot/grub/stage1 (hd0) (hd0)1+17 p (hd0,5)/boot/grub/stage2 /boot/grub/menu.lst"... failed Error 12: Invalid device requested Tried the suggestions here aswell- https://help.ubuntu.com/community/Re...tallingWindows Any thoughts? Im still learning this stuff, any help is greatly appreciated. Soon i'll hopefully be giving advice back! Thanks
"if he dies, he dies" - nemanja vidic
View Tag Cloud
Ubuntu Forums Code of Conduct