How to dual boot Linux and Windows XP

I have both seen and heard from many communities the confusion about dual-booting Windows and Ubuntu, or any Linux at that matter) with the Linux distribution installed first so as I am doing it to my virtual machine and my hard drive first thing after, I thought I may as well write the tutorial for you all to follow or do whatever with.
With the new GRUB 2′s recent release, there has been a lot of messing around with GRUB Legacy which, to be honest, there’s no need for. This tutorial will assume that you have Linux installed on your hard drive/virtual machine and just installed Windows to it but have lost your choice of booting Linux on startup. This is caused by Microsoft wanting their virus to pwn the rest and they overwrite the MBR only for their own operating systems. So we are going to re-install GRUB to the MBR.
There’s only one requirement: You need a Live CD with which you can boot into.
Using your Live CD, boot into the Ubuntu pre-installed environment. Once in, make sure that your Linux partition is mounted. You can check this by copying the following and seeing the same or similar output to the command-line:
And take a note the designation for the disk /dev/sda which you will be using later, and the directory in /media. It may even be /dev/hda depending on your hard drive’s framework. And also, the long directory with letters and numbers after /media/. This is the directory of the partition. In the example, I’ll use my own but you may need to change yours accordingly.
 
ls /media/bdd1efeb-e61f-467a-968c-8cea0af9349b/boot
 
You should have an output that looks like:

Now that you’ve got what you need mounted, run the following command to rewrite GRUB to your MBR:
 
sudo grub-install --root-directory=/media/bdd1efeb-e61f-467a-968c-8cea0af9349b /dev/sda
 
Once this is done, you will see a similar output to this:
If this did not work and you get BIOS warnings, try:
 
sudo grub-install --root-directory=/media/0d104aff-ec8c-44c8-b811-92b993823444 /dev/sda --recheck
 
And you should see a similar output to the above picture:
If for some reason the GRUB menu does not display Windows after your reboot, run into Ubuntu, open a terminal and run the following command:
 
sudo update-grub2
 
Now all you have to do is reboot making sure to boot to your hard drive and not to the live CD. GRUB should be installed and both Ubuntu and Windows should have been automatically detected and listed in the menu.
The Master Boot Record will execute GRUB as the initial bootloader. The Windows bootloader is contained within the Windows partition and will then be chainloaded by the GRUB bootloader.
It should work now. Any questions; ask.
Enjoy. :)

0 comments:

Post a Comment