incorrect groot (order of HD detection?)

Bug #16824 reported by Simon Morgan
10
Affects Status Importance Assigned to Milestone
grub (Ubuntu)
Confirmed
High
Tollef Fog Heen

Bug Description

After installation groot is set to (2,2) which leads to an "Error 22: No such
partition" error. The only way to boot into the newly installed system is to
edit the grub boot list entry and set groot to (0,2).

I'm fairly sure the IDE drives are confusing grub/the installer because I've
installed Ubuntu on this machine when those drives weren't installed in the
system and didn't have this problem.

My hard drive setup looks like this:

Disk /dev/sda: 80.0 GB, 80026361856 bytes
255 heads, 63 sectors/track, 9729 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

   Device Boot Start End Blocks Id System
/dev/sda1 1 4628 37174378+ 7 HPFS/NTFS
/dev/sda2 9664 9729 530145 82 Linux swap / Solaris
/dev/sda3 * 4629 7178 20482875 83 Linux
/dev/sda4 7179 9663 19960762+ 83 Linux

Partition table entries are not in disk order

Disk /dev/hda: 160.0 GB, 160041885696 bytes
255 heads, 63 sectors/track, 19457 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

   Device Boot Start End Blocks Id System
/dev/hda1 1 19457 156288321 83 Linux

Disk /dev/hdb: 200.0 GB, 200049647616 bytes
255 heads, 63 sectors/track, 24321 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

   Device Boot Start End Blocks Id System
/dev/hdb1 * 1 24321 195358401 83 Linux

Revision history for this message
Simon Morgan (sjmorgan) wrote :

I just flashed my BIOS (nothing to do with this problem) and now groot(2,2)
actually works (obviously 0,0 doesn't). Does that mean it was a bug in the BIOS
or is it still possibly a problem with grub?

Revision history for this message
postmast3r (postmast3r) wrote :

A friend had a similar problem. He has 3 hard drives. Ubuntu's installer
detects them in one order, grub detects them in a different order meaning grub
fails to boot ubuntu on a fresh install since it can't find the partition ubuntu
is on. A little fiddling around with the root hd(x,x) was able to find the
differing partition layout grub picks up to enable booting.

On his setup, a hard drive connected to the primary IDE channel which should be
/dev/hdb (slave on the primary channel) was coming up as /dev/hdc in ubuntu's
installer and a drive on the secondary channel which should be /dev/hdc came up
as /dev/hdb in the installer. So, when he installed linux an ext3 partition on
"/dev/hdc3", it needed a "root hd(1,2)" in grub to be booted, but the installer
put "root hd(2,2)" and that failed and got the error 22, no such partition error.

I might be able to get more details from his system later and might be able to
attach them to this bug report.

Revision history for this message
postmast3r (postmast3r) wrote :

Woops, forgot to mention that this wasn't on an amd64 machine, but was on 1.2ghz
x86 (32 bit) machine.

The ubuntu he was using was 5.04 "Hoary Hedgehog" installed in "net install"
fashion. Just grabbing the necessary files for net installing + using grub for
DOS to run grub in DOS to launch the installer.

Revision history for this message
postmast3r (postmast3r) wrote :

Ok. I got his "hwdb-xml -a" hardware report.

Revision history for this message
postmast3r (postmast3r) wrote :

Created an attachment (id=2736)
hardwarereport.xml

This is the output of "hwdb-xml -a" from his machine that had the issue with
grub detecting drives in a different order than the installer did.

Revision history for this message
postmast3r (postmast3r) wrote :

(In reply to comment #2)

hmm. I might have gotten things slightly mixed up when recalling the issue from
memory with the exact partitions involved.

He installed Ubuntu Linux 5.04 on /dev/hdb2 (an "ext3" partition). He setup
swap to be on /dev/hdb1. When the Ubuntu installer sets up grub, it sets it up
assuming "/dev/hdb2" is grub's "hd(1,1)" and sets the grub root lines to that in
grub. But, after the installation, when he reboots and tries to boot Linux, it
then says error 22, which a quick search on the web indicates "partition not
found" (I guess the full text message did not appear on his machine when error
22 came up).

Changing the "root hd(1,1)" lines to "root hd(2,1)" fixes the error 22 message
even though his /dev/hdb2 is NOT "/dev/hdc2" as "root hd(2,1)" would indicate.
So, without "root hd(2,1)" he can't boot.

"sudo grub-install /dev/hda" on his machine outputs:
Due to a bug in xfs_freeze, the following command might produce a
segmentation
fault when /boot/grub is not in an XFS filesystem. This error is harmless
and
can be ignored.
xfs_freeze: specified file ["/boot/grub"] is not on an XFS filesystem
Installation finished. No error reported.
This is the contents of the device map /boot/grub/device.map.
Check if this is correct or not. If any of the lines is incorrect,
fix it and re-run the script ^Grub-install'.

(hd0) /dev/hda
(hd1) /dev/hdb
(hd2) /dev/hdc

Indicating that grub's installer when booting in Ubuntu thinks "/dev/hdb" is (hd1).

Revision history for this message
postmast3r (postmast3r) wrote :

Created an attachment (id=2737)
menu.lst

This is a modified menu.lst containing the changes we had to make to get his
machine to boot into Ubuntu Linux.

See the weirdness? "root=/dev/hdb2" on the kernel lines work yet the only way
to boot that entry without the "error 22" is to have "root hd(2,1)" on the root
lines.

Revision history for this message
Simon Morgan (sjmorgan) wrote :

Still broken in Hoary preview.

Jeff Bailey (jbailey)
Changed in grub:
assignee: jbailey → tfheen
Revision history for this message
Upendran (ubuntu-upendran) wrote :

This problem occurs when both SATA and IDE drives are installed. This continues in 6.06 LTS.

While installing SATA drives are counted first followed by IDE drives.

In menu.lst the assignment is reversed.

This problem does not occurr in Fedora, Suse and Mandriva. It may be noted that these distros allow to explicitly specify location of boot loader.

An average user is unlikely to to have a mixture of hard drives.

Revision history for this message
iscurrah (iscurrah) wrote :

Hello,

I've had a similar problem in that after updating to 2.6.15-26, my grub menu.lst was incorrectly written.

This is my partition table for /dev/hda:
Disk /dev/hda: 120.0 GB, 120034123776 bytes
255 heads, 63 sectors/track, 14593 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

   Device Boot Start End Blocks Id System
/dev/hda1 * 1 3 24066 83 Linux
/dev/hda2 4 14594 117196695+ f W95 Ext'd (LBA)
/dev/hda5 4 88 682731 82 Linux swap / Solaris
/dev/hda6 1277 14594 106971322+ 83 Linux
/dev/hda7 89 1276 9542578+ 83 Linux

And my default grub boot option has been written as :
## ## End Default Options ##

title Ubuntu, kernel 2.6.15-26-386
root (hd0,0)
kernel /vmlinuz-2.6.15-26-386 root=/dev/hda5 ro quiet splash
initrd /initrd.img-2.6.15-26-386
savedefault
boot

/etc/fstab is :
# /etc/fstab: static file system information.
#
# <file system> <mount point> <type> <options> <dump> <pass>
proc /proc proc defaults 0 0
/dev/hda7 / reiserfs defaults 0 1
/dev/hda1 /boot ext2 defaults 0 2
/dev/hda6 /data reiserfs defaults 0 1
/dev/hda5 none swap sw 0 0
/dev/hdc /media/dvd udf,iso9660 ro,user,noauto 0 0
/dev/hdd /media/cdrom udf,iso9660 ro,user,noauto 0 0
/dev/fd0 /media/floppy auto rw,user,noauto 0 0
/dev/casio /media/casio vfat rw,user,noauto 0 0
/dev/hp618 /media/hp618 vfat rw,user,noauto 0 0
/dev/olympus /media/olympus vfat rw,user,noauto 0 0
none /proc/bus/usb usbfs defaults 0 0

So on boot, grub is looking for my root partition on hda5 rather than hda7.

Hope that this is in the correct place and it helps track the installation problem down - any questions, please ask.

Iain.

Revision history for this message
thedarkwinter (michael-thedarkwinter) wrote :

Just to add my 2 cents!!

My system is AMD64 (more detail prob not relevant as i have had the same problem on two different AMD64 motherboards)

HDD config:
2 HDD: 1 SATA2, 1 IDE

As SATA is faster than IDE i have used it as my primary drive, and disabled the IDE drive in the CMOS so that windows recognized the SATA2 is HD0 at boot-time. When installing ubuntu (5.10 and 6.06) it installs everything in the right place etc, but detects the SATA2 as HD1 and the IDE as HD0, and therefore the grub menu.lst uses ROOT(HD1,x) instead of (HD0,x). This is very simple to fix manually, but whenever there is a Kernel update, debconf(?) rewrites the menu.lst file back to (HD1,x).

For whats its worth:

Filesystem Size Used Avail Use% Mounted on
/dev/sda9 29G 2.8G 25G 10% /
varrun 1014M 104K 1014M 1% /var/run
varlock 1014M 4.0K 1014M 1% /var/lock
udev 1014M 124K 1014M 1% /dev
devshm 1014M 0 1014M 0% /dev/shm
lrm 1014M 19M 996M 2% /lib/modules/2.6.15-26-386/volatile
/dev/sda8 17G 395M 16G 3% /home
/dev/sda1 40G 14G 26G 34% /media/c-drive
/dev/sda5 143G 65G 78G 46% /media/d-drive
/dev/hdc1 56G 30G 27G 53% /media/music
/dev/hdc2 56G 24G 33G 43% /media/video

I'm not a very advanced user, so forgive some of my more assumptive comments!

1 Last note, when i install SuSE 10 on the same system - grub worked without a problem.

Michael

Revision history for this message
Paul Dufresne (paulduf) wrote :

Set as a duplicate of Bug #8497 which makes this one confirmed.

Changed in grub:
status: Unconfirmed → Confirmed
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.