bugGNU GRUB - Bugs: bug #28206, grub2 sees wrong partition table...

 
 

You are not allowed to post comments on this tracker with your current authentication level.

bug #28206: grub2 sees wrong partition table and refuse to boot winxp through chainloader

Submitter:  dimas <dimas000>
Submitted:  Sun 06 Dec 2009 07:15:38 PM UTC
   
 
Category:  Disk & Partition Severity:  Major
Priority:  5 - Normal Item Group:  Software Error
Status:  Invalid Privacy:  Public
Assigned to:  None Originator Name: 
Open/Closed:  Closed Release:  1.97
Release:  Reproducibility:  None
Planned Release:  None

Sun 06 Dec 2009 07:54:17 PM UTC, comment #1: 

mapping between disks and hdX is unpredictable. That's why we use UUIDs (search ...). Just use autogenerated entry

Vladimir Serbinenko <phcoder>
Group administrator
Sun 06 Dec 2009 07:15:38 PM UTC, original submission:  

i want to describe interesting bug about how grub2 sees discs and partitions. grub version is 1.97beta4 (default in Ubuntu 9.10)
first of all, user has 3 OSes - Ubuntu 9.10, winXP and vista. grub2 menu looks like this:

ubuntu ...
....
Windows loader

when users chooses "windows loader" entry, NTLDR boots with option whether to boot xp or vista. vista boots normally, but if choose xp, computer reboots.
if change boot disc in bios to one which xp installed on - computer boots with NTLDR and both win-systems boot normally.
if user tries to boot through grub2 console via "set root - chainloader - boot", we see strange behaviour:

set root=(hd2,1)
chainloader +1
the answer is "error: no such partition"

set root=(hd1,1)
chainloader +1
boot
NTLDR boots, but if choose xp - reboot

set root=(hd2.1) dot instead of comma!
chianloader +1
boot
NTLDR and both vista and xp boots!!

ok, trying last succesfull way. adding entry to 40_custom with dot used:
set root (hd2,1)
chainloader +1
when user selects new custom entry, the answer is "No partition"

and here is the most interesting thing - what "ls" command of grub2 console says. it sees 4 HDDs instead of 3! (see real partition table below to compare)
(hd0) (hd0,5) (hd0,3) (hd0,1) (hd1) (hd1,5) (hd1,1) (hd2) (hd2,5) (hd2,2) (hd3) (hd3,5) (hd3,1) (fd0)

here is windows entry in grub.cfg:
### BEGIN /etc/grub.d/30_os-prober ###
menuentry "Windows Vista (loader) (on /dev/sdc1)" {
insmod ntfs
set root=(hd2,1)
search --no-floppy --fs-uuid --set 502c43172c42f78c
chainloader +1
}
### END /etc/grub.d/30_os-prober ###

there is no (hd2,1) seen by "ls", but this entry boots to NTLDR! but the same through console - no. if, according to "ls" answer, try "set root (hd2,2)":
set root=(hd2,2)
chainloader +1
boot
black screen appears with blanking cursor in upper-left, and computer doesn't respond to anything except reset.
if try "(hd2,5":
set root=(hd2,5)
chainloader +1
boot
it displays this error message:
"A disk read error occured
Press Ctrl+Alt+Del to restart"

but if use "set root=(hd2)" - grub2 boots NTLDR and both vista and xp works.

here is 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 /boot/grub/grubenv ]; then
  have_grubenv=true
  load_env
fi
set default="0"
if [ ${prev_saved_entry} ]; then
  saved_entry=${prev_saved_entry}
  save_env saved_entry
  prev_saved_entry=
  save_env prev_saved_entry
fi
insmod ext2
set root=(hd0,3)
search --no-floppy --fs-uuid --set 4114af30-8ee5-4708-91df-28c7de457098
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
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/white
### END /etc/grub.d/05_debian_theme ###

### BEGIN /etc/grub.d/10_linux ###
menuentry "Ubuntu, Linux 2.6.31-14-generic" {
        recordfail=1
        if [ -n ${have_grubenv} ]; then save_env recordfail; fi
   set quiet=1
   insmod ext2
   set root=(hd0,3)
   search --no-floppy --fs-uuid --set 4114af30-8ee5-4708-91df-28c7de457098
   linux   /boot/vmlinuz-2.6.31-14-generic root=UUID=4114af30-8ee5-4708-91df-28c7de457098 ro   quiet splash
   initrd   /boot/initrd.img-2.6.31-14-generic
}
menuentry "Ubuntu, Linux 2.6.31-14-generic (recovery mode)" {
        recordfail=1
        if [ -n ${have_grubenv} ]; then save_env recordfail; fi
   insmod ext2
   set root=(hd0,3)
   search --no-floppy --fs-uuid --set 4114af30-8ee5-4708-91df-28c7de457098
   linux   /boot/vmlinuz-2.6.31-14-generic root=UUID=4114af30-8ee5-4708-91df-28c7de457098 ro single
   initrd   /boot/initrd.img-2.6.31-14-generic
}
### END /etc/grub.d/10_linux ###

### BEGIN /etc/grub.d/20_memtest86+ ###
menuentry "Memory test (memtest86+)" {
   linux16   /boot/memtest86+.bin
}
menuentry "Memory test (memtest86+, serial console 115200)" {
   linux16   /boot/memtest86+.bin console=ttyS0,115200n8
}
### END /etc/grub.d/20_memtest86+ ###

### BEGIN /etc/grub.d/30_os-prober ###
menuentry "Windows Vista (loader) (on /dev/sdc1)" {
   insmod ntfs
   set root=(hd2,1)
   search --no-floppy --fs-uuid --set 502c43172c42f78c
   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.
menuentry "Microsoft Windows XP Professional RU (on /dev/sdс1)" {
   set root=(hd2)
   chainloader +1
}
### END /etc/grub.d/40_custom ###

here is device.map (as we see, everything is right in it):
(hd0)   /dev/sda
(hd1)   /dev/sdb
(hd2)   /dev/sdc

here is list of REAL discs and partitions (sudo fdisk -l):
/dev/sda: 320.1 GB, 320072933376 bytes
255 heads, 63 sectors/track, 38913 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x9a88315d

boot drive in bios
Устр-во Загр     Начало       Конец       Блоки   Id  Система
/dev/sda1   *           1        3010    24177793+   7  HPFS/NTFS     ### vista
/dev/sda2            3011       37587   277739752+   5  Extended
/dev/sda3           37588       38913    10651095   83  Linux       ### ubuntu
/dev/sda5            3011       37587   277739721    7  HPFS/NTFS

/dev/sdb: 500.1 GB, 500107862016 bytes
255 heads, 63 sectors/track, 60801 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0xc28db982

##### just file storage, no systems here #####
Устр-во Загр     Начало       Конец       Блоки   Id  Система
/dev/sdb1               2       30342   243714082+   f  W95 расшир. (LBA)
/dev/sdb2           30343       60801   244661917+   7  HPFS/NTFS
/dev/sdb5               2       30342   243714051    7  HPFS/NTFS

/dev/sdc: 160.0 GB, 160041885696 bytes
255 heads, 63 sectors/track, 19457 cylinders
Units = цилиндры of 16065 * 512 = 8225280 bytes
Disk identifier: 0x17cec2b9

Устр-во Загр     Начало       Конец       Блоки   Id  Система
/dev/sdc1   *           1        2550    20482843+   7  HPFS/NTFS      ### xp
/dev/sdc2            2551       19457   135805477+   f  W95 расшир. (LBA)
/dev/sdc5            2551       19457   135805446    7  HPFS/NTFS      ### just files

after adding this to 40_custom:
menuentry "Microsoft Windows Loader (on /dev/sdс1)" {
set root=(hd2)
chainloader +1
}
everything boots!
the problem started from installation of Ubuntu 9.10, grub2 wasn't reinstalled after. on grub-legacy everything was fine.

+for russian-speaking developers: you can read original story here - http://forum.ubuntu.ru/index.php?topic=73097.0

dimas <dimas000>

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by phcoder (Posted a comment)
  • -email is unavailable- added by dimas000 (Submitted the item)
  • -email is unavailable- added by dimas000
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

     

    Follow 3 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2009-12-06 phcoder StatusNone Invalid
        Open/ClosedOpen Closed
    2009-12-06 dimas000 Carbon-Copy- Added -email is unavailable-

    Back to the top

    Powered by Savane 3.13-3230.
    Corresponding source code