PDA

View Full Version : [ubuntu] GRUB 2 - Following migration to SSD, Windows XP partition does not boot



sorrybloke
February 26th, 2011, 04:37 PM
Hi,

I've recently moved from an HD to an SSD for my Lenovo T61-p laptop using Ubuntu 10.10 and have been experiencing the following issue:

When selecting Windows XP in GRUB 2, a blank screen is displayed indefinitely.


Note that:

Ubuntu itself boot fine and that the partition that hosts the Windows XP files can be mounted & accessed correctly from within Ubuntu.
The Windows XP partition was copied over from the old HD by using Clonezilla to backup the partition itself and then restore it to /dev/sda1.
Following the Windows XP partition restore, Ubuntu 10.10 was freshly installed to /dev/sda2 using the liveCD.


My intuition led me to believe that something is wrong with where GRUB 2 believes that the Windows XP partition is to be booted from or that the Windows XP partition itself has some issue. Following my intuition, I've used boot_infoscript055 to see what it could reveal.

Here are the contents of boot_infoscript055's RESULTS.txt file:

Boot Info Script 0.55 dated February 15th, 2010

============================= Boot Info Summary: ==============================

=> Grub 2 is installed in the MBR of /dev/sda and looks on the same drive in
partition #2 for (,msdos2)/boot/grub.

sda1: __________________________________________________ _______________________

File system: ntfs
Boot sector type: Windows XP
Boot sector info: According to the info in the boot sector, sda1 starts
at sector 63. But according to the info from fdisk,
sda1 starts at sector 2048. According to the info in
the boot sector, sda1 has 52422648 sectors, but
according to the info from fdisk, it has 52430847
sectors.
Operating System: Windows XP
Boot files/dirs: /boot.ini /ntldr /NTDETECT.COM

sda2: __________________________________________________ _______________________

File system: ext4
Boot sector type: -
Boot sector info:
Operating System: Ubuntu 10.10
Boot files/dirs: /boot/grub/grub.cfg /etc/fstab /boot/grub/core.img

sda3: __________________________________________________ _______________________

File system: swap
Boot sector type: -
Boot sector info:

=========================== Drive/Partition Info: =============================

Drive: sda ___________________ __________________________________________________ ___

Disk /dev/sda: 55.0 GB, 55021510656 bytes
255 heads, 63 sectors/track, 6689 cylinders, total 107463888 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes

Partition Boot Start End Size Id System

/dev/sda1 2,048 52,432,895 52,430,848 83 Linux
/dev/sda2 * 52,432,896 104,861,695 52,428,800 83 Linux
/dev/sda3 104,861,696 107,463,887 2,602,192 82 Linux swap / Solaris


blkid -c /dev/null: __________________________________________________ __________

Device UUID TYPE LABEL

/dev/sda1 98D47CFAD47CDC46 ntfs SO
/dev/sda2 81e77ca2-0991-40c3-a6ca-9c1e8a86f1a3 ext4
/dev/sda3 46f6d651-e163-4597-b51d-00d5a79868c2 swap
/dev/sda: PTTYPE="dos"

============================ "mount | grep ^/dev output: ===========================

Device Mount_Point Type Options

/dev/sda2 / ext4 (rw,noatime,discard,errors=remount-ro,commit=0)


================================ sda1/boot.ini: ================================

[boot loader]
timeout=30
default=multi(0)disk(0)rdisk(0)partition(1)\WINDOW S
[operating systems]
multi(0)disk(0)rdisk(0)partition(1)\WINDOWS="Microsoft Windows XP Professional" /fastdetect /NoExecute=OptIn

=========================== sda2/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
set have_grubenv=true
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
}

function load_video {
insmod vbe
insmod vga
}

insmod part_msdos
insmod ext2
set root='(hd0,msdos2)'
search --no-floppy --fs-uuid --set 81e77ca2-0991-40c3-a6ca-9c1e8a86f1a3
if loadfont /usr/share/grub/unicode.pf2 ; then
set gfxmode=640x480
load_video
insmod gfxterm
fi
terminal_output gfxterm
insmod part_msdos
insmod ext2
set root='(hd0,msdos2)'
search --no-floppy --fs-uuid --set 81e77ca2-0991-40c3-a6ca-9c1e8a86f1a3
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.35-25-generic-pae' --class ubuntu --class gnu-linux --class gnu --class os {
recordfail
insmod part_msdos
insmod ext2
set root='(hd0,msdos2)'
search --no-floppy --fs-uuid --set 81e77ca2-0991-40c3-a6ca-9c1e8a86f1a3
linux /boot/vmlinuz-2.6.35-25-generic-pae root=UUID=81e77ca2-0991-40c3-a6ca-9c1e8a86f1a3 ro quiet splash elevator=noop
initrd /boot/initrd.img-2.6.35-25-generic-pae
}
menuentry 'Ubuntu, with Linux 2.6.35-25-generic-pae (recovery mode)' --class ubuntu --class gnu-linux --class gnu --class os {
recordfail
insmod part_msdos
insmod ext2
set root='(hd0,msdos2)'
search --no-floppy --fs-uuid --set 81e77ca2-0991-40c3-a6ca-9c1e8a86f1a3
echo 'Loading Linux 2.6.35-25-generic-pae ...'
linux /boot/vmlinuz-2.6.35-25-generic-pae root=UUID=81e77ca2-0991-40c3-a6ca-9c1e8a86f1a3 ro single
echo 'Loading initial ramdisk ...'
initrd /boot/initrd.img-2.6.35-25-generic-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/20_memtest86+ ###
menuentry "Memory test (memtest86+)" {
insmod part_msdos
insmod ext2
set root='(hd0,msdos2)'
search --no-floppy --fs-uuid --set 81e77ca2-0991-40c3-a6ca-9c1e8a86f1a3
linux16 /boot/memtest86+.bin
}
menuentry "Memory test (memtest86+, serial console 115200)" {
insmod part_msdos
insmod ext2
set root='(hd0,msdos2)'
search --no-floppy --fs-uuid --set 81e77ca2-0991-40c3-a6ca-9c1e8a86f1a3
linux16 /boot/memtest86+.bin console=ttyS0,115200n8
}
### END /etc/grub.d/20_memtest86+ ###

### BEGIN /etc/grub.d/30_os-prober ###
menuentry "Microsoft Windows XP Professional (on /dev/sda1)" {
insmod part_msdos
insmod ntfs
set root='(hd0,msdos1)'
search --no-floppy --fs-uuid --set 98d47cfad47cdc46
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 ###

### BEGIN /etc/grub.d/41_custom ###
if [ -f $prefix/custom.cfg ]; then
source $prefix/custom.cfg;
fi
### END /etc/grub.d/41_custom ###

=============================== sda2/etc/fstab: ===============================

# /etc/fstab: static file system information.
#
# Use 'blkid -o value -s UUID' to print the universally unique identifier
# for a device; this may be used with UUID= as a more robust way to name
# devices that works even if disks are added and removed. See fstab(5).
#
# <file system> <mount point> <type> <options> <dump> <pass>
proc /proc proc nodev,noexec,nosuid 0 0
#
# / was on /dev/sda2 during installation
UUID=81e77ca2-0991-40c3-a6ca-9c1e8a86f1a3 / ext4 defaults,noatime,discard,errors=remount-ro 0 1
#
# swap was on /dev/sda3 during installation
UUID=46f6d651-e163-4597-b51d-00d5a79868c2 none swap sw 0 0
#
#Ram Drive
tmpfs /tmp tmpfs nodev,nosuid,noatime,size=1024M,mode=1777 0 0

=================== sda2: Location of files loaded by Grub: ===================


37.7GB: boot/grub/core.img
50.8GB: boot/grub/grub.cfg
27.5GB: boot/initrd.img-2.6.35-25-generic-pae
37.9GB: boot/vmlinuz-2.6.35-25-generic-pae
27.5GB: initrd.img
37.9GB: vmlinuz


I am guessing that my problem has something to do with the following (which is mentioned for the Windows XP partition):


According to the info in the boot sector, sda1 starts at sector 63. But according to the info from fdisk, sda1 starts at sector 2048. According to the info in the boot sector, sda1 has 52422648 sectors, but according to the info from fdisk, it has 52430847 sectors.


My question is: "How do I (or can I) troubleshoot this issue further (and, hopefully, fix it :) )?"


Thank you in advance for your help.

oldfred
February 26th, 2011, 05:51 PM
I think out of all the windows repair commands it is just the fixBoot that repairs the partition boot sector.

Description of the Windows XP Recovery Console for advanced users list of commands
http://support.microsoft.com/kb/314058/
FIXBOOT C:

If you run fixMBR you will be able to directly boot windows, to test it, but then will have to reinstall grub2.

Sometimes the boot.ini has to be repaired but script shows it correct. And sometimes the ntldr or /NTDETECT.COM have to be replaced.

Testdisk also has a rebuild boot sector that should work. But not the recover from backup as it should match the installed and would be equally wrong.
As described, it has an option to "Recover NTFS boot sector from its backup"
Instructions
http://www.cgsecurity.org/wiki/TestDisk_Step_By_Step

sorrybloke
February 26th, 2011, 06:20 PM
I think out of all the windows repair commands it is just the fixBoot that repairs the partition boot sector.

Description of the Windows XP Recovery Console for advanced users list of commands
http://support.microsoft.com/kb/314058/
FIXBOOT C:

If you run fixMBR you will be able to directly boot windows, to test it, but then will have to reinstall grub2.

Sometimes the boot.ini has to be repaired but script shows it correct. And sometimes the ntldr or /NTDETECT.COM have to be replaced.

The Windows XP CD I have seems to not support SSDs "out of the box" since the recovery console is saying that it can't find any HDs. This may be due to the fact that I am using AHCPI. I'll try using IDE compatibility mode instead of AHCPI and see what this yields.

As far as reinstalling GRUB 2 (if i ever need to run fixmbr), all I need is my handy Ubuntu 10.10 liveCD :) .

Thanks for the help, I'll keep you posted on how things turn out.

oldfred
February 26th, 2011, 06:25 PM
You may be trapped. I have an old XP install and when I got a new motherboard & hard drive I tried the AHCPI mode & Ubuntu booted but XP did not. I changed back to IDE compatible & both worked.

But I think your SSD need the AHCPI mode. The drivers for XP are supposed to be installed as you install XP. I think I saw somewhere instructions to install the drivers after the fact, but I am to the point I am weaning my way from XP and do not want to expend the effort to add the driver. I am thinking about an SSD and that may just kill XP for me.

sorrybloke
February 26th, 2011, 07:12 PM
I've tried the Windows XP Recovery Console.. to no avail sadly.

Here is what I've done so far:

Set BIOS to IDE Compatibility Mode
Booted into Recovery Console
Did a "fixboot C:" (which worked without any issues)
Rebooted
Selected Windows XP from GRUB 2
Still got the endless black screen
Rebooted
Set BIOS to AHCI
Selected Windows XP from GRUB 2
Still got the endless black screen


Since this didn't seem to be enough to get my Windows XP to boot, I've went ahead and tried to fixmbr:

Set BIOS to IDE Compatibility Mode
Booted into Recovery Console
Did a "fixmbr" (which worked without any issues)
Rebooted
Windows XP's mbr shows something along the lines of "error, invalid boot sector"
Rebooted
Set BIOS to AHCI
Windows XP's mbr shows something along the lines of "error, invalid boot sector"
Using Ubuntu Live CD, I've reinstalled GRUB 2 and rebooted into Ubuntu without a cinch (is this how you actually write this expression?).


One interesting thing to note is the following message I got when I reinstalled GRUB 2:


warn: Sector 32 is already in use by FlexNet; avoiding it. This software may cause boot or other problems in future. Please ask its authors not to store data in the boot track..
Installation finished. No error reported.


I'm starting to consider reinstalling Windows XP altogether (along with the bizillion updates and patches). If my work didn't require me to have this OS for when I work from home, I wouldn't have to be in this mess :( .

Tell me if you have any other ideas on how I could find a fix for this. Thanks!

wilee-nilee
February 26th, 2011, 07:18 PM
I would move the boot flag from sda2 to sda1 Windows wont work without the flag. Otherwise oldfred's help is the best here.

sorrybloke
February 26th, 2011, 07:56 PM
I would move the boot flag from sda2 to sda1 Windows wont work without the flag. Otherwise oldfred's help is the best here.

Well, it surely is worth a try. How would you go about doing this?


Thank you.

wilee-nilee
February 26th, 2011, 08:14 PM
Well, it surely is worth a try. How would you go about doing this?


Thank you.

Sorry I should have included that, the easiest way is with gparted from the live cd. Right click the sda1 and then manage flags and click boot.

I just noticed the flexnet line in post 5 here see post 2 here.
http://ubuntuforums.org/showthread.php?t=1661254

You have your setup backed up I hope.

oldfred
February 26th, 2011, 09:29 PM
Thanks wilee-nilee for pointing out the boot flag. I had forgotten. Windows repairs only work on a bootable partition and that means it has to be the one with the boot flag.

So move boot flag to sda1 and run fixBoot again like you did. The error message was saying that you had a bad boot partition. Grub does not use boot flag, windows only need it to boot from MBR (or repairs).

Grub2 is larger than old grub and has part of its boot just after the MBR in the sectors that are/were unused. Win7 software started writing serial numbers and DRM keys into that area. Grub2 has created that work around for flexnet, so you are running some DRM'd software in XP.

sorrybloke
February 27th, 2011, 07:38 PM
I have followed the instructions to get rid of the FlexNet occupied sector (sector 32) and reinstalled GRUB 2. This time around, the process mentioned no issues.

Following this, I have gone through the "fixboot" & "fixmbr" process over again. However, I now have a message (from the Windows XP MBR) saying something along the lines of "Operating System Error".

That is when I finally decided to go through a reinstall of Windows XP. It took around 6h of work to get all the endless patches into place (from SP1 to SP3!) but, I now have a working dual boot (Windows XP / Ubuntu 10.10).

Still, my thanks go out to you oldfred and wilee-nilee for you time and efforts. Seeing how the Ubuntu community is really supportive and helpful (as opposed to call centers of other paying solutions), this inspires me great hope in the future of Ubuntu and open source alike.

Again, thank you for your help!

wilee-nilee
February 27th, 2011, 07:54 PM
I have followed the instructions to get rid of the FlexNet occupied sector (sector 32) and reinstalled GRUB 2. This time around, the process mentioned no issues.

Following this, I have gone through the "fixboot" & "fixmbr" process over again. However, I now have a message (from the Windows XP MBR) saying something along the lines of "Operating System Error".

That is when I finally decided to go through a reinstall of Windows XP. It took around 6h of work to get all the endless patches into place (from SP1 to SP3!) but, I now have a working dual boot (Windows XP / Ubuntu 10.10).

Still, my thanks go out to you oldfred and wilee-nilee for you time and efforts. Seeing how the Ubuntu community is really supportive and helpful (as opposed to call centers of other paying solutions), this inspires me great hope in the future of Ubuntu and open source alike.

Again, thank you for your help!

I'm not sure if you know this but XP has a full backup imager on all versions, the home version you have to load it off the install cd. This will allow you using the windows software to save a image of the full XP set on a HD and reinstall it again later if needed.
http://www.microsoft.com/windowsxp/using/setup/learnmore/bott_03july14.mspx

I have backups of XP and W7 these load fast and can be made at any time. It's usually best to start at a place your at; a fresh install all updated, it will save you time in the future if needed.

Here is another cloner that is easy to use and will image whole drives or individual partitions.
http://clonezilla.org/

Hakunka-Matata
February 27th, 2011, 08:57 PM
Since this didn't seem to be enough to get my Windows XP to boot, I've went ahead and tried to fixmbr:

1. Set BIOS to IDE Compatibility Mode
2. Booted into Recovery Console
3. Did a "fixmbr" (which worked without any issues)
4. Rebooted
5. Windows XP's mbr shows something along the lines of "error, invalid boot sector"
6. Rebooted
7. Set BIOS to AHCI
8. Windows XP's mbr shows something along the lines of "error, invalid boot sector"
9. Using Ubuntu Live CD, I've reinstalled GRUB 2 and rebooted into Ubuntu without a cinch (is this how you actually write this expression?).


"Without a glitch may be what you meant" In other words, "without any trouble"

Your English is fine.