Dual boot - Ubuntu and XP

Whether you are using Linux on the desktop or as a server, it's still good that you're using Linux. Linux related questions go here.

Moderator: General Moderators

Post Reply
User avatar
Oren
DevNet Resident
Posts: 1640
Joined: Fri Apr 07, 2006 5:13 am
Location: Israel

Dual boot - Ubuntu and XP

Post 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
User avatar
Jenk
DevNet Master
Posts: 3587
Joined: Mon Sep 19, 2005 6:24 am
Location: London

Post 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
User avatar
Oren
DevNet Resident
Posts: 1640
Joined: Fri Apr 07, 2006 5:13 am
Location: Israel

Post 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?
User avatar
Jenk
DevNet Master
Posts: 3587
Joined: Mon Sep 19, 2005 6:24 am
Location: London

Post 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)
User avatar
Oren
DevNet Resident
Posts: 1640
Joined: Fri Apr 07, 2006 5:13 am
Location: Israel

Post by Oren »

Then what should I put instead of it? :?
User avatar
Jenk
DevNet Master
Posts: 3587
Joined: Mon Sep 19, 2005 6:24 am
Location: London

Post by Jenk »

If you already have an entry for ubuntu, nothing. Just use the windows part.
User avatar
Oren
DevNet Resident
Posts: 1640
Joined: Fri Apr 07, 2006 5:13 am
Location: Israel

Post 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?
User avatar
Chris Corbyn
Breakbeat Nuttzer
Posts: 13098
Joined: Wed Mar 24, 2004 7:57 am
Location: Melbourne, Australia

Post 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
:(
User avatar
Jenk
DevNet Master
Posts: 3587
Joined: Mon Sep 19, 2005 6:24 am
Location: London

Post 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.
User avatar
Oren
DevNet Resident
Posts: 1640
Joined: Fri Apr 07, 2006 5:13 am
Location: Israel

Post 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.
User avatar
Oren
DevNet Resident
Posts: 1640
Joined: Fri Apr 07, 2006 5:13 am
Location: Israel

Post by Oren »

Bump. Anyone?
Post Reply