Ubuntu

Grub rescue xp/ubuntu dual boot fix

Asked by Eddie on 2011-01-03

Hi. I'm new to Ubuntu and I installed Ubuntu 10.4 (later updated to 10.10) on a system which already contained XP Pro. All worked fine untill I had trouble booting in. I used LiveCD to restore my Grub2 after which I still couldn't boot in to any of the operating systems. Previously I could boot into Ubuntu or XP but now I can't. I thought it might have been the presence of a harddrive which I attached later to the system so I disconnected the drive after all else failed but still the problem persisted. Instead it gave me a "grub rescue" prompt. From a previous analysis, I also know that my partitions are not in disk order. I found a script that analyses the problem. Here's the results of the script. Please help. 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 #6 for (,msdos6)/boot/grub.
 => Grub 2 is installed in the MBR of /dev/sdb and looks on the same drive in
    partition #6 for (,msdos6)/boot/grub.

sda1: _________________________________________________________________________

    File system: ntfs
    Boot sector type: Windows XP
    Boot sector info: No errors found in the Boot Parameter Block.
    Operating System:
    Boot files/dirs: /boot/grub/core.img

sdb1: _________________________________________________________________________

    File system: ntfs
    Boot sector type: Windows XP
    Boot sector info: No errors found in the Boot Parameter Block.
    Operating System: Windows XP
    Boot files/dirs: /boot.ini /ntldr /NTDETECT.COM

sdb2: _________________________________________________________________________

    File system: Extended Partition
    Boot sector type: -
    Boot sector info:

sdb5: _________________________________________________________________________

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

sdb6: _________________________________________________________________________

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

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

Drive: sda ___________________ _____________________________________________________

Disk /dev/sda: 20.0 GB, 20020396032 bytes
255 heads, 63 sectors/track, 2434 cylinders, total 39102336 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 39,086,144 39,086,082 7 HPFS/NTFS

Drive: sdb ___________________ _____________________________________________________

Disk /dev/sdb: 80.0 GB, 80026361856 bytes
255 heads, 63 sectors/track, 9729 cylinders, total 156301488 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes

Partition Boot Start End Size Id System

/dev/sdb1 * 63 78,300,809 78,300,747 7 HPFS/NTFS
/dev/sdb2 78,301,182 156,296,384 77,995,203 5 Extended
/dev/sdb5 153,003,123 156,296,384 3,293,262 82 Linux swap / Solaris
/dev/sdb6 78,301,184 153,001,983 74,700,800 83 Linux

blkid -c /dev/null: ____________________________________________________________

Device UUID TYPE LABEL

/dev/loop0 squashfs
/dev/sda1 42205458205454CF ntfs
/dev/sda: PTTYPE="dos"
/dev/sdb1 10C08E2DC08E195C ntfs HOMECOMPUTER
/dev/sdb2: PTTYPE="dos"
/dev/sdb5 0f18590d-373a-4dfb-bed3-7176201b4b02 swap
/dev/sdb6 b51db19b-b10b-441b-8244-dee08a8225e4 ext4
/dev/sdb: PTTYPE="dos"

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

Device Mount_Point Type Options

aufs / aufs (rw)
/dev/sr0 /cdrom iso9660 (ro,noatime)
/dev/loop0 /rofs squashfs (ro,noatime)
/dev/sdb6 /mnt ext4 (rw)
/dev/sda1 /media/42205458205454CF fuseblk (rw,nosuid,nodev,allow_other,blksize=4096,default_permissions)
/dev/sdb1 /media/HOMECOMPUTER fuseblk (rw,nosuid,nodev,allow_other,blksize=4096,default_permissions)

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

    ??GB: boot/grub/core.img

================================ sdb1/boot.ini: ================================

[boot loader]

timeout=30

default=multi(0)disk(0)rdisk(0)partition(1)\WINDOWS

[operating systems]

multi(0)disk(0)rdisk(0)partition(1)\WINDOWS="Microsoft Windows XP Professional" /noexecute=optin /fastdetect

============================= sdb6/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='(hd1,msdos6)'
search --no-floppy --fs-uuid --set b51db19b-b10b-441b-8244-dee08a8225e4
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='(hd1,msdos6)'
search --no-floppy --fs-uuid --set b51db19b-b10b-441b-8244-dee08a8225e4
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 ###
### 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+ ###
### END /etc/grub.d/20_memtest86+ ###

### BEGIN /etc/grub.d/30_os-prober ###
menuentry "Microsoft Windows XP Professional (on /dev/sdb1)" {
    insmod part_msdos
    insmod ntfs
    set root='(hd1,msdos1)'
    search --no-floppy --fs-uuid --set 10c08e2dc08e195c
    drivemap -s (hd0) ${root}
    chainloader +1
}
menuentry "Microsoft Windows XP Professional (on /dev/sdc1)" {
    insmod part_msdos
    insmod ntfs
    set root='(hd2,msdos1)'
    search --no-floppy --fs-uuid --set fe60955d60951e09
    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 ###

=========================== sdb6/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 {
}

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-24-generic' --class ubuntu --class gnu-linux --class gnu --class os {
    recordfail
    insmod part_msdos
    insmod ext2
    set root='(hd1,msdos6)'
    search --no-floppy --fs-uuid --set b51db19b-b10b-441b-8244-dee08a8225e4
    linux /boot/vmlinuz-2.6.35-24-generic root=UUID=b51db19b-b10b-441b-8244-dee08a8225e4 ro quiet splash
    initrd /boot/initrd.img-2.6.35-24-generic
}
menuentry 'Ubuntu, with Linux 2.6.35-24-generic (recovery mode)' --class ubuntu --class gnu-linux --class gnu --class os {
    recordfail
    insmod part_msdos
    insmod ext2
    set root='(hd1,msdos6)'
    search --no-floppy --fs-uuid --set b51db19b-b10b-441b-8244-dee08a8225e4
    echo 'Loading Linux 2.6.35-24-generic ...'
    linux /boot/vmlinuz-2.6.35-24-generic root=UUID=b51db19b-b10b-441b-8244-dee08a8225e4 ro single
    echo 'Loading initial ramdisk ...'
    initrd /boot/initrd.img-2.6.35-24-generic
}
menuentry 'Ubuntu, with Linux 2.6.35-23-generic' --class ubuntu --class gnu-linux --class gnu --class os {
    recordfail
    insmod part_msdos
    insmod ext2
    set root='(hd1,msdos6)'
    search --no-floppy --fs-uuid --set b51db19b-b10b-441b-8244-dee08a8225e4
    linux /boot/vmlinuz-2.6.35-23-generic root=UUID=b51db19b-b10b-441b-8244-dee08a8225e4 ro quiet splash
    initrd /boot/initrd.img-2.6.35-23-generic
}
menuentry 'Ubuntu, with Linux 2.6.35-23-generic (recovery mode)' --class ubuntu --class gnu-linux --class gnu --class os {
    recordfail
    insmod part_msdos
    insmod ext2
    set root='(hd1,msdos6)'
    search --no-floppy --fs-uuid --set b51db19b-b10b-441b-8244-dee08a8225e4
    echo 'Loading Linux 2.6.35-23-generic ...'
    linux /boot/vmlinuz-2.6.35-23-generic root=UUID=b51db19b-b10b-441b-8244-dee08a8225e4 ro single
    echo 'Loading initial ramdisk ...'
    initrd /boot/initrd.img-2.6.35-23-generic
}
menuentry 'Ubuntu, with Linux 2.6.35-22-generic' --class ubuntu --class gnu-linux --class gnu --class os {
    recordfail
    insmod part_msdos
    insmod ext2
    set root='(hd1,msdos6)'
    search --no-floppy --fs-uuid --set b51db19b-b10b-441b-8244-dee08a8225e4
    linux /boot/vmlinuz-2.6.35-22-generic root=UUID=b51db19b-b10b-441b-8244-dee08a8225e4 ro quiet splash
    initrd /boot/initrd.img-2.6.35-22-generic
}
menuentry 'Ubuntu, with Linux 2.6.35-22-generic (recovery mode)' --class ubuntu --class gnu-linux --class gnu --class os {
    recordfail
    insmod part_msdos
    insmod ext2
    set root='(hd1,msdos6)'
    search --no-floppy --fs-uuid --set b51db19b-b10b-441b-8244-dee08a8225e4
    echo 'Loading Linux 2.6.35-22-generic ...'
    linux /boot/vmlinuz-2.6.35-22-generic root=UUID=b51db19b-b10b-441b-8244-dee08a8225e4 ro single
    echo 'Loading initial ramdisk ...'
    initrd /boot/initrd.img-2.6.35-22-generic
}
### 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='(hd1,msdos6)'
    search --no-floppy --fs-uuid --set b51db19b-b10b-441b-8244-dee08a8225e4
    linux16 /boot/memtest86+.bin
}
menuentry "Memory test (memtest86+, serial console 115200)" {
    insmod part_msdos
    insmod ext2
    set root='(hd1,msdos6)'
    search --no-floppy --fs-uuid --set b51db19b-b10b-441b-8244-dee08a8225e4
    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/sdb1)" {
    insmod part_msdos
    insmod ntfs
    set root='(hd1,msdos1)'
    search --no-floppy --fs-uuid --set 10c08e2dc08e195c
    drivemap -s (hd0) ${root}
    chainloader +1
}
menuentry "Microsoft Windows XP Professional (on /dev/sdc1)" {
    insmod part_msdos
    insmod ntfs
    set root='(hd2,msdos1)'
    search --no-floppy --fs-uuid --set fe60955d60951e09
    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 ###

=============================== sdb6/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/sdb6 during installation
UUID=b51db19b-b10b-441b-8244-dee08a8225e4 / ext4 errors=remount-ro 0 1
# swap was on /dev/sdb5 during installation
UUID=0f18590d-373a-4dfb-bed3-7176201b4b02 none swap sw 0 0
/dev/fd0 /media/floppy0 auto rw,user,noauto,exec,utf8 0 0

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

  59.5GB: boot/grub/core.img
  59.5GB: boot/grub/grub.cfg
  45.9GB: boot/initrd.img-2.6.35-22-generic
  71.2GB: boot/initrd.img-2.6.35-23-generic
  67.9GB: boot/initrd.img-2.6.35-24-generic
  59.6GB: boot/vmlinuz-2.6.35-22-generic
  60.5GB: boot/vmlinuz-2.6.35-23-generic
  60.6GB: boot/vmlinuz-2.6.35-24-generic
  40.2GB: grub/core.img
  44.6GB: grub/grub.cfg
  67.9GB: initrd.img
  71.2GB: initrd.img.old
  60.6GB: vmlinuz
  60.5GB: vmlinuz.old

Question information

Language:
English Edit question
Status:
Solved
For:
Ubuntu grub Edit question
Assignee:
No assignee Edit question
Solved by:
delance
Solved:
2011-01-04
Last query:
2011-01-04
Last reply:
2011-01-03
Best delance (olivier-delance) said : #2

 => Grub 2 is installed in the MBR of /dev/sda and looks on the same drive in
    partition #6 for (,msdos6)/boot/grub.
Unfortunately, there's no sda6 partition, so it can't work.
Are both disks internal ?
I see two solutions, if both are internal:
1-Windows second
First restore boot on Windows disk
Switch both disk
Reinstall Grub2 on first disk, which must be Ubuntu
2-Windows first
Reinstall Grub2 on Windows disk sda with usage of sdb6 partition

If one disk is external, it's a little more complicated.

Eddie (eddiecampher) said : #3

Hi Delance

Thanks for responding so promptly to my question. Much appreciated. However, while I was sweating it out yesterday I decided to experiment a little. Remember I said I disconnected the other drive which I suspected of causing the problem. What I did was this: I shut down the computer completely, disconnected the power, reset the motherboard and booted into the BIOS. I then changed the boot priority of the two remaining harddives, and voila! It booted right into the multi-bootloader where both my OS'es were showing. I first choose Ubuntu 10.10 and it was faster than ever. I updated it from the net and everything was fine. I immediate installed a backup utility called Simple Backup (which I later used to backup the system to the other drive I connected up again). I then rebooted into my XP installation which seemed awfully slow. Expecting a viral infection, I then updated my AntiVirus package (Kaspersky), ran a scan which ran for hours. And although it didn't seem to have found a virus, everything was back to normal. I then shutdown and reconnected the harddive I had connected earlier. It contain a huge nuber of important files. Booting into both OS'es shows its working fine. So yes, my problem appears to be solved. Do you think I should reinstall Grub2? Thank you so much for showing an interest in my problem.

delance (olivier-delance) said : #4

If it works and you are happy with this, change nothing!