Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I tried to set up a dual boot windows xp/debian. I installed Debian after windows, and now I can't boot windows xp. I have grub2.

I tried to directly modify /boot/grub/grub.cfg with

menuentry 'WinXP'  {
    insmod part_msdos
    set root='(hd0,msdos4)'
    insmod chain
    chainloader +1
}

but I can't make that work. When I select winXP in the grub menu, I get a black screen and the system restarts.

Please, any hint?


Output of df -h

Filesystem                                              Size  Used Avail Use% Mounted on
rootfs                                                   30G  8.3G   20G  30% /
udev                                                     10M     0   10M   0% /dev
tmpfs                                                   177M  628K  177M   1% /run
/dev/disk/by-uuid/4eba1bb8-14f7-4920-a9c3-2fb8894626d3   30G  8.3G   20G  30% /
tmpfs                                                   5.0M     0  5.0M   0% /run/lock
tmpfs                                                   764M  232K  764M   1% /run/shm
/dev/sda6                                                92G  2.3G   85G   3% /data
/dev/sda5                                               9.9G  258M  9.1G   3% /home

output of sudo fdisk -l

Disk /dev/sda: 250.1 GB, 250059350016 bytes
255 heads, 63 sectors/track, 30401 cylinders, total 488397168 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00089f15

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *   204796620   267710463    31456922   83  Linux
/dev/sda2       267710464   271904767     2097152   82  Linux swap / Solaris
/dev/sda3       271906814   488397167   108245177    5  Extended
/dev/sda4           16128   204796619   102390246    7  HPFS/NTFS/exFAT
/dev/sda5       271906816   292878335    10485760   83  Linux
/dev/sda6       292880384   488397167    97758392   83  Linux

Partition table entries are not in disk order

Output of /boot/grub/grub.cfg

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

### BEGIN /etc/grub.d/00_header ###
if [ -s $prefix/grubenv ]; then
  load_env
fi
set default="0"
if [ "${prev_saved_entry}" ]; then
  set saved_entry="${prev_saved_entry}"
  save_env saved_entry
  set prev_saved_entry=
  save_env prev_saved_entry
  set boot_once=true
fi

function savedefault {
  if [ -z "${boot_once}" ]; then
    saved_entry="${chosen}"
    save_env saved_entry
  fi
}

function load_video {
  insmod vbe
  insmod vga
  insmod video_bochs
  insmod video_cirrus
}

insmod part_msdos
insmod ext2
set root='(hd0,msdos1)'
search --no-floppy --fs-uuid --set=root 4eba1bb8-14f7-4920-a9c3-2fb8894626d3
if loadfont /usr/share/grub/unicode.pf2 ; then
  set gfxmode=640x480
  load_video
  insmod gfxterm
  insmod part_msdos
  insmod ext2
  set root='(hd0,msdos1)'
  search --no-floppy --fs-uuid --set=root 4eba1bb8-14f7-4920-a9c3-2fb8894626d3
  set locale_dir=($root)/boot/grub/locale
  set lang=en_US
  insmod gettext
fi
terminal_output gfxterm
set timeout=5
### END /etc/grub.d/00_header ###

### BEGIN /etc/grub.d/05_debian_theme ###
insmod part_msdos
insmod ext2
set root='(hd0,msdos1)'
search --no-floppy --fs-uuid --set=root 4eba1bb8-14f7-4920-a9c3-2fb8894626d3
insmod png
if background_image /usr/share/images/desktop-base/joy-grub.png; then
  set color_normal=white/black
  set color_highlight=black/white
else
  set menu_color_normal=cyan/blue
  set menu_color_highlight=white/blue
fi
### END /etc/grub.d/05_debian_theme ###

### BEGIN /etc/grub.d/10_linux ###
menuentry 'Debian GNU/Linux, with Linux 3.2.0-4-686-pae' --class debian --class gnu-linux --class gnu --class os {
    load_video
    insmod gzio
    insmod part_msdos
    insmod ext2
    set root='(hd0,msdos1)'
    search --no-floppy --fs-uuid --set=root 4eba1bb8-14f7-4920-a9c3-2fb8894626d3
    echo    'Loading Linux 3.2.0-4-686-pae ...'
    linux   /boot/vmlinuz-3.2.0-4-686-pae root=UUID=4eba1bb8-14f7-4920-a9c3-2fb8894626d3 ro  noapic nolapic
    echo    'Loading initial ramdisk ...'
    initrd  /boot/initrd.img-3.2.0-4-686-pae
}
menuentry 'Debian GNU/Linux, with Linux 3.2.0-4-686-pae (recovery mode)' --class debian --class gnu-linux --class gnu --class os {
    load_video
    insmod gzio
    insmod part_msdos
    insmod ext2
    set root='(hd0,msdos1)'
    search --no-floppy --fs-uuid --set=root 4eba1bb8-14f7-4920-a9c3-2fb8894626d3
    echo    'Loading Linux 3.2.0-4-686-pae ...'
    linux   /boot/vmlinuz-3.2.0-4-686-pae root=UUID=4eba1bb8-14f7-4920-a9c3-2fb8894626d3 ro single 
    echo    'Loading initial ramdisk ...'
    initrd  /boot/initrd.img-3.2.0-4-686-pae
}

### END /etc/grub.d/10_linux ###

### BEGIN /etc/grub.d/20_linux_xen ###
### END /etc/grub.d/20_linux_xen ###

### BEGIN /etc/grub.d/30_os-prober ###
### 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 ###

### BEGIN /etc/grub.d/41_custom ###
if [ -f  $prefix/custom.cfg ]; then
  source $prefix/custom.cfg;
fi
### END /etc/grub.d/41_custom ###
share|improve this question
1  
You shouldn't edit /boot/grub/grub.cfg. Does it work if you update grub using update-grub? –  terdon Sep 27 '13 at 14:46
1  
try (hd0, msdos3) or try re-installing os-prober and running update-grub now that you've converted to MBR. –  cas Oct 4 '13 at 1:18
1  
just looking at that fdisk output hurts my brain. IMO your partition table is so messed up that you should backup your data, re-partition the disk and re-install everything from scratch. install windows xp first into a primary partition. then install linux and grub. –  cas Oct 4 '13 at 1:36
1  
@cas I really don't see anything wrong with that partition table. Sure, it's not in order, and there is some wasted space, but I don't see anything overlapping (other than "extended" of course). –  derobert Oct 4 '13 at 14:41
1  
I'd suggest breaking into the grub command prompt (at the menu when booting the machine). Then I believe if you type "(hd, <TAB><TAB>" it'll give you a list of how it thinks you can complete that... –  derobert Oct 4 '13 at 14:46
show 9 more comments

1 Answer

If I understand the Microsoft docs correctly (I should downvote you just for making me read that ;) ), XP cannot load from GPT disks:

Q. Can Windows XP x64 read, write, and boot from GPT disks?

A. Windows XP x64 Edition can use GPT disks for data only.

Q. Can the 32-bit version of Windows XP read, write, and boot from GPT disks?

A. No. The 32-bit version will see only the Protective MBR. The EE partition will not be mounted or otherwise exposed to application software.

So, it looks like even if you could get grub to see the windows installation, you still would not be able to boot into it from a GPT disk.

share|improve this answer
1  
It could be possible with a carefully set up hybrid MBR. –  peterph Sep 27 '13 at 17:26
    
does it mean I should reinstall Debian? but I do not remember any option that could be set during the installation process to change this behavious, I mean I do not remember that I had to choose gpt over mbr –  simona Sep 28 '13 at 2:38
    
@simona no, Debian is fine, it is XP that can't boot from a GPT disk. You have not explained how update-grub2 fails but my guess is that it found XP but simply cannot boot it because XP can't run from a GPT disk. –  terdon Sep 28 '13 at 13:15
    
I think I made a mistake, both windows and debian are on the same disk, different partitions. because windows xp (32bit) is installed there, it can't be a gpt disk, can it? I thought it was a gpt disk because in the grub.cfg there is the entry root=(hd0,gpt1). I apologize for that –  simona Sep 29 '13 at 1:54
2  
@simona the fdisk -l shows you do have a gpt hard drive. Apparently booting XP from it is either very hard or impossible. –  terdon Oct 4 '13 at 1:06
show 10 more comments

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.