Page 1 of 1

Dual boot - Ubuntu and XP

Posted: Thu May 10, 2007 7:57 am
by Oren
Ok, here is the background: I've installed Ubuntu 7.04 on one HD (master). Later I plugged my other HD which has XP on it as a slave. Now that's fine and I can see my files in the XP HD from Ubuntu. I didn't need to do anything, I just plugged the XP HD as a slave and Ubuntu sees it without a problem. Now what I want is to be able to boot from the XP HD too. I edited 2 files in Ubuntu.

1.
/boot/grub/device.map:
(original as came with Ubuntu - how it looked before I edited it)

Code: Select all

(hd0)	/dev/hda
/boot/grub/device.map:
(after my edit)

Code: Select all

(hd0)	/dev/hda
(hd1)	/dev/hdb
2.
/boot/grub/menu.lst:
(I appended to it the data below)

Code: Select all

title		Microsoft Windows XP Professional

root		(hd1,0)

makeactive

chainloader	+1
I also tried this instead:

Code: Select all

title		Microsoft Windows XP Professional

root		(hd1,0)
map (hd0) (hd1)

map (hd1) (hd0)

makeactive

chainloader	+1
And also this instead:

Code: Select all

title		Microsoft Windows XP Professional

root		(hd1,0)
map (hd0,0) (hd1,0)

map (hd1,0) (hd0,0)

makeactive

chainloader	+1
None of them works. I see the boot menu and can boot from Ubuntu without a problem, but when I choose to boot from XP I get this error:
Error 21: Selected drive does not exist
More info:

- Both HD's are connected on the same IDE cable (Ubuntu's HD as a Master and XP's HD as the slave)
- The XP HD has 2 partitions: C:\ and D:\. XP is installed on C:\

Edit: If that helps, here is what "fdisk -l" outputs:

Code: Select all

Disk /dev/hda: 6448 MB, 6448619520 bytes
255 heads, 63 sectors/track, 784 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

   Device Boot      Start         End      Blocks   Id  System
/dev/hda1   *           1         743     5968116   83  Linux
/dev/hda2             744         784      329332+   5  Extended
/dev/hda5             744         784      329301   82  Linux swap / Solaris

Disk /dev/hdb: 20.0 GB, 20020396032 bytes
255 heads, 63 sectors/track, 2434 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

   Device Boot      Start         End      Blocks   Id  System
/dev/hdb1   *           1        2269    18225711    7  HPFS/NTFS
/dev/hdb2            2270        2433     1317330    f  W95 Ext'd (LBA)
/dev/hdb5            2270        2433     1317298+   b  W95 FAT32

Posted: Thu May 10, 2007 8:39 am
by Jenk
try..

Code: Select all

title Ubuntu
root (hd0,0)/nameofyourimagefile

title windows
map (hd0) (hd1)
map (hd1) (hd0)
root (hd0,0)
makeactive
chainloader +1

Posted: Thu May 10, 2007 8:48 am
by Oren
Jenk wrote:

Code: Select all

title Ubuntu
root (hd0,0)/nameofyourimagefile
"nameofyourimagefile"? What's that?

Where to try your code by the way? You added there "title Ubuntu", so... Do I put all of your code instead of what I appended or do I need to make any other changes?

Posted: Thu May 10, 2007 10:17 am
by Jenk
"nameofyourimagefile" is the name of your kernel image.

It's entries for both ubuntu and windows in your menu.lst (sometimes known as grub.conf)

Posted: Thu May 10, 2007 10:44 am
by Oren
Then what should I put instead of it? :?

Posted: Thu May 10, 2007 11:00 am
by Jenk
If you already have an entry for ubuntu, nothing. Just use the windows part.

Posted: Thu May 10, 2007 11:35 am
by Oren
Of course I already have an entry for Ubuntu - I installed Ubuntu on this HD :P
Anyways, it doesn't work. Any ideas?

Posted: Thu May 10, 2007 11:41 am
by Chris Corbyn
Based on your fdisk output I could swear this one should have worked (kill the double line breaks by the way).

Code: Select all

title      Microsoft Windows XP Professional
root      (hd1,0)
makeactive
chainloader   +1
boot
:(

Posted: Thu May 10, 2007 11:48 am
by Jenk
Windows doesn't like it's bootloader being on anything but the first partition on the first disk. (YAY MS BRAINBOXES!) which is why we can use the map grub function to spoof it as hd0,0.

Posted: Thu May 10, 2007 11:58 am
by Oren
Thanks for the help guys, but it still doesn't work.
d11wtq: I have no idea how the double line breaks reach there, but they don't exist in my file - just in the post above.

Posted: Fri May 11, 2007 9:13 am
by Oren
Bump. Anyone?