sábado, 3 de dezembro de 2011

How to boot Linux with Windows XP bootloader

So you want to setup dual boot on your computer but do not want to install Grub or LILO, then read on….

Otherwise, if you are want to avoid Windows over writing Grub or LILO every time you setup Windows, then you can sacrifice the powers of Grub and keep Windows Boot Loader to boot you into Linux.

Here are the suggested steps: (Ideal case)

1) Install Linux Grub or LILO on the same partition and NOT ON THE MBR (CAUTION!)

2) Windows XP Loader (NT Loader) needs Linux Master Boot Record (MBR) to boot into Linux.
If you can boot into Linux (or already on Linux after install), grab the first 512 bytes of boot sector from the root partition of Linux where Grub is installed “/dev/sdaX” where “X” is the partition number you installed Linux root directory “/”. Then copy it to an external drive or mount the Windows partition and save it in the root directory, usually the: “C:\”.
To save the boot sector use this Linux command: 
 dd if=/dev/sdaN of=grub.bin bs=512 count=1
3) To setup Windows bootloader to load Linux, we need to add an entry corresponding to Linux.
Boot into Windows. Set appropriate attributes for boot.ini so that it is editable.
attrib -r -w -s c:\boot.ini
Add the following entry to the end of the file boot.ini:
c:\grub.bin="Ubuntu Linux ver. X.YZ"
where “X.YZ” is the version number of Linux you just installed.
Restart the machine and Windows XP boot loader shows Ubuntu Linux 7.10 as one of the options.
Select this option and viola! you should see Linux booting.

For more detailed instructions follow this : http://www.tprthai.net/bootmgr.htm
http://www.supergrubdisk.org/ provides a specialized rescue disk to restore Windows/Linux. I haven’t used it anytime though.

Here is a additional twist!

In my case, I had an existing Linux installation but I could not boot into Linux and I didn’t have a rescue disk. I installed Ext2 IFS For Windows and copied MBR which I had extracted previously before I wiped out Grub by accident. That saved my day.

You could also use “dd” for windows, but the partition numbering is “tricky”...see more about this here: http://www.chrysocome.net/dd

Some useful tips:

1) If you get a error like “hal.dll” is missing – usually is a file name problem, for exemple if you file is named “linux.bin.bin” and in the boot.ini you put “linux.bin”. Windows usually hides the extension by default and that may mislead you.

2) If you have a disk with partition say: “sda” and 3 partitions: win, linux, swap.
when you formated the windows it can destroyed the partition and then when create the part again with a new number. So before you formatted the partition Linux could be “sda3” and after it could became “sda2”. The solution is to swap the lines in “fstab”.

3) You can recover or access your new installation of Linux (that you did not put the bootloader in MBR) using the installation CD – recovery mode.
  • Insert your Ubuntu CD, reboot your computer and set it to boot from CD in the BIOS and boot into a live session. You can also use a LiveUSB if you have created one in the past.
  • Install and run Boot-Repair
  • After this, click "Recommended repair" and apply. If you are willing to use the advanced options, make sure you leave the "Reinstall GRUB" checkbox ticked.
  • Now reboot your system. The usual GRUB boot menu should appear. If it does not, hold Left Shift while booting. You will be able to choose between Ubuntu and Windows.
See more here:

Nenhum comentário:

Postar um comentário