Note: This bug is displayed in read-only format because
the product is no longer active in Red Hat Bugzilla.
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.
Improved sorting of GRUB2 boot menu
An issue with the sorting mechanism used by the "grub2-mkconfig" command could cause the grub.cfg configuration file to be generated with available kernels sorted incorrectly.
GRUB2 now uses the _rpmdevtools_ package to sort available kernels and the configuration file is being generated correctly with the most recent kernel version listed at the top.
Description of problem:
"grub2-mkconfig" command is not sorting kernel menu entries in proper order.
Version-Release number of selected component (if applicable):
grub2-2.02-0.2.10.el7.x86_64
How reproducible:
Always
Steps to Reproduce:
1. Install multiple kernels on RHEL7 and check default grub.cfg file
2. run "grub2-mkconfig -o /boot/grub2/grub.cfg
3. Now check the order of kernel menuentry in /boot/grub2/grub.cfg
# grub2-mkconfig | grep menuentry
Actual results:
menuentry 'Red Hat Enterprise Linux Server, with Linux 3.10.0-123.el7.x86_64' --class red --class gnu-linux --class gnu --class os --unrestricted $menuentry_id_option 'gnulinux-3.10.0-123.el7.x86_64-advanced-c2dcadd7-fdd1-4d7d-aeb4-6ff2e3802b36' {
Found linux image: /boot/vmlinuz-3.10.0-123.4.4.el7.x86_64
Found initrd image: /boot/initramfs-3.10.0-123.4.4.el7.x86_64.img
menuentry 'Red Hat Enterprise Linux Server, with Linux 3.10.0-123.4.4.el7.x86_64' --class red --class gnu-linux --class gnu --class os --unrestricted $menuentry_id_option 'gnulinux-3.10.0-123.4.4.el7.x86_64-advanced-c2dcadd7-fdd1-4d7d-aeb4-6ff2e3802b36' {
Found linux image: /boot/vmlinuz-3.10.0-123.4.2.el7.x86_64
Found initrd image: /boot/initramfs-3.10.0-123.4.2.el7.x86_64.img
menuentry 'Red Hat Enterprise Linux Server, with Linux 3.10.0-123.4.2.el7.x86_64' --class red --class gnu-linux --class gnu --class os --unrestricted $menuentry_id_option 'gnulinux-3.10.0-123.4.2.el7.x86_64-advanced-c2dcadd7-fdd1-4d7d-aeb4-6ff2e3802b36' {
Found linux image: /boot/vmlinuz-0-rescue-31774a1cc2a54819ab51e1d81bb9dac7
Found initrd image: /boot/initramfs-0-rescue-31774a1cc2a54819ab51e1d81bb9dac7.img
Expected results:
Latest kernel entries should come first in /boot/grub2/grub.cfg.
Additional info:
There issue is already report in Fedora(fixed) bug : https://bugzilla.redhat.com/show_bug.cgi?id=678840
I'm seeing this behavior as well. After updating/installing the latest kernel and rebooting I still see the following output from yum:
Security: kernel-3.10.0-123.6.3.el7.x86_64 is an installed security update
Security: kernel-3.10.0-123.el7.x86_64 is the currently running version
The work around described here seems to work:
https://access.redhat.com/solutions/1145853
Not sure about the workaround, I thought that the sort fails because the "e" of "el7" in "123.el7.x86_64" wins over numbers when compared to the three-level deep revisions of the latter kernels.
The comparison is version_test_gt() in /usr/share/grub/grub-mkconfig_lib, and at least this quick modification that simply crops off from .el7 appeared to result in correct ordering:
version_test_gt_a="`echo "$1" | sed -e "s/[^-]*-//" -e "s/\.el[0-9].*//"`"
version_test_gt_b="`echo "$2" | sed -e "s/[^-]*-//" -e "s/\.el[0-9].*//"`"
Comment 4Nicholas, Crawford
2014-10-19 16:37:15 UTC
Comment 5Nathan G. Grennan
2014-12-08 23:52:18 UTC
The problem is .x86_64 on the end. I created a patch that works around this issue. I tested it actual numbers 123, 123.6.3, and 123.9.3. I also tested it with actual numbers and made up numbers like 122 and 124. It does the right thing in both cases.
I also formatted my patch be friendly with adding the the src.rpm.
Comment 6Nathan G. Grennan
2014-12-08 23:52:49 UTC
*** Bug 1154430 has been marked as a duplicate of this bug. ***
Comment 9Nathan G. Grennan
2014-12-16 19:53:25 UTC
This bug also affects Fedora 21. It is just that Fedora has stuck to simpler/shorter release numbers for kernel packages. I made a custom kernel, kernel-core-3.17.6-300.11.fc21.x86_64, based on kernel-core-3.17.6-300.fc21.x86_64. It has the same issue with grub2.
The reason is that grub-mkconfig_lib user sort -V to compare the order of two versions and the GNU implementation does not recognizes suffixes that contain '_' such as x86_64. The bug is reported on the GRUB site - https://savannah.gnu.org/bugs/?42844
I've provided more detailed explanation and patch there
Hi Robert, I have updated Doc Text to prepare it for 7.2 Beta Release Notes.
Please review the Doc Text field and let me know whether it's correct or if there's anything you would like to add or change.
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/RHSA-2015-2401.html
Description of problem: "grub2-mkconfig" command is not sorting kernel menu entries in proper order. Version-Release number of selected component (if applicable): grub2-2.02-0.2.10.el7.x86_64 How reproducible: Always Steps to Reproduce: 1. Install multiple kernels on RHEL7 and check default grub.cfg file 2. run "grub2-mkconfig -o /boot/grub2/grub.cfg 3. Now check the order of kernel menuentry in /boot/grub2/grub.cfg # grub2-mkconfig | grep menuentry Actual results: menuentry 'Red Hat Enterprise Linux Server, with Linux 3.10.0-123.el7.x86_64' --class red --class gnu-linux --class gnu --class os --unrestricted $menuentry_id_option 'gnulinux-3.10.0-123.el7.x86_64-advanced-c2dcadd7-fdd1-4d7d-aeb4-6ff2e3802b36' { Found linux image: /boot/vmlinuz-3.10.0-123.4.4.el7.x86_64 Found initrd image: /boot/initramfs-3.10.0-123.4.4.el7.x86_64.img menuentry 'Red Hat Enterprise Linux Server, with Linux 3.10.0-123.4.4.el7.x86_64' --class red --class gnu-linux --class gnu --class os --unrestricted $menuentry_id_option 'gnulinux-3.10.0-123.4.4.el7.x86_64-advanced-c2dcadd7-fdd1-4d7d-aeb4-6ff2e3802b36' { Found linux image: /boot/vmlinuz-3.10.0-123.4.2.el7.x86_64 Found initrd image: /boot/initramfs-3.10.0-123.4.2.el7.x86_64.img menuentry 'Red Hat Enterprise Linux Server, with Linux 3.10.0-123.4.2.el7.x86_64' --class red --class gnu-linux --class gnu --class os --unrestricted $menuentry_id_option 'gnulinux-3.10.0-123.4.2.el7.x86_64-advanced-c2dcadd7-fdd1-4d7d-aeb4-6ff2e3802b36' { Found linux image: /boot/vmlinuz-0-rescue-31774a1cc2a54819ab51e1d81bb9dac7 Found initrd image: /boot/initramfs-0-rescue-31774a1cc2a54819ab51e1d81bb9dac7.img Expected results: Latest kernel entries should come first in /boot/grub2/grub.cfg. Additional info: There issue is already report in Fedora(fixed) bug : https://bugzilla.redhat.com/show_bug.cgi?id=678840