PDA

View Full Version : [SOLVED] Can't boot into Windows XP after installing Ubuntu after messing with partitions



JavaGeek666
October 30th, 2010, 02:00 PM
Hi everyone,
So the problem appeared after I played a bit with partitions. I'm not an experienced Ubuntu user, neither I have solid understanding of partitioning. And I hardly remember exact actions that led to this problem. I remember that I saw a warning in GParted that said that the partition was out of bounds or something.. But I followed some solution that I found on ubuntuforums and used fdisk to fix that. So, after installation of Ubuntu I couldn't boot into WindowsXP (after choosing Windows entry in grub2 menu I see only blinking cursor on black screen). But what's more important that I can easily mount Windows partition from Ubuntu. Also I tried to boot from Windows repair console and used FIXBOOT command, and copied ntldr.com and ntdetect.com files to no avail..
Here is the summary of what I got now:



sudo fdisk -l

Disk /dev/sda: 120.0 GB, 120034123776 bytes
255 heads, 63 sectors/track, 14593 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: 0x26ae26ad

Device Boot Start End Blocks Id System
/dev/sda1 1 4838 38861203+ 83 Linux
/dev/sda2 4839 5099 2096482+ 82 Linux swap / Solaris
/dev/sda3 * 5100 14593 76260555 7 HPFS/NTFS

Here is the output from boot_info_script:


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 #1 for /boot/grub.

sda1: __________________________________________________ _______________________

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

sda2: __________________________________________________ _______________________

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

sda3: __________________________________________________ _______________________

File system: ntfs
Boot sector type: Windows XP
Boot sector info: According to the info in the boot sector, sda3 starts
at sector 63. But according to the info from fdisk,
sda3 starts at sector 81915435.
Operating System: Windows XP
Boot files/dirs: /boot.ini /ntldr /NTDETECT.COM

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

Drive: sda ___________________ __________________________________________________ ___

Disk /dev/sda: 120.0 GB, 120034123776 bytes
255 heads, 63 sectors/track, 14593 cylinders, total 234441648 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 63 77,722,469 77,722,407 83 Linux
/dev/sda2 77,722,470 81,915,434 4,192,965 82 Linux swap / Solaris
/dev/sda3 * 81,915,435 234,436,544 152,521,110 7 HPFS/NTFS


blkid -c /dev/null: __________________________________________________ __________

Device UUID TYPE LABEL

/dev/sda1 bd718694-48bb-40f7-857f-1c818902f847 ext3
/dev/sda2 f5d2279c-9c86-4577-8ab1-9f5d5fddc9ab swap
/dev/sda3 B61CDBE21CDB9BA5 ntfs C
/dev/sda: PTTYPE="dos"

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

Device Mount_Point Type Options

/dev/sda1 / ext3 (rw,errors=remount-ro)
/dev/sda3 /media/C fuseblk (rw,nosuid,nodev,allow_other,blksize=4096,default_ permissions)


=========================== sda1/boot/grub/grub.cfg: ===========================

#
# 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,1)'
search --no-floppy --fs-uuid --set bd718694-48bb-40f7-857f-1c818902f847
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,1)'
search --no-floppy --fs-uuid --set bd718694-48bb-40f7-857f-1c818902f847
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-25-generic' --class ubuntu --class gnu-linux --class gnu --class os {
recordfail
insmod ext2
set root='(hd0,1)'
search --no-floppy --fs-uuid --set bd718694-48bb-40f7-857f-1c818902f847
linux /boot/vmlinuz-2.6.32-25-generic root=UUID=bd718694-48bb-40f7-857f-1c818902f847 ro quiet splash
initrd /boot/initrd.img-2.6.32-25-generic
}
menuentry 'Ubuntu, with Linux 2.6.32-25-generic (recovery mode)' --class ubuntu --class gnu-linux --class gnu --class os {
recordfail
insmod ext2
set root='(hd0,1)'
search --no-floppy --fs-uuid --set bd718694-48bb-40f7-857f-1c818902f847
echo 'Loading Linux 2.6.32-25-generic ...'
linux /boot/vmlinuz-2.6.32-25-generic root=UUID=bd718694-48bb-40f7-857f-1c818902f847 ro single
echo 'Loading initial ramdisk ...'
initrd /boot/initrd.img-2.6.32-25-generic
}
menuentry 'Ubuntu, with Linux 2.6.32-24-generic' --class ubuntu --class gnu-linux --class gnu --class os {
recordfail
insmod ext2
set root='(hd0,1)'
search --no-floppy --fs-uuid --set bd718694-48bb-40f7-857f-1c818902f847
linux /boot/vmlinuz-2.6.32-24-generic root=UUID=bd718694-48bb-40f7-857f-1c818902f847 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,1)'
search --no-floppy --fs-uuid --set bd718694-48bb-40f7-857f-1c818902f847
echo 'Loading Linux 2.6.32-24-generic ...'
linux /boot/vmlinuz-2.6.32-24-generic root=UUID=bd718694-48bb-40f7-857f-1c818902f847 ro single
echo 'Loading initial ramdisk ...'
initrd /boot/initrd.img-2.6.32-24-generic
}
### END /etc/grub.d/10_linux ###

### BEGIN /etc/grub.d/20_memtest86+ ###
menuentry "Memory test (memtest86+)" {
insmod ext2
set root='(hd0,1)'
search --no-floppy --fs-uuid --set bd718694-48bb-40f7-857f-1c818902f847
linux16 /boot/memtest86+.bin
}
menuentry "Memory test (memtest86+, serial console 115200)" {
insmod ext2
set root='(hd0,1)'
search --no-floppy --fs-uuid --set bd718694-48bb-40f7-857f-1c818902f847
linux16 /boot/memtest86+.bin console=ttyS0,115200n8
}
### END /etc/grub.d/20_memtest86+ ###

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

=============================== sda1/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/sda1 during installation
UUID=bd718694-48bb-40f7-857f-1c818902f847 / ext3 errors=remount-ro 0 1
# swap was on /dev/sda3 during installation
UUID=f5d2279c-9c86-4577-8ab1-9f5d5fddc9ab none swap sw 0 0
/dev/fd0 /media/floppy0 auto rw,user,noauto,exec,utf8 0 0
//buffalo/soft /media/buffalo_soft cifs credentials=/root/.smbcredentials,iocharset=utf8,file_mode=0777,dir_ mode=0777 0 0

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


36.2GB: boot/grub/core.img
36.1GB: boot/grub/grub.cfg
36.1GB: boot/initrd.img-2.6.32-24-generic
36.2GB: boot/initrd.img-2.6.32-25-generic
36.2GB: boot/vmlinuz-2.6.32-24-generic
36.2GB: boot/vmlinuz-2.6.32-25-generic
36.2GB: initrd.img
36.1GB: initrd.img.old
36.2GB: vmlinuz
36.2GB: vmlinuz.old

================================ sda3/boot.ini: ================================

[boot loader]
timeout=30
default=multi(0)disk(0)rdisk(0)partition(0)\WINDOW S
[operating systems]
multi(0)disk(0)rdisk(0)partition(0)\WINDOWS="Microsoft Windows XP Professional2" /noexecute=optin /fastdetect

The most confusing part from the boot_info_script output is this one:


According to the info in the boot sector, sda3 starts
at sector 63. But according to the info from fdisk,
sda3 starts at sector 81915435.

I think the root of the problem lies here, but still unsure how to fix it.
Any help would be highly appreciated!

P.S I also attached a screenshot from gparted to this post.

ronparent
October 30th, 2010, 02:49 PM
Why is does the screen shot show XP mounted at /media (probably not material to your problem)? You apparently shrank XP to place the Ubuntu partition in front of it on the disk. Some how the front of the partition is still registered a sector 63. What did you use to shrink it?

We may have to find a way to correct the boot sector info. It should have been done when the grub boot loader was written there? We should maybe try to reinstall grub by booting to the install on the disk. In a terminal write 'sudo grub-install /dev/sda'. Do you get the same results when you reboot?

q999
October 30th, 2010, 02:54 PM
not shure whats wrong but i feel that your problem may be with grub2,, looking for the partion in the wrong place,, and you may want to learn how to edit the grub menu
...or you could remove all linux partions..
.ie. first save data (personal stuff on linux partions)
/remove all linux partion (leaving ntsf(windows)) and
reinstall ubuntu... the disk tool I use to do this = http://partedmagic.com/ a free linux live cd tool..
remember.
back up data you want to save...
hope this helps.

JavaGeek666
October 30th, 2010, 03:36 PM
First of all thank you for your quick reply!

Why is does the screen shot show XP mounted at /media (probably not material to your problem
Because at that moment I was listening to some music from my windows partition :) Anyway, that's not relevant to the problem.

You apparently shrank XP to place the Ubuntu partition in front of it on the disk. Some how the front of the partition is still registered a sector 63.
That's absolutely correct, sir.

What did you use to shrink it?
One of a few utilities: Windows Disk Management, GParted, and I clearly remember that I used fdisk because of that "partition out of bounds" error.

In a terminal write 'sudo grub-install /dev/sda'.
Didn't help. Ran that boot_info_script again with the same output.
Also, don't be confused by that line in my boot.ini: multi(0)disk(0)rdisk(0)partition(0). I tried to use partition numbers from 0 to 4 (originally there was 4) to no avail.
That's absolutely obvious that I need to specify Windows starting boot sector to be 81915435, not 63. I just don't get how to do that :( As I said I already tried FIXBOOT command from Windows Repair Console.

ronparent
October 30th, 2010, 04:01 PM
I had presumed that the boot sector referred to was the MBR on sda. But, it might refer to an old separate boot sector on sda3? If that were the case it might be primarily an XP problem to correct. As you have already said you have used the fixboot command. Although possible to write a grub boot sector to that partition, I'm uncertain as to whether or not that would permit XP to boot?

Intuitively I think if that partition boot sector were corrected the problem would be solved. But I just don't remember enough about the XP repair console to suggest a solution. Someone???

JavaGeek666
October 30th, 2010, 04:47 PM
I guess, if I won't find any solution, I will try to move Windows partition back to 63rd sector. Although, not sure how to properly do that with minimum side effects.

JavaGeek666
October 30th, 2010, 06:36 PM
Yahoo!!! The problem is solved. I used a lhe (linux hex editor) to edit my /dev/sda3. I simply replaced 3F 00 00 00 address (those were 1C through 1F bytes) to the one that was specified in boot_info_script output. And that's it! If someone would run in to the same problem, just let me know, and I'll try to help you.
Thank you ronparent and q999, for participation in discussion!

ronparent
October 30th, 2010, 07:59 PM
Glad to hear you found a solution. Better than depending on the limited windows tools!

JavaGeek666
October 30th, 2010, 09:05 PM
Better than depending on the limited windows tools!
Well, sometimes I'm annoyed by Ubuntu incompatibility with development tools that we use (especially on Lucid many apps look really ugly and clumsy, some graphical components aren't even painted, and I did encounter many difficulties with properly installing common windows fonts). But I don't blame Ubuntu developing team for that, I think that they're doing a great job popularizing free software ideology and making Linux friendly for Windows users. But unfortunately not all software vendors support Ubuntu which makes it harder for me to completely get rid of Windows :)