LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Can't get Karmic & XP to dual boot (https://www.linuxquestions.org/questions/linux-newbie-8/cant-get-karmic-and-xp-to-dual-boot-770138/)

von Stalhein 11-19-2009 01:49 AM

Can't get Karmic & XP to dual boot
 
Hello all,
This has had me vexed for 3 days :-(

I went from 9.04 to 9.10, and despite a few issues that I've now sorted, it's all good.

However, the rest of the family is yet to be convinced of the benefits of 'nix OS's, and therefore this system has always been a dual boot with XP.

Since GRUB 2 I can't get that to happen.

The machine has 3 HHDs, 1 with XP, 1 with Windows data & games, and one with Karmic.

fdisk -l output
Code:

Disk /dev/sda: 120.0 GB, 120034123776 bytes
255 heads, 63 sectors/track, 14593 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0xa3f79c20

  Device Boot      Start        End      Blocks  Id  System
/dev/sda1  *          2      14593  117210240    f  W95 Ext'd (LBA)
/dev/sda5              2      14593  117210208+  7  HPFS/NTFS

Disk /dev/sdb: 120.0 GB, 120034123776 bytes
255 heads, 63 sectors/track, 14593 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x960c960c

  Device Boot      Start        End      Blocks  Id  System
/dev/sdb1  *          1      14593  117218241    7  HPFS/NTFS

Disk /dev/sdc: 160.0 GB, 160041885696 bytes
255 heads, 63 sectors/track, 19457 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0xf66fc667



  Device Boot      Start        End      Blocks  Id  System
/dev/sdc1  *          1        1309    10514511  83  Linux
/dev/sdc2            1310      18705  139733370  83  Linux
/dev/sdc3          18706      19457    6040440    5  Extended
/dev/sdc5          18706      19457    6040408+  82  Linux swap / Solaris

blkd output
Code:

/dev/sda5: UUID="A83CB1173CB0E18C" LABEL="Disk 2" TYPE="ntfs"
/dev/sdb1: UUID="01C3D871F965AC80" LABEL="DSK1_VOL1" TYPE="ntfs"
/dev/sdc1: UUID="ece48d4f-95ce-4c32-8ae6-20c3f3563597" TYPE="ext4"
/dev/sdc2: UUID="b073ff20-47f8-440f-98fc-5bbc5fcbbd8d" TYPE="ext4"
/dev/sdc5: UUID="27179ee5-e990-4dcb-9fc8-a5857a0f1b37" TYPE="swap"

Device map is: -
Code:

(hd0)        /dev/sdb
(hd1)        /dev/sda
(hd2)        /dev/sdc

and grub.cfg file output : -
Code:

#
# DO NOT EDIT THIS FILE
#
# It is automatically generated by /usr/sbin/grub-mkconfig using templates
# from /etc/grub.d and settings from /etc/default/grub
#

### BEGIN /etc/grub.d/00_header ###
if [ -s /boot/grub/grubenv ]; then
  have_grubenv=true
  load_env
fi
set default="0"
if [ ${prev_saved_entry} ]; then
  saved_entry=${prev_saved_entry}
  save_env saved_entry
  prev_saved_entry=
  save_env prev_saved_entry
fi
insmod ext2
set root=(hd2,1)
search --no-floppy --fs-uuid --set ece48d4f-95ce-4c32-8ae6-20c3f3563597
if loadfont /usr/share/grub/unicode.pf2 ; then
  set gfxmode=640x480
  insmod gfxterm
  insmod vbe
  if terminal_output gfxterm ; then true ; else
    # For backward compatibility with versions of terminal.mod that don't
    # understand terminal_output
    terminal gfxterm
  fi
fi
if [ ${recordfail} = 1 ]; then
  set timeout=-1
else
  set timeout=10
fi
### END /etc/grub.d/00_header ###

### BEGIN /etc/grub.d/05_debian_theme ###
set menu_color_normal=white/black
set menu_color_highlight=black/white
### END /etc/grub.d/05_debian_theme ###

### BEGIN /etc/grub.d/10_linux ###
menuentry "Ubuntu, Linux 2.6.31-14-generic" {
        recordfail=1
        if [ -n ${have_grubenv} ]; then save_env recordfail; fi
        set quiet=1
        insmod ext2
        set root=(hd2,1)
        search --no-floppy --fs-uuid --set ece48d4f-95ce-4c32-8ae6-20c3f3563597
        linux        /boot/vmlinuz-2.6.31-14-generic root=UUID=ece48d4f-95ce-4c32-8ae6-20c3f3563597 ro  quiet splash
        initrd        /boot/initrd.img-2.6.31-14-generic
}
menuentry "Ubuntu, Linux 2.6.31-14-generic (recovery mode)" {
        recordfail=1
        if [ -n ${have_grubenv} ]; then save_env recordfail; fi
        insmod ext2
        set root=(hd2,1)
        search --no-floppy --fs-uuid --set ece48d4f-95ce-4c32-8ae6-20c3f3563597
        linux        /boot/vmlinuz-2.6.31-14-generic root=UUID=ece48d4f-95ce-4c32-8ae6-20c3f3563597 ro single
        initrd        /boot/initrd.img-2.6.31-14-generic
}
### END /etc/grub.d/10_linux ###

### BEGIN /etc/grub.d/20_memtest86+ ###
menuentry "Memory test (memtest86+)" {
        linux16        /boot/memtest86+.bin
}
menuentry "Memory test (memtest86+, serial console 115200)" {
        linux16        /boot/memtest86+.bin console=ttyS0,115200n8
}
### END /etc/grub.d/20_memtest86+ ###

### BEGIN /etc/grub.d/30_os-prober ###
menuentry "Microsoft Windows XP Home Edition (on /dev/sdb1)" {
        insmod ntfs
        set root=(hd0,1)
        search --no-floppy --fs-uuid --set 01c3d871f965ac80
        drivemap -s (hd0) ${root}
        chainloader +1
}
### END /etc/grub.d/30_os-prober ###

### BEGIN /etc/grub.d/40_custom ###
# This file provides an easy way to add custom menu entries.  Simply type the
# menu entries you want to add after this comment.  Be careful not to change
# the 'exec tail' line above.
### END /etc/grub.d/40_custom ###

Solutions gratefully accepted!!!

ronlau9 11-19-2009 05:09 AM

On which drive is windows xp ?
Because on one hand it says windows on sdb1 that is (hd1,0)
But root is set for windows as (hd0,0) that is sda1
So on which drive and partition is windows xp

tommcd 11-19-2009 06:16 AM

Ubuntu Karmic 9.10 uses grub2. See this tutorial on grub2:
https://wiki.ubuntu.com/Grub2
First open a terminal and try running:
Code:

sudo update-grub
This should update your grb.cfg file and hopefully add Windows to the list so you can boot it.
Also, did you do a dist-upgrade from 9.04 to 9.10, or did you do a clean install of 9.10? If you did an upgrade then I would recommend fully upgrading to grub2 as per this part of the tutorial:
https://wiki.ubuntu.com/Grub2#Instal...untu%209.10%29
Then try running: "sudo update-grub" again. Then reboot.
If updating grub does not fix the problem, you can create a custom entry for XP in /etc/grub.d/ as per this part of the same tutorial:
https://wiki.ubuntu.com/Grub2#User-defined%20Entries
The entry for XP would look something like this:
Code:

echo "Adding WindowsXP" >&2
cat << EOF
menuentry "Microsoft Windows XP Home Edition (on /dev/sda1)" {
        set root=(hd0,1)
        chainloader +1
}
EOF

Be sure to change (hd0,1) to your XP partition. Remember, grub2 counts hard drives from 0 like grub-legacy, but counts partitions from 1, not 0.
Be sure to run: "sudo update-grub" after creating a custom entry.

von Stalhein 11-19-2009 08:24 PM

Thanks guys - FYI those outputs were the result after running sudo update-grub.

The install is a clean one from the Alternate CD, as I couldn't get a GUI from either it or the desktop ISO (that's another story!!!)

I was confused as well by the XP drive being labelled by the GRUB menu as /dev/sdb1, I thought it was /dev/sda as well. Is that to do with the different way it now counts?

I'm sure Karmic is on /dev/sdc

blkid reports XP as on /dev/sdb1, whereas fdisk says it's /dev/sda1 - am I reading that right?

I'm not on that machine atm, but I will have a go at it later (about 7 or 8 hours local time) when I get home.


oh, btw, I've checked that the XP install is still OK by changing the boot order in BIOS and booting to it.
I will report back.

von Stalhein 11-20-2009 04:00 AM

I tried the custom entry method without luck :-( Various combinations of drives/partitions. After changing options, I chmodded and updated GRUB, and then rebooted. Countlessly.

I also installed the GRUB 2 to the /dev/sda and lost the ability to boot XP when it was moved in the bIOS boot order. Even though I tried 3 times to restore the mbr with the XP disk it failed.

However, I had a Supergrub CD, and it did the job, thank the flying spaghetti monster!!!

It's weird,even though there are 3 HDDs in this box, the HDD access LED is only hooked up to the XP c: disk. When GRUB is directed to pick that menu choice (the default one from the install process - /dev/sdb1), the drive light goes on.

If I ctrl-alt-del before the blinking cursor disappears, the system will reboot.

firewiz87 11-20-2009 05:40 AM

clarify the following please:

In which drive is grub installed to??
Where is your windows installation??
Have you explicitly set the device mappings??

tommcd 11-20-2009 05:54 AM

Quote:

Originally Posted by von Stalhein (Post 3763360)

I was confused as well by the XP drive being labelled by the GRUB menu as /dev/sdb1, I thought it was /dev/sda as well. Is that to do with the different way it now counts?

I'm sure Karmic is on /dev/sdc

blkid reports XP as on /dev/sdb1, whereas fdisk says it's /dev/sda1 - am I reading that right?

You have 2 NTFS partitions according to fdisk and blkid: /dev/sda5 and /dev/sdb1. Do you know which one is XP?
Your grub.cfg says:
Code:

### BEGIN /etc/grub.d/30_os-prober ###
menuentry "Microsoft Windows XP Home Edition (on /dev/sdb1)" {
        insmod ntfs
        set root=(hd0,1)
        search --no-floppy --fs-uuid --set 01c3d871f965ac80
        drivemap -s (hd0) ${root}
        chainloader +1
}

But the set root= line in grub2 is (or at least was before you used Super Grub disc) pointing to /dev/sda1 (hd0,1). Remember, grub2 starts counting hard drives from 0, but partitions start from 1.
If XP is on /dev/sdb1, that would be (hd1,1) in grub2. So a custom entry in /etc/grub.d for XP would be something like:
Code:

echo "Adding WindowsXP" >&2
cat << EOF
menuentry "Microsoft Windows XP Home Edition (on /dev/sda1)" {
        insmod ntfs
        set root=(hd1,1)
        drivemap -s (hd1) ${root}
        chainloader +1
}
EOF

The lines I have put in bold may be optional. I'm not sure if you need them or not for Windows. I'm still trying to get up to speed with grub2 myself.

von Stalhein 11-20-2009 06:19 PM

Quote:

Originally Posted by firewiz87 (Post 3763732)
clarify the following please:

In which drive is grub installed to??
Where is your windows installation??
Have you explicitly set the device mappings??

Thanks again for your interest all:

GRUB is installed to dev/sdc - Karmic drive, in the / partition, according to
Code:

sudo file -s /dev/sdXX
The Karmic drive (dev/sdc) is partitioned to a / (about 10G), /home (about 140G)and /swap (about 6G)

XP is on dev/sdb1, media/DSK1_VOL1 (OS & the usual Win data, games etc)

The other disk is dev/sda5, media/Disk2 (Data, games, music etc.)

I have not changed the device mappings.

I checked grub.cfg after the SuperGrub rescue, and nothing's changed, other than since then I've had a kernel update to 2.6.31-15

sudo ls -l /dev/disk/by-uuid returns
Code:

total 0
lrwxrwxrwx 1 root root 10 2009-11-21 20:42 01C3D871F965AC80 -> ../../sdb1
lrwxrwxrwx 1 root root 10 2009-11-21 20:42 27179ee5-e990-4dcb-9fc8-a5857a0f1b37 -> ../../sdc5
lrwxrwxrwx 1 root root 10 2009-11-21 20:42 A83CB1173CB0E18C -> ../../sda5
lrwxrwxrwx 1 root root 10 2009-11-21 20:42 b073ff20-47f8-440f-98fc-5bbc5fcbbd8d -> ../../sdc2
lrwxrwxrwx 1 root root 10 2009-11-21 20:42 ece48d4f-95ce-4c32-8ae6-20c3f3563597 -> ../../sdc1

Thanks again for any help.

firewiz87 11-21-2009 09:49 AM

Do the following:
1. Set the BIOS boot order such that the hard disk "sdc" (the third HDD) gets first priority.
2. Create (add) an entry as follows in grub.cfg:

Code:

menuentry "Microsoft Windows XP Home Edition (on /dev/sdb1)" {
        set root=(hd1,1)
        chainloader +1
}

Try booting to this entry n let me know what happens.

By the way if u didnt explicitly set the mappings how/from where did you list it in post #1??

von Stalhein 11-21-2009 04:34 PM

Quote:

Originally Posted by firewiz87 (Post 3764967)
Do the following:
1. Set the BIOS boot order such that the hard disk "sdc" (the third HDD) gets first priority.
2. Create (add) an entry as follows in grub.cfg:

Code:

menuentry "Microsoft Windows XP Home Edition (on /dev/sdb1)" {
    set root=(hd1,1)
    chainloader +1
}

Try booting to this entry n let me know what happens.

By the way if u didnt explicitly set the mappings how/from where did you list it in post #1??

1. The boot order has /dev/sdc as the first in order. The BIOS calls /dev/sdc SCSI-0, /dev/sdb Ch0-M, and /dev/sda Ch0-S

2. Created an entry as detailed above in etc/grub.d, called it "50_addxp" and chmodded it. When selected in the GRUB 2 menu it returns "error, no such partition.

I got the device map listings by looking in /boot/grub/device.map

firewiz87 11-22-2009 07:49 AM

Is nt the grub.cfg file in /boot/grub??

try setting root=(hd0,1) in the above cose i mentioned and see....

By the way, wat is the output that you get whem u try the windowzz option that was created by default???

von Stalhein 11-23-2009 01:02 AM

No luck with the (hd0,1) change.

I tried to make it simpler for poor old GRUB by removing the disk without an OS on it. It still won't kick XP in to boot.

It might sound weird, but on selecting the XP menuentry the HDD light activates while the blinking cursor appears in the top LHS of the screen, and then it goes jet black and requires a hard reset to get back to the GRUB menu. I know it's that drive as it was the first one I installed when I built the machine, and the only one hooked up to a LED.

It's as if there's not enough of something to get it over the boot hump :) I've changed the boot order to check that XP boots OK, and it's fine. I wonder if there's some sort of parameter in GRUB that needs to be added or removed to let it start?

As before, in the BIOS the Karmic disk is first in order.

Grub.cfg is now:
Code:

#
# DO NOT EDIT THIS FILE
#
# It is automatically generated by /usr/sbin/grub-mkconfig using templates
# from /etc/grub.d and settings from /etc/default/grub
#

### BEGIN /etc/grub.d/00_header ###
if [ -s /boot/grub/grubenv ]; then
  have_grubenv=true
  load_env
fi
set default="0"
if [ ${prev_saved_entry} ]; then
  saved_entry=${prev_saved_entry}
  save_env saved_entry
  prev_saved_entry=
  save_env prev_saved_entry
fi
insmod ext2
set root=(hd1,1)
search --no-floppy --fs-uuid --set ece48d4f-95ce-4c32-8ae6-20c3f3563597
if loadfont /usr/share/grub/unicode.pf2 ; then
  set gfxmode=640x480
  insmod gfxterm
  insmod vbe
  if terminal_output gfxterm ; then true ; else
    # For backward compatibility with versions of terminal.mod that don't
    # understand terminal_output
    terminal gfxterm
  fi
fi
if [ ${recordfail} = 1 ]; then
  set timeout=-1
else
  set timeout=15
fi
### END /etc/grub.d/00_header ###

### BEGIN /etc/grub.d/05_debian_theme ###
set menu_color_normal=white/black
set menu_color_highlight=black/white
### END /etc/grub.d/05_debian_theme ###

### BEGIN /etc/grub.d/10_linux ###
menuentry "Ubuntu, Linux 2.6.31-15-generic" {
        recordfail=1
        if [ -n ${have_grubenv} ]; then save_env recordfail; fi
    set quiet=1
    insmod ext2
    set root=(hd1,1)
    search --no-floppy --fs-uuid --set ece48d4f-95ce-4c32-8ae6-20c3f3563597
    linux    /boot/vmlinuz-2.6.31-15-generic root=UUID=ece48d4f-95ce-4c32-8ae6-20c3f3563597 ro  quiet splash
    initrd    /boot/initrd.img-2.6.31-15-generic
}
menuentry "Ubuntu, Linux 2.6.31-15-generic (recovery mode)" {
        recordfail=1
        if [ -n ${have_grubenv} ]; then save_env recordfail; fi
    insmod ext2
    set root=(hd1,1)
    search --no-floppy --fs-uuid --set ece48d4f-95ce-4c32-8ae6-20c3f3563597
    linux    /boot/vmlinuz-2.6.31-15-generic root=UUID=ece48d4f-95ce-4c32-8ae6-20c3f3563597 ro single
    initrd    /boot/initrd.img-2.6.31-15-generic
}
menuentry "Ubuntu, Linux 2.6.31-14-generic" {
        recordfail=1
        if [ -n ${have_grubenv} ]; then save_env recordfail; fi
    set quiet=1
    insmod ext2
    set root=(hd1,1)
    search --no-floppy --fs-uuid --set ece48d4f-95ce-4c32-8ae6-20c3f3563597
    linux    /boot/vmlinuz-2.6.31-14-generic root=UUID=ece48d4f-95ce-4c32-8ae6-20c3f3563597 ro  quiet splash
    initrd    /boot/initrd.img-2.6.31-14-generic
}
menuentry "Ubuntu, Linux 2.6.31-14-generic (recovery mode)" {
        recordfail=1
        if [ -n ${have_grubenv} ]; then save_env recordfail; fi
    insmod ext2
    set root=(hd1,1)
    search --no-floppy --fs-uuid --set ece48d4f-95ce-4c32-8ae6-20c3f3563597
    linux    /boot/vmlinuz-2.6.31-14-generic root=UUID=ece48d4f-95ce-4c32-8ae6-20c3f3563597 ro single
    initrd    /boot/initrd.img-2.6.31-14-generic
}
### END /etc/grub.d/10_linux ###

### BEGIN /etc/grub.d/20_memtest86+ ###
menuentry "Memory test (memtest86+)" {
    linux16    /boot/memtest86+.bin
}
menuentry "Memory test (memtest86+, serial console 115200)" {
    linux16    /boot/memtest86+.bin console=ttyS0,115200n8
}
### END /etc/grub.d/20_memtest86+ ###

### BEGIN /etc/grub.d/30_os-prober ###
menuentry "Microsoft Windows XP Home Edition (on /dev/sda1)" {
    insmod ntfs
    set root=(hd0,1)
    search --no-floppy --fs-uuid --set 01c3d871f965ac80
    drivemap -s (hd0) ${root}
    chainloader +1
}
### END /etc/grub.d/30_os-prober ###

### BEGIN /etc/grub.d/40_custom ###
# This file provides an easy way to add custom menu entries.  Simply type the
# menu entries you want to add after this comment.  Be careful not to change
# the 'exec tail' line above.
### END /etc/grub.d/40_custom ###

blkid is now
Code:

/dev/sda1: UUID="01C3D871F965AC80" LABEL="DSK1_VOL1" TYPE="ntfs"
/dev/sdb1: UUID="ece48d4f-95ce-4c32-8ae6-20c3f3563597" TYPE="ext4"
/dev/sdb2: UUID="b073ff20-47f8-440f-98fc-5bbc5fcbbd8d" TYPE="ext4"
/dev/sdb5: UUID="27179ee5-e990-4dcb-9fc8-a5857a0f1b37" TYPE="swap"

As you can see, XP is on /dev/sda1, and Karmic / is on /dev/sdb1

BTW, grub.cfg is in boot/grub/, but the config files that make it up are in etc/grub.d/

firewiz87 11-23-2009 02:18 AM

ok.. I never needed to work in /etc/grub.d. Modifying /boot/grub.cfg always gave me the required output.

Grub will not work if you take off a HDD simply because doing so will change the device mappings.

Could you create a new grub.cfg file in /boot/grub (just rename the existing one) and just put in the following entries:

Code:

menuentry "Ubuntu, Linux 2.6.31-15-generic" {
    set root=(hd1,1)
    search --no-floppy --fs-uuid --set ece48d4f-95ce-4c32-8ae6-20c3f3563597
    linux    /boot/vmlinuz-2.6.31-15-generic root=UUID=ece48d4f-95ce-4c32-8ae6-20c3f3563597 ro  quiet splash
    initrd    /boot/initrd.img-2.6.31-15-generic
}

menuentry "Microsoft Windows XP Home Edition (on /dev/sda1)" {
    set root=(hd0,1)
    chainloader +1
}

And see what happens... I am assuming that you have grub installed to mbr of /dev/sdb which should have higher boot priiority

von Stalhein 11-24-2009 02:40 AM

Quote:

Originally Posted by firewiz87 (Post 3766417)
ok.. I never needed to work in /etc/grub.d. Modifying /boot/grub.cfg always gave me the required output.

Grub will not work if you take off a HDD simply because doing so will change the device mappings.

Could you create a new grub.cfg file in /boot/grub (just rename the existing one) and just put in the following entries:

Code:

menuentry "Ubuntu, Linux 2.6.31-15-generic" {
    set root=(hd1,1)
    search --no-floppy --fs-uuid --set ece48d4f-95ce-4c32-8ae6-20c3f3563597
    linux    /boot/vmlinuz-2.6.31-15-generic root=UUID=ece48d4f-95ce-4c32-8ae6-20c3f3563597 ro  quiet splash
    initrd    /boot/initrd.img-2.6.31-15-generic
}

menuentry "Microsoft Windows XP Home Edition (on /dev/sda1)" {
    set root=(hd0,1)
    chainloader +1
}

And see what happens... I am assuming that you have grub installed to mbr of /dev/sdb which should have higher boot priiority

Yes, /dev/sdb or as the BIOS calls it SCSI-0 is the first boot option.

Did what you suggested - made a grub.cfg file and then from gksudo nautilus pasted it into the /boot/grub/ dir.

The output when that menu item was selected was
Code:

GRUB_
and the bar was blinking - had to do a hard reset to get back t the GRUB menu.

firewiz87 11-24-2009 03:48 PM

Ok... that was supposed to work... but it does nt thats strange....

You seem to get the grub menu which means grub installation should be fine and i suppose the linux menu entry worked...
And since booting the windows HDD worked.... chainloader should ve worked....

Can you post output to
Code:

fdisk -l /dev/sda
fdisk -l /dev/sdb

Am assuming you ve not inserted your 3rd HDD back, yet


All times are GMT -5. The time now is 06:14 PM.