#620390 grub-pc: grub-install fails on devices with exactly one partition that ends at the end of the disk

Package:
grub-pc
Source:
grub2
Description:
GRand Unified Bootloader, version 2 (PC/BIOS version)
Submitter:
Daniel Kahn Gillmor
Date:
2014-10-18 20:24:15 UTC
Severity:
important
#620390#5
Date:
2011-04-02 01:12:59 UTC
From:
To:
I have the following small disks with a single partition, linked in RAID1.

0 root@molly:~# fdisk -lu /dev/sde

Disk /dev/sde: 128 MB, 128188416 bytes
150 heads, 6 sectors/track, 278 cylinders, total 250368 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x0004fe14

   Device Boot      Start         End      Blocks   Id  System
/dev/sde1   *        8192      250367      121088   fd  Linux raid autodetect
Partition 1 has different physical/logical beginnings (non-Linux?):
     phys=(0, 130, 3) logical=(9, 15, 3)
Partition 1 has different physical/logical endings:
     phys=(15, 149, 6) logical=(278, 27, 6)
0 root@molly:~# fdisk -lu /dev/sdf

Disk /dev/sdf: 128 MB, 128188416 bytes
150 heads, 6 sectors/track, 278 cylinders, total 250368 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00048f2c

   Device Boot      Start         End      Blocks   Id  System
/dev/sdf1   *        8192      250367      121088   fd  Linux raid autodetect
Partition 1 has different physical/logical beginnings (non-Linux?):
     phys=(0, 130, 3) logical=(9, 15, 3)
Partition 1 has different physical/logical endings:
     phys=(15, 149, 6) logical=(278, 27, 6)
0 root@molly:~#

grub-install fails in the following way:

0 root@molly:~# grub-install /dev/sde
error: found two disks with the number 0.
error: superfluous RAID member (2 found).
error: found two disks with the number 0.
error: superfluous RAID member (2 found).
/usr/sbin/grub-probe: error: unknown filesystem.
Auto-detection of a filesystem of /dev/md0 failed.
Please report this together with the output of "/usr/sbin/grub-probe --device-map=/boot/grub/device.map --target=fs -v /boot/grub" to <bug-grub@gnu.org>
1 root@molly:~# /usr/sbin/grub-probe --device-map=/boot/grub/device.map --target=fs -v /boot/grub
/usr/sbin/grub-probe: info: the size of hd0 is 3907029168.
/usr/sbin/grub-probe: info: the size of hd0 is 3907029168.
/usr/sbin/grub-probe: info: the size of hd1 is 3907029168.
/usr/sbin/grub-probe: info: the size of hd1 is 3907029168.
/usr/sbin/grub-probe: info: the size of hd2 is 3907029168.
/usr/sbin/grub-probe: info: the size of hd2 is 3907029168.
/usr/sbin/grub-probe: info: the size of hd3 is 3907029168.
/usr/sbin/grub-probe: info: the size of hd3 is 3907029168.
/usr/sbin/grub-probe: info: the size of hd4 is 250368.
/usr/sbin/grub-probe: info: the size of hd4 is 250368.
/usr/sbin/grub-probe: info: the size of hd4 is 250368.
error: found two disks with the number 0.
/usr/sbin/grub-probe: info: the size of hd5 is 250368.
/usr/sbin/grub-probe: info: the size of hd5 is 250368.
/usr/sbin/grub-probe: info: the size of hd5 is 250368.
error: superfluous RAID member (2 found).
/usr/sbin/grub-probe: info: the size of hd0 is 3907029168.
/usr/sbin/grub-probe: info: the size of hd0 is 3907029168.
/usr/sbin/grub-probe: info: the size of hd1 is 3907029168.
/usr/sbin/grub-probe: info: the size of hd1 is 3907029168.
/usr/sbin/grub-probe: info: the size of hd2 is 3907029168.
/usr/sbin/grub-probe: info: the size of hd2 is 3907029168.
/usr/sbin/grub-probe: info: the size of hd3 is 3907029168.
/usr/sbin/grub-probe: info: the size of hd3 is 3907029168.
/usr/sbin/grub-probe: info: the size of hd4 is 250368.
/usr/sbin/grub-probe: info: the size of hd4 is 250368.
/usr/sbin/grub-probe: info: the size of hd4 is 250368.
/usr/sbin/grub-probe: info: the size of hd5 is 250368.
/usr/sbin/grub-probe: info: the size of hd5 is 250368.
/usr/sbin/grub-probe: info: the size of hd5 is 250368.
/usr/sbin/grub-probe: info: changing current directory to /dev.
/usr/sbin/grub-probe: info: changing current directory to dri.
/usr/sbin/grub-probe: info: changing current directory to snd.
/usr/sbin/grub-probe: info: changing current directory to net.
/usr/sbin/grub-probe: info: changing current directory to shm.
/usr/sbin/grub-probe: info: changing current directory to network.
/usr/sbin/grub-probe: info: changing current directory to vg_molly0.
/usr/sbin/grub-probe: info: changing current directory to mapper.
/usr/sbin/grub-probe: info: opening md/0.
/usr/sbin/grub-probe: error: unknown filesystem.
1 root@molly:~#



on #grub, phcoder suggests that this is fixed upstream in r3082.

#620390#22
Date:
2014-09-15 17:24:28 UTC
From:
To:
I recently needed to shrink a 6 device RAID-10 array down to 4
devices, on a Debian wheezy host. As part of that process I needed
to upgrade the metadata from 0.90 to 1.0.

After the work was done, I started receiving these "error: found two
disks with the index 3 for RAID md2" messages from grub-probe.

My searching found this bug, and the upstream bug:

http://savannah.gnu.org/bugs/index.php?34250

but both of these state that the problem is fixed upstream and that
it doesn't happen with 1.x metadata.

It turns out that the old copy of the 0.90 metadata is left on my
disk and grub-probe is finding it.

This can be verified as follows:

    # mdadm --examine --metadata=1.0 /dev/sda3
    /dev/sda3:
              Magic : a92b4efc
            Version : 1.0
        Feature Map : 0x0
         Array UUID : 3905b303:ca604b72:be5949c4:ab051b7a
               Name : 2
      Creation Time : Sun Jun  4 08:18:59 2006
         Raid Level : raid10
       Raid Devices : 4

     Avail Dev Size : 618727264 (295.03 GiB 316.79 GB)
         Array Size : 618726528 (590.06 GiB 633.58 GB)
      Used Dev Size : 618726528 (295.03 GiB 316.79 GB)
        Data Offset : 128 sectors
       Super Offset : 618727392 sectors
              State : active
        Device UUID : e30176be:81a57e84:1f2aa206:9515150f

        Update Time : Fri Sep 12 12:22:47 2014
           Checksum : bd6c9738 - correct
             Events : 1415

             Layout : near=2
         Chunk Size : 64K

       Device Role : Active device 1
       Array State : AAAA ('A' == active, '.' == missing)
    [andy@specialbrew ~]$ sudo mdadm --examine --metadata=0.90 /dev/sda3
    /dev/sda3:
              Magic : a92b4efc
            Version : 0.90.01
               UUID : 3905b303:ca604b72:be5949c4:ab051b7a
      Creation Time : Sun Jun  4 08:18:58 2006
         Raid Level : raid10
      Used Dev Size : 309363264 (295.03 GiB 316.79 GB)
         Array Size : 928089792 (885.10 GiB 950.36 GB)
       Raid Devices : 6
      Total Devices : 6
    Preferred Minor : 2

        Update Time : Sun Aug 24 14:26:50 2014
              State : clean
     Active Devices : 6
    Working Devices : 6
     Failed Devices : 0
      Spare Devices : 0
           Checksum : e613d577 - correct
             Events : 312149996

             Layout : near=2
         Chunk Size : 64K

          Number   Major   Minor   RaidDevice State
    this     5       8        3        5      active sync   /dev/sda3

       0     0       8       51        0      active sync   /dev/sdd3
       1     1       8       67        1      active sync
       2     2       8       83        2      active sync
       3     3       8       19        3      active sync   /dev/sdb3
       4     4       8       35        4      active sync   /dev/sdc3
       5     5       8        3        5      active sync   /dev/sda3

Note that it thinks there are 6 devices in the array, proving that
this is from before the shrink operation. The 1.0 metadata which is
currently being used says:

    # mdadm --examine /dev/sda3
    /dev/sda3:
              Magic : a92b4efc
            Version : 1.0
        Feature Map : 0x0
         Array UUID : 3905b303:ca604b72:be5949c4:ab051b7a
               Name : 2
      Creation Time : Sun Jun  4 08:18:59 2006
         Raid Level : raid10
       Raid Devices : 4

     Avail Dev Size : 618727264 (295.03 GiB 316.79 GB)
         Array Size : 618726528 (590.06 GiB 633.58 GB)
      Used Dev Size : 618726528 (295.03 GiB 316.79 GB)
        Data Offset : 128 sectors
       Super Offset : 618727392 sectors
              State : active
        Device UUID : e30176be:81a57e84:1f2aa206:9515150f

        Update Time : Fri Sep 12 12:22:47 2014
           Checksum : bd6c9738 - correct
             Events : 1415

             Layout : near=2
         Chunk Size : 64K

       Device Role : Active device 1
       Array State : AAAA ('A' == active, '.' == missing)

I am told it can be fixed by zeroing the old metadata:

    # mdadm --zero-super --metadata=0.90 /dev/sda3

However, that requires the array to be stopped so I haven't verified
this yet.

I thought I would mention this on this bug report because although
it is not strictly a bug of grub-probe (grub-probe could be more
verbose about what it is reading though), it can be very confusing
as to why it is happening still with 1.0 metadata, and this bug is
the main search result I found during my research.

Is this worth separate bugs on grub-probe (wishlist: be more verbose
about which version of metadata is being found and where) and/or
mdadm (wishlist: zero old metadata after upgrading to new)?

Cheers,
Andy