RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Bug 1279599 - grub2-install fails on devices with minor numbers that exceed 8 bits
Summary: grub2-install fails on devices with minor numbers that exceed 8 bits
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: grub2
Version: 7.1
Hardware: All
OS: Linux
high
high
Target Milestone: rc
: ---
Assignee: Peter Jones
QA Contact: Release Test Team
Clayton Spicer
URL:
Whiteboard:
Depends On:
Blocks: 1203710 1295926 1313485
TreeView+ depends on / blocked
 
Reported: 2015-11-09 20:20 UTC by jcastran
Modified: 2019-12-16 05:04 UTC (History)
7 users (show)

Fixed In Version: grub-2.02-0.35.el7
Doc Type: Bug Fix
Doc Text:
A wider variety of partitions can be used as `/boot` Previously, the GRUB2 boot loader only supported 8-bit device node minor numbers. Consequently, boot loader installation failed on device nodes with minor numbers larger than `255`. All valid Linux device node minor numbers are now supported, and as a result a wider variety of partitions can be used as `/boot` partitions.
Clone Of:
Environment:
Last Closed: 2016-11-04 03:59:28 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2016:2336 0 normal SHIPPED_LIVE grub2 bug fix and enhancement update 2016-11-03 13:45:27 UTC

Description jcastran 2015-11-09 20:20:06 UTC
grub2-install fails on devices with minor numbers that exceed 8 bits. On large systems used for virtualization of large numbers of virtual machines, the boot drive for a new machine can end up with disks/partitions that have minor numbers > 255, in which case "chroot grub2-install ...." will fail.

Where are you experiencing the behavior?  What environment?

In grub-core/osdep/devmapper/getroot.c, there is this function, which makes the erroneous assumption that minor numbers are still 8-bit. This assumption has not been true for quite some time:

char *
grub_util_devmapper_part_to_disk (struct stat *st,
                                  int *is_part, const char *path)
{
  int major, minor;

  if (grub_util_get_dm_node_linear_info (st->st_rdev,
                                         &major, &minor, 0))
    {
      *is_part = 1;
      return grub_find_device ("/dev",
                               (major << 8) | minor);         <<<<< --------- ERROR!
    }
  *is_part = 0;
  return xstrdup (path);
}

When does the behavior occur? Frequently?  Repeatedly?   At certain times?

Repeatable. Depends on how many other VMs have been deployed previously on a host.

Comment 2 jcastran 2015-11-10 18:30:55 UTC
I asked the customer what their environment was and how they are running into this issue.

Jim Bayer:
In our particular case, we are using relatively large systems (HP DL380p Gen8s, for example) as virtual machine hosts. Each virtual machine has a boot drive that corresponds to a LUN on an IBM SVC array that is connected either via iSCSI or fibre channel. So, for example, running 100 virtual machines on a host means there are >100 disks attached to the host (many VMs have more than just a single drive), and when you account for partitions on top of the raw devices, it doesn't take too many VMs before the device mapper starts hitting minor numbers beyond 255. Each new VM is created by allocating a LUN, partitioning it, creating file systems, mounting them on the host, and then unpacking a template (which was originally build by installing from an ISO, but, rather than go through rebuilding from ISO every time, we create an archive of an install that has a certain level of our local configuration changes already made). The installation script then attempts to run the GRUB installer under chroot to set up GRUB for the VM. Many of our older VMs used RHEL or CentOS 5.x or 6.x, which were all based off "legacy GRUB", and this issue did not occur in the older code base. When we started deploying 7.x VMs, though, the switch in those releases to GRUB2 exposed this particular bug that has apparently been in the re-implemented code base for a while (according to git logs).

Comment 5 Jan Stodola 2016-02-04 21:01:07 UTC
Reproduced in a virtual machine:
1) created 266 disk images and associated them with /dev/loop devices (loop0-loop265)
2) install the anaconda package
3) make sure the minor number of /dev/loop265 is higher than 255:
[root@localhost ~]# ls -l /dev/loop265
brw-rw----. 1 root disk 7, 265 Feb  4 21:46 /dev/loop265
[root@localhost ~]#

4) proceed through installation to the disk image associated with /dev/loop265:
anaconda --repo <REPO_PATH> --text --image /dev/loop265

The installation fails at the end of the installation when installing boot loader.

program.log:
...
21:35:21,881 INFO program: Running... grub2-install --no-floppy /dev/loop261
21:35:30,001 INFO program: Installing for i386-pc platform.
21:35:30,002 INFO program: grub2-install: error: cannot find a GRUB drive for /dev/mapper/loop265p1.  Check your device.map.
21:35:30,002 DEBUG program: Return code: 1
...

Comment 8 Peter Kotvan 2016-08-18 13:31:33 UTC
Reproduced on RHEL-7.2 GA with anaconda-21.48.22.56-1.el7. Verified on RHEL-7.3-20160817.1 with anaconda-21.48.22.82-1.el7.

Comment 11 errata-xmlrpc 2016-11-04 03:59:28 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://rhn.redhat.com/errata/RHBA-2016-2336.html


Note You need to log in before you can comment on or make changes to this bug.