[XP boot fail] Grub2 won't load Windows XP

Asked by brent d

I have recently converted to a dual boot of Ubuntu 10.04 and Windows XP using Grub2. Ubuntu loads just fine. From the grub menu I select to run Windows XP home edition. The result is a black screen with a blinking cursor and that is it. Here is the entry in the configuration file for XP.

menuentry "Microsoft Windows XP Home Edition (on /dev/sda2)" {
 insmod ntfs
 set root='(hd0,2)'
 search --no-floppy --fs-uuid --set 4a94de42f001c7b1
 drivemap -s (hd0) ${root}
 chainloader +1
}

In dire need.

Question information

Language:
English Edit question
Status:
Solved
For:
Ubuntu grub2 Edit question
Assignee:
No assignee Edit question
Solved by:
Greg Beam
Solved:
Last query:
Last reply:
Revision history for this message
Greg Beam (ki7mt) said :
#1

Hi Brent,

From within your Ubuntu installation, using a terminal console, could you post the output of: [ df -hT ]

Then also attach a copy of your grub.cfg file located at /boot/grub/grub.cfg

Thanks

KE1HA

Revision history for this message
brent d (bedodson) said :
#2

For df -hT

Filesystem Type Size Used Avail Use% Mounted on
/dev/sda5 ext4 50G 9.3G 38G 20% /
none devtmpfs 491M 288K 491M 1% /dev
none tmpfs 496M 1.2M 494M 1% /dev/shm
none tmpfs 496M 196K 495M 1% /var/run
none tmpfs 496M 0 496M 0% /var/lock
none tmpfs 496M 0 496M 0% /lib/init/rw

for the config file

#
# 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 $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 recordfail {
  set recordfail=1
  if [ -n ${have_grubenv} ]; then if [ -z ${boot_once} ]; then save_env recordfail; fi; fi
}
insmod ext2
set root='(hd0,5)'
search --no-floppy --fs-uuid --set b4575f24-e4ba-43ee-8f50-3c7f55a36a0d
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
insmod ext2
set root='(hd0,5)'
search --no-floppy --fs-uuid --set b4575f24-e4ba-43ee-8f50-3c7f55a36a0d
set locale_dir=($root)/boot/grub/locale
set lang=en
insmod gettext
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/light-gray
### END /etc/grub.d/05_debian_theme ###

### BEGIN /etc/grub.d/10_linux ###
menuentry 'Ubuntu, with Linux 2.6.32-24-generic' --class ubuntu --class gnu-linux --class gnu --class os {
 recordfail
 insmod ext2
 set root='(hd0,5)'
 search --no-floppy --fs-uuid --set b4575f24-e4ba-43ee-8f50-3c7f55a36a0d
 linux /boot/vmlinuz-2.6.32-24-generic root=UUID=b4575f24-e4ba-43ee-8f50-3c7f55a36a0d ro quiet splash
 initrd /boot/initrd.img-2.6.32-24-generic
}
menuentry 'Ubuntu, with Linux 2.6.32-24-generic (recovery mode)' --class ubuntu --class gnu-linux --class gnu --class os {
 recordfail
 insmod ext2
 set root='(hd0,5)'
 search --no-floppy --fs-uuid --set b4575f24-e4ba-43ee-8f50-3c7f55a36a0d
 echo 'Loading Linux 2.6.32-24-generic ...'
 linux /boot/vmlinuz-2.6.32-24-generic root=UUID=b4575f24-e4ba-43ee-8f50-3c7f55a36a0d ro single
 echo 'Loading initial ramdisk ...'
 initrd /boot/initrd.img-2.6.32-24-generic
}
menuentry 'Ubuntu, with Linux 2.6.32-21-generic' --class ubuntu --class gnu-linux --class gnu --class os {
 recordfail
 insmod ext2
 set root='(hd0,5)'
 search --no-floppy --fs-uuid --set b4575f24-e4ba-43ee-8f50-3c7f55a36a0d
 linux /boot/vmlinuz-2.6.32-21-generic root=UUID=b4575f24-e4ba-43ee-8f50-3c7f55a36a0d ro quiet splash
 initrd /boot/initrd.img-2.6.32-21-generic
}
menuentry 'Ubuntu, with Linux 2.6.32-21-generic (recovery mode)' --class ubuntu --class gnu-linux --class gnu --class os {
 recordfail
 insmod ext2
 set root='(hd0,5)'
 search --no-floppy --fs-uuid --set b4575f24-e4ba-43ee-8f50-3c7f55a36a0d
 echo 'Loading Linux 2.6.32-21-generic ...'
 linux /boot/vmlinuz-2.6.32-21-generic root=UUID=b4575f24-e4ba-43ee-8f50-3c7f55a36a0d ro single
 echo 'Loading initial ramdisk ...'
 initrd /boot/initrd.img-2.6.32-21-generic
}
### END /etc/grub.d/10_linux ###

### BEGIN /etc/grub.d/20_memtest86+ ###
menuentry "Memory test (memtest86+)" {
 insmod ext2
 set root='(hd0,5)'
 search --no-floppy --fs-uuid --set b4575f24-e4ba-43ee-8f50-3c7f55a36a0d
 linux16 /boot/memtest86+.bin
}
menuentry "Memory test (memtest86+, serial console 115200)" {
 insmod ext2
 set root='(hd0,5)'
 search --no-floppy --fs-uuid --set b4575f24-e4ba-43ee-8f50-3c7f55a36a0d
 linux16 /boot/memtest86+.bin console=ttyS0,115200n8
}
### END /etc/grub.d/20_memtest86+ ###

### BEGIN /etc/grub.d/30_os-prober ###
menuentry "Windows NT/2000/XP (on /dev/sda1)" {
 insmod fat
 set root='(hd0,1)'
 search --no-floppy --fs-uuid --set 0159-6699
 drivemap -s (hd0) ${root}
 chainloader +1
}
menuentry "Microsoft Windows XP Home Edition (on /dev/sda2)" {
 insmod ntfs
 set root='(hd0,2)'
 search --no-floppy --fs-uuid --set 4a94de42f001c7b1
 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 ###

Revision history for this message
Greg Beam (ki7mt) said :
#3

Hi Brent,

To be honest, I do not see anything glaringly wrong with the cfg file.

I'd recommend booting the system into Ubuntu, and update grub2.

In a terminal console: [ sudo update-grub2 ]

then reboot the system, first ensuring Ubuntu boots, then again to test WinXP.

For additional information on Grub2 recover see: [ https://help.ubuntu.com/community/RecoveringUbuntuAfterInstallingWindows ]

KE1HA

General Ubuntu Resources:
Ubuntu Manual - http://ubuntu-manual.org/
Server Manual - https://help.ubuntu.com/10.04/serverguide/C/serverguide.pdf
Other Documentation - https://help.ubuntu.com/10.04/index.html
IRC Channel Support on irc.freenode.net : #ubuntu #kubuntu #xubuntu

Revision history for this message
brent d (bedodson) said :
#4

Updating was an earlier attempt with same bad results. Would you recommend to revert to grub instead of grub2

Revision history for this message
peter b (b1pete) said :
#5

how about the entry in grub menu

Windows NT/2000/XP (on /dev/sda1)

can you boot when this entry/option used ??

it appears that there are two xp installations according to

### BEGIN /etc/grub.d/30_os-prober ###
menuentry "Windows NT/2000/XP (on /dev/sda1)" {
 insmod fat
 set root='(hd0,1)'
 search --no-floppy --fs-uuid --set 0159-6699
 drivemap -s (hd0) ${root}
 chainloader +1
}
menuentry "Microsoft Windows XP Home Edition (on /dev/sda2)" {
 insmod ntfs
 set root='(hd0,2)'
 search --no-floppy --fs-uuid --set 4a94de42f001c7b1
 drivemap -s (hd0) ${root}
 chainloader +1
}

### END /etc/grub.d/30_os-prober ###

pls run in a terminal

sudo fdisk -l

command and copy/paste output here (l is lower L)

Revision history for this message
brent d (bedodson) said :
#6

The other partition with /dev/sda1 when loaded produces the error "NTLDR is missing". I don't have an XP cd to boot repair.

Here is the fdisk result:

Disk /dev/sda: 160.0 GB, 160041885696 bytes
255 heads, 63 sectors/track, 19457 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x11a8ba38

   Device Boot Start End Blocks Id System
/dev/sda1 1 638 5117994 12 Compaq diagnostics
Partition 1 does not end on cylinder boundary.
/dev/sda2 * 638 12634 96358607+ 7 HPFS/NTFS
/dev/sda3 12634 19458 54812673 5 Extended
/dev/sda5 12634 19173 52527104 83 Linux
/dev/sda6 19173 19458 2284544 82 Linux swap / Solaris

Disk /dev/sdb: 519 MB, 519569408 bytes
33 heads, 32 sectors/track, 960 cylinders
Units = cylinders of 1056 * 512 = 540672 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0xc3072e18

   Device Boot Start End Blocks Id System
/dev/sdb1 * 1 961 507376 6 FAT16
Partition 1 has different physical/logical endings:
     phys=(991, 32, 32) logical=(960, 31, 32)

sdb1 is just a USB device

Revision history for this message
Bryan Eller (mikedeezy) said :
#7

go to thepiratebay.org and type in Windows XP Repair Disk

Revision history for this message
brent d (bedodson) said :
#8

anyway back to the issue at hand

Revision history for this message
peter b (b1pete) said :
#9

.....'The other partition with /dev/sda1 when loaded produces the error "NTLDR is missing". I don't have an XP cd to boot repair.'....

brent d, the above message is a win error message - linux/ubuntu does not use NTLDR . something is wrong with xp obviously. ubuntu NEVER deletes/replaces or alters any files that do not belong to it.

the first partition sda1 apparently contains Compaq diagnostics and, maybe something else that, again maybe, ties in with sda2 where apparently xp is installed. I'd recommend a talk with Compaq and see how to fix xp problem. only AFTER xp functions flawlessly we can talk about win-ubuntu dual boot.

Revision history for this message
brent d (bedodson) said :
#10

NTLDR is where it is suppose to be. I've seen similar problems with grub2. I'm wondering if reverting to grub legacy would suffice or make a mess? Other step is to do a bootfix to see if it is an XP issue.

Revision history for this message
Best Greg Beam (ki7mt) said :
#11

Hi Brent,

If you need to repair a Windows MBR, I've used this before. You'll need to go back through the Grub2 update after, but at least you'll be able to recover the Windows MBR.

Link: [ http://robert.penz.name/221/mini-howto-restore-windows-mbrbootloader-with-linux/ ]

As far as the Legacy goes, I've not tried to take 10.04 to grub v.s. Grub2.

KE1HA

Revision history for this message
peter b (b1pete) said :
#12

well, just some thoughts from a long long past xp experience - no guarantee implied or otherwise

- first, win v selfishly wants - mandatory - for installation (rule built in in the very xp code) the first primary partition of the first HD, the famous c: drive OTHERWISE IT WILL NOT INSTALL PERIOD unless hacked. how does that fit with your current xp install on the SECOND PARTITION of the first HD ??? does this have anything to do with

....'the first partition sda1 apparently contains Compaq diagnostics and, maybe something else that, again maybe, ties in with sda2 where apparently xp is installed.'.... ?

- secondly, from what I still remember there should be some files absolutely required for booting (how many - good question) I remember 3 - boot.ini, ntldr and ntdetect - that in a MS mandatory install were located on the famous c: drive. where MUST they be located when xp installed on sda2 ??? for a successful boot ??? again, does this have anything to do with

....'the first partition sda1 apparently contains Compaq diagnostics and, maybe something else that, again maybe, ties in with sda2 where apparently xp is installed.'.... ?

- thirdly, it appears/for sure that grub2 found some info/files re booting xp IN BOTH sda1 and sda2 - hence 2 menuentries. are the contents of all these boot files ok ??? are they different ??? should they be different because of trespassing the MS very rule that allows xp install ONLY to sda1 ?? I think that this is the core of the problem.

I'm almost certain just looking at the 2 menuentries that the contents before mentioned are different - one is 'Windows NT/2000/XP (on /dev/sda1)' and the second is 'Microsoft Windows XP Home Edition (on /dev/sda2)' so, the question is why ? and what triggered this difference ? do these questions tie in with ....'the first partition sda1 apparently contains Compaq diagnostics and, maybe something else that, again maybe, ties in with sda2 where apparently xp is installed.'.... ?

Revision history for this message
brent d (bedodson) said :
#13

Peter b,
To answer your questions. There are two menuentries for the windows, because I use a Netbook, one is a recovery partition. So yes they are different. The first partition is recovery and the second is XP Home edition. Netbooks ship without the windows CD nor a cd/dvd drive thus this extra partition becomes the support in case a reinstall is needed.

All three files you mention are located where they are suppose to be. I previously checked when I got the original error of ntldr missing.

KE1HA,

Thank you so far for your recommendation (http://robert.penz.name/221/mini-howto-restore-windows-mbrbootloader-with-linux/ ). I haven't had time since my last post to continue to work this problem. I followed through with the link above and I decided to install grub legacy with a bootloader to grub2. There was an initial improvement through grub legacy, but alas ended with failure. I was able to get the windows loading screen up one time, but since results in a black screen and cursor hanging.

Revision history for this message
peter b (b1pete) said :
#14

yes, my suspicion that win was hacked (to allow install to sda2) apparently stands true ....'- first, win v selfishly wants - mandatory - for installation (rule built in in the very xp code) the first primary partition of the first HD, the famous c: drive OTHERWISE IT WILL NOT INSTALL PERIOD unless hacked.'.....

BTW.- rereading the thread I noticed that sdb1 is a bootable device and apparently has some problems. did you attempt/try a system boot WITHOUT sdb connected to the usb port ?? it is v v mportant; if you did not do it yet PLEASE DO SO NOW.

ok, I guess that's good news if sda1 is as you say ....'this extra partition becomes the support in case a reinstall is needed.'...

then just in case, save everything that you care for (in win as well as ubuntu) to some other media and get fixed first the win boot by using the procedure/s located on sda1 (sorry, I do not know any of that but whoever set up your pc this way should/must know and tell you how it should be done). failing this probably a new win install is the only other avenue open - just an opinion. pls see above recommendation ....'I'd recommend a talk with Compaq and see how to fix xp problem.'....

after win works flawless - boots, loads and performs as you expect, then I'd recommend a fresh lucid install.

Revision history for this message
peter b (b1pete) said :
#15

.....'pls see above recommendation ....'I'd recommend a talk with Compaq and see how to fix xp problem.'....

or, maybe/for sure if you still have this pc's original documentation/manuals the win fix up/reinstall procedures should be described in detail .

Revision history for this message
brent d (bedodson) said :
#16

peter b,

sdb1 was just a flash drive I had plugged in at the time I ran the command. I wouldn't even pay attention to that. The USB device is just in case I messed up grub, then I could just boot off of the usb if needed to fix any issues.
As for sda1, I cannot boot from that either. My next step is to borrow someones XP cd and use my external cd drive, boot from the cd and do a bootcfg. I'll post the results.

Revision history for this message
peter b (b1pete) said :
#17

searching the net a bit, I'm not sure if your intended course of action would sort out the win boot problem, why ? because what you're dealing with here are two different win - the one on cd that you intend to borrow and use which is a MS WIN that, as I said has built in the code the v rule 'install mandatory to first pri partition of first HD else the highway/no install' and the other one currently installed on sda1 that is a hack that allows win to be installed on sda2.

as I said, I'm not using win so these are just opinions/discussion - I may be totally wrong.

I still believe based on your .....'Netbooks ship without the windows CD nor a cd/dvd drive thus this extra partition becomes the support in case a reinstall is needed.'..... that the solution to bring win back to life should be looked for on the hacked win that resides on sda1.

best of luck in your endeavors. I'm quite interested to hear how this issue was sorted out.

Revision history for this message
brent d (bedodson) said :
#18

Okay, so I now have my XP up and running. My process initially produced semi-good but bad results for my XP partition. Today, I decided to load the recovery partition and it worked! So I then decided to try the XP partition and it worked! Odd, because originally it gave me that black screen again after the steps I went through. So, maybe loading the recovery partition fixed the issue after this process?

My process consisted of two steps. The first step was to restore the windows MBR through Linux (courtesy of advice from KE1HA) then after that I reverted back to grub legacy. This process may be unique to my situation, considering it worked for my ASUS Netbook with a dual boot using Grub2. The problem being I couldn't boot into my XP partition through Grub2. I want to post my process just in case it works for others and if it does I would like to hear about it.

#Step one: restore windows MBR (http://robert.penz.name/221/mini-howto-restore-windows-mbrbootloader-with-linux/)

#Two ways to go about this I used #2 for mine

#1

 sudo apt-get install syslinux
 sudo dd if=/usr/lib/syslinux/mbr.bin of=/dev/sda

#2

 sudo apt-get install mbr
 sudo install-mbr -i n -p D -t 0 /dev/sda

#Step two: revert to grub legacy from grub 2 (*https://help.ubuntu.com/community/Grub2)

#It's suggested to make backups of the original grub files

 sudo cp /etc/default/grub /etc/default/grub.old
 sudo cp -R /etc/grub.d /etc/grub.d.old
 sudo cp -R /boot/grub /boot/grub.old

#To remove grub2

 sudo aptitude purge grub2 grub-pc

#At this point the system will not be bootable. So install grub legacy.

 sudo aptitude install grub

#Generate the config file

 sudo update-grub

 sudo grub-install /dev/sdX

#*Choose the correct device (sda, sdb, etc), normally the one on which Ubuntu is installed.
#*Creates the stage1 and stage2 files in /boot/grub and writes to the MBR.

#Reboot

That was my process.

Cheers!

Revision history for this message
brent d (bedodson) said :
#19

Thanks KE1HA, that solved my question.