Dual boot Windows XP and Ubuntu: XP won't boot.

Markus Schönhaber ubuntu-users at list-post.mks-mail.de
Mon Aug 17 21:35:06 UTC 2009


Dotan Cohen:

>> My guess would be that Windows gets confused from not being on the first
>> (BIOS) disk any more as it was when installed.
> 
> Does Windows know that it is on the boot disk or not? I've never had
> this problem before, and I have installed dual-boot systems in the
> past.

I don't know if Windows "knows" where it is installed. But I guess the
Windows boot code in the MBR will try to execute the code in the Windows
partition's boot sector on the first disk. After swapping drives in the
BIOS there's no Windows boot sector on the first disk any more and
booting fails. But as I said: I'm only guessing here.

> I don't want to touch the Windows disk as it is a pirate install and I
> won't fix it if I break it. I only fix legal Windows.

Might be a good idea to make a backup of the MBR of the Windows disk then:
dd if=/dev/sda of=windows.mbr bs=512 count=1
writes the first 512 Bytes of sda (the MBR) to the file windows.mbr in
the current directory. Of cause, provided sda is the disk with windows
on it. You need root rights for this, BTW.
In fact, you'd only need the first 440 Bytes which actually contain the
boot code. The remaining Bytes are occupied by the disk signature,
partition table etc. which one probably doesn't want to overwrite with
different values when restoring the boot code.

>> An alternative could be:
>> - Reset BIOS to boot from Windows disk,
>> - install GRUB in some other location - for example the MBR of the
>> second disk,
>> - copy the second disk's MBR (or at least the part containing GRUB's
>> boot code) to a file on the Windows partition, say C:\linux.bin
> 
> I did not know that this was possible. I will google this. If you have
> an informative link to share, I'd appreciate that too. Thanks!

I think that there's an article about GRUB in Ubuntu's community
documentation.
Anyway, there's not much to it:
- After resetting the drive order of the BIOS, boot a live CD of your
choice,
- invoke the grub shell and do
root (hd1,0)
setup (hd1)
quit
assuming that your Linux boot partition (if any, root partition
otherwise) is the first partition on the second drive: (hd1,0). Assuming
further that GRUB's stage1 boot code is to be written into the MBR of
the second drive (hd1).
BTW: at least the 32-bit versions of the GRUB shell have TAB-completion.
So, if you type
root (hd<TAB>
you should get a list of drives and typing
root (hd1,<TAB>
should display a list of partitions on that disk. This is an easy way to
check if you're really fiddling with the disk/partition you think you are.

After you're done, use dd similar to above to copy this MBR to a file
and transfer it to Windows.

-- 
Regards
  mks





More information about the ubuntu-users mailing list