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 1323842 - grubby-8.28-17.el7.x86_64 - --default-kernel cannot be retrieved even if correctly set on systems with different root uuids
Summary: grubby-8.28-17.el7.x86_64 - --default-kernel cannot be retrieved even if corr...
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: grubby
Version: 7.4
Hardware: Unspecified
OS: Unspecified
urgent
urgent
Target Milestone: rc
: ---
Assignee: Peter Jones
QA Contact: Release Test Team
URL:
Whiteboard:
Depends On: 1366785
Blocks: 1366549 ovirt-node-ng-43-el77-platform 1690324
TreeView+ depends on / blocked
 
Reported: 2016-04-04 22:33 UTC by Douglas Schilling Landgraf
Modified: 2023-09-14 03:20 UTC (History)
9 users (show)

Fixed In Version: grubby-8.28-26.el7
Doc Type: Bug Fix
Doc Text:
Clone Of:
: 1690324 (view as bug list)
Environment:
Last Closed: 2019-08-06 13:07:10 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)
output strace (103.95 KB, text/plain)
2016-04-04 22:34 UTC, Douglas Schilling Landgraf
no flags Details


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2019:2227 0 None None None 2019-08-06 13:07:18 UTC

Description Douglas Schilling Landgraf 2016-04-04 22:33:25 UTC
Description of problem:

# grubby --set-default=/boot/ovirt-node-ng-4.0.0-0.3.master.20160330132038.el7+1/vmlinuz-3.10.0-327.13.1.el7.x86_64
# echo $?
0
# grubby --default-kernel
#
<if I reboot doesn't catch the new kernel either, only manually selecting>

# grubby --debug --set-default=/boot/ovirt-node-ng-4.0.0-0.3.master.20160330132038.el7+1/vmlinuz-3.10.0-327.13.1.el7.x86_64
[root@localhost ~]# echo $?
0

# file /boot/ovirt-node-ng-4.0.0-0.3.master.20160330132038.el7+1/vmlinuz-3.10.0-327.13.1.el7.x86_64
/boot/ovirt-node-ng-4.0.0-0.3.master.20160330132038.el7+1/vmlinuz-3.10.0-327.13.1.el7.x86_64: Linux kernel x86 boot executable bzImage, version 3.10.0-327.13.1.el7.x86_64 (builder.centos.org) #1, RO-rootFS, swap_dev 0x4, Normal VGA


# ls -la /etc/grub2.cfg /boot/grub2/grub.cfg
-rw-r--r--. 1 root root 5411 Apr  1 20:52 /boot/grub2/grub.cfg
lrwxrwxrwx. 1 root root   22 Apr  1 13:43 /etc/grub2.cfg -> ../boot/grub2/grub.cfg

# rpm -qa | grep grub*
grubby-8.28-17.el7.x86_64
grub2-tools-2.02-0.34.el7.centos.x86_64
grub2-efi-2.02-0.34.el7.centos.x86_64
grub2-2.02-0.34.el7.centos.x86_64

# grubby --info=ALL
index=0
kernel=/boot/ovirt-node-ng-4.0.0-0+1/vmlinuz-3.10.0-327.10.1.el7.x86_64
args="ro crashkernel=auto rd.lvm.lv=centos_installed/ovirt-node-ng-4.0.0-0+1 rd.lvm.lv=centos_installed/swap rhgb quiet LANG=en_US.UTF-8 img.bootid=ovirt-node-ng-4.0.0-0+1"
root=/dev/centos_installed/ovirt-node-ng-4.0.0-0+1
initrd=/boot/ovirt-node-ng-4.0.0-0+1/initramfs-3.10.0-327.10.1.el7.x86_64.img
title=centos_installed/ovirt-node-ng-4.0.0-0+1 (oVirt Node 4.0.0_master)
index=1
kernel=/boot/ovirt-node-ng-4.0.0-0.3.master.20160330132038.el7+1/vmlinuz-3.10.0-327.13.1.el7.x86_64
args="ro crashkernel=auto rd.lvm.lv=centos_installed/ovirt-node-ng-4.0.0-0.3.master.20160330132038.el7+1 rd.lvm.lv=centos_installed/swap rhgb quiet LANG=en_US.UTF-8 img.bootid=ovirt-node-ng-4.0.0-0.3.master.20160330132038.el7+1"
root=/dev/centos_installed/ovirt-node-ng-4.0.0-0.3.master.20160330132038.el7+1
initrd=/boot/ovirt-node-ng-4.0.0-0.3.master.20160330132038.el7+1/initramfs-3.10.0-327.13.1.el7.x86_64.img
title=centos_installed/ovirt-node-ng-4.0.0-0.3.master.20160330132038.el7+1 (oVirt Node 4.0.0_master)
index=2
kernel=/boot/vmlinuz-3.10.0-327.13.1.el7.x86_64
args="ro crashkernel=auto rd.lvm.lv=centos_installed/root rd.lvm.lv=centos_installed/swap rhgb quiet LANG=en_US.UTF-8"
root=/dev/mapper/centos_installed-root
initrd=/boot/initramfs-3.10.0-327.13.1.el7.x86_64.img
title=CentOS Linux (3.10.0-327.13.1.el7.x86_64) 7 (Core)
index=3
non linux entry

Comment 2 Douglas Schilling Landgraf 2016-04-04 22:34:30 UTC
Created attachment 1143466 [details]
output strace

Comment 4 Fabian Deutsch 2016-04-12 19:14:56 UTC
From the RHEV side this is required to enable rollback.

Comment 5 Fabian Deutsch 2016-04-12 19:26:23 UTC
I can not reproduce this on fedora 22:

[root@tee ~]# ls -shal /boot/vmlinuz-4.3.4-200.fc22.x86_64
5,8M -rwxr-xr-x. 1 root root 5,8M 25. Jan 14:47 /boot/vmlinuz-4.3.4-200.fc22.x86_64

[root@tee ~]# grub2-editenv list
saved_entry=Fedora (4.4.6-200.fc22.x86_64) 22 (Twenty Two)

[root@tee ~]# grubby --set-default=/boot/vmlinuz-4.3.4-200.fc22.x86_64
[root@tee ~]# grub2-editenv list
saved_entry=Fedora (4.3.4-200.fc22.x86_64) 22 (Twenty Two)

Changed

[root@tee ~]# grubby --set-default=/boot/vmlinuz-4.4.6-200.fc22.x86_64
[root@tee ~]# grub2-editenv list
saved_entry=Fedora (4.4.6-200.fc22.x86_64) 22 (Twenty Two)

Changed again

Douglas, can you try the same flow on CentOS?

Comment 6 Douglas Schilling Landgraf 2016-04-13 06:27:57 UTC
In a pure Centos 7 I cannot reproduce, here more debugging:

Example output:
# ls -sha1 /boot/ovirt-node-ng-4.0.0-0.20160413.0+1/vmlinuz-3.10.0-327.13.1.el7.x86_64 
5.0M /boot/ovirt-node-ng-4.0.0-0.20160413.0+1/vmlinuz-3.10.0-327.13.1.el7.x86_64

# grubby --set-default /boot/ovirt-node-ng-4.0.0-0.20160413.0+1/vmlinuz-3.10.0-327.13.1.el7.x86_64 

# grub2-editenv list
saved_entry=centos_installed/ovirt-node-ng-4.0.0-0.20160413.0+1 (oVirt Node 4.0.0_master)

# grubby --default-kernel
# 


Using gdb:
#gdb /usr/sbin/grubby --default-kernel

gdb> b suitableImage

2263		rootdev = findDiskForRoot();
(gdb) p dev
$23 = 0x611540 "/dev/centos_installed/ovirt-node-ng-4.0.0-0.20160413.0+1"

2277		if (strcmp(getuuidbydev(rootdev), getuuidbydev(dev))) {
(gdb) p rootdev
$24 = 0x611590 "/dev/mapper/centos_installed-ovirt--node--ng--4.0.0--0+1"
(gdb) p dev
$25 = 0x611540 "/dev/centos_installed/ovirt-node-ng-4.0.0-0.20160413.0+1"
(gdb) n
2278			notSuitablePrintf(entry, 0,
                                  "uuid mismatch: rootdev %s, dev %s\n",
                                  getuuidbydev(rootdev), getuuidbydev(dev));
 

(gdb) p getuuidbydev(rootdev)
$1 = 0x6257f0 "3c1df351-9205-4743-82df-6c1954d6495a"
(gdb) p getuuidbydev(dev)
value has been optimized out

# ls /dev/mapper/centos_installed-ovirt--node--ng--4.0.0--0+1 -la
lrwxrwxrwx. 1 root root 7 Apr 13 05:22 /dev/mapper/centos_installed-ovirt--node--ng--4.0.0--0+1 -> ../dm-3
[root@localhost grubby-8.28-1]# ls /dev/centos_installed/ovirt-node-ng-4.0.0-0.20160413.0+1 -la
lrwxrwxrwx. 1 root root 7 Apr 13 05:22 /dev/centos_installed/ovirt-node-ng-4.0.0-0.20160413.0+1 -> ../dm-7

Here the fulll code:
        if (strcmp(getuuidbydev(rootdev), getuuidbydev(dev))) {
                notSuitablePrintf(entry, 0,
                                  "uuid mismatch: rootdev %s, dev %s\n",
                                  getuuidbydev(rootdev), getuuidbydev(dev));
                free(rootdev);
                return 0;
        }

Comment 7 Fabian Deutsch 2016-04-13 11:46:39 UTC
Hm.

I ran the same on my CentOS setup to try to reproduce this, but I can't.

Having to images available I can chang ethe default from one to the other and vice versa using grubby.

Comment 8 Fabian Deutsch 2016-05-06 09:05:50 UTC
Closing according to comment 7 for now

Comment 9 Ryan Barry 2016-06-30 17:35:34 UTC
This is still reproducible.

grubby does successfully set the new kernel, but grubby itself can't find it:

# grubby --default-kernel
#

This works ok with --bad-image-okay, which is an acceptable workaround for now (we're using grubby to abstract bootloader operations, so as long as it *works* we can live with it), but it would be nice to have it fixed.

# grubby --default-kernel --bad-image-okay
/boot/ovirt-node-ng-4.0.0-0.20160630.0+1/vmlinuz-3.10.0-327.22.2.el7.x86_64

We are using thin LVM snapshots as the basis for RHV-H Next, so the UUIDs can be odd:

# lsblk 
NAME                                               MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT
sr0                                                 11:0    1 1024M  0 rom  
vda                                                252:0    0   30G  0 disk 
├─vda1                                             252:1    0    1G  0 part /boot
└─vda2                                             252:2    0   29G  0 part 
  ├─onn-pool00_tmeta                               253:0    0   24M  0 lvm  
  │ └─onn-pool00-tpool                             253:2    0 22.5G  0 lvm  
  │   ├─onn-ovirt--node--ng--4.0.0--0.20160627.0+1 253:3    0  7.4G  0 lvm  /
  │   ├─onn-pool00                                 253:5    0 22.5G  0 lvm  
  │   ├─onn-var                                    253:6    0   15G  0 lvm  /var
  │   ├─onn-root                                   253:7    0  7.4G  0 lvm  
  │   ├─onn-ovirt--node--ng--4.0.0--0.20160630.0   253:8    0  4.4G  1 lvm  
  │   └─onn-ovirt--node--ng--4.0.0--0.20160630.0+1 253:9    0  4.4G  0 lvm  
  ├─onn-pool00_tdata                               253:1    0 22.5G  0 lvm  
  │ └─onn-pool00-tpool                             253:2    0 22.5G  0 lvm  
  │   ├─onn-ovirt--node--ng--4.0.0--0.20160627.0+1 253:3    0  7.4G  0 lvm  /
  │   ├─onn-pool00                                 253:5    0 22.5G  0 lvm  
  │   ├─onn-var                                    253:6    0   15G  0 lvm  /var
  │   ├─onn-root                                   253:7    0  7.4G  0 lvm  
  │   ├─onn-ovirt--node--ng--4.0.0--0.20160630.0   253:8    0  4.4G  1 lvm  
  │   └─onn-ovirt--node--ng--4.0.0--0.20160630.0+1 253:9    0  4.4G  0 lvm  
  └─onn-swap                                       253:4    0    2G  0 lvm  [SWAP]

grubby complains about a uuid mismatch when it targets a different root= than the one it's running on. I imagine that this is intentional, but not ideal when using snapshots.

When run from one snapshot with the kernel on another (for example):

# mount
/dev/mapper/onn-ovirt--node--ng--4.0.0--0.20160627.0+1 on / type xfs (rw,relatime,seclabel,attr2,inode64,logbsize=64k,sunit=128,swidth=128,noquota)


# grubby --default-kernel --debug
DBG: command line: --default-kernel --debug
DBG: Image entry failed: uuid mismatch: rootdev 00e23a92-6296-45ef-bef2-459fb51af69a, dev af545169-1c49-4021-a72b-bb93aec51d56

# ls -l /dev/disk/by-uuid/
total 0
lrwxrwxrwx. 1 root root 10 Jun 30 16:43 00e23a92-6296-45ef-bef2-459fb51af69a -> ../../dm-3
lrwxrwxrwx. 1 root root 10 Jun 30 16:55 af545169-1c49-4021-a72b-bb93aec51d56 -> ../../dm-9

# dmsetup info
Name:              onn-ovirt--node--ng--4.0.0--0.20160630.0+1
State:             ACTIVE
Read Ahead:        8192
Tables present:    LIVE
Open count:        0
Event number:      0
Major, minor:      253, 9
Number of targets: 1
UUID: LVM-lfTUhYUbzphTBkAwx46DfhDl39M0ydKRZlffMdOpgPDdOgKhqHJ9SmyaEXmLiZ3p

Name:              onn-ovirt--node--ng--4.0.0--0.20160627.0+1
State:             ACTIVE
Read Ahead:        8192
Tables present:    LIVE
Open count:        1
Event number:      0
Major, minor:      253, 3
Number of targets: 1
UUID: LVM-lfTUhYUbzphTBkAwx46DfhDl39M0ydKRWNcl56htotMteAdyJGJutffNFr9eRdBK

Comment 10 Marek Hruscak 2016-07-20 13:43:39 UTC
Hi Ryan,
I am unable to reproduce this bug using basic methods like cloning whole disk or cloning logical volume to obtain same UUIDs.
Will You please retest it once fix will be ready? I will send notification.

Comment 11 Ryan Barry 2016-07-20 13:44:56 UTC
Sure, I'm happy to test this when the fix is ready.

Comment 12 Fabian Deutsch 2016-08-09 19:09:23 UTC
This really is an issue, we need help to debug this.

In our setup we have the issue that a few things w/ grubby do not work:

[root@dhcp-8-127 ~]# grubby --default-kernel
[root@dhcp-8-127 ~]# grubby --default-index
1
[root@dhcp-8-127 ~]# grubby --bad-image-okay --default-index
1
[root@dhcp-8-127 ~]# grubby --bad-image-okay --default-kernel
/boot/rhvh-4.0-0.20160727.0+1/vmlinuz-3.10.0-327.22.2.el7.x86_64

But this info is wrong - the index=0 kernel got booted:

[root@dhcp-8-127 ~]# imgbase w
[INFO] You are on rhvh-4.0-0.20160803.0+1
[root@dhcp-8-127 ~]# findmnt /
TARGET SOURCE                                                 FSTYPE OPTIONS
/      /dev/mapper/r4b_dhcp--8--127-rhvh--4.0--0.20160803.0+1 xfs    rw,relatime,seclabel,attr2,inode64,sunit=512,swidth=512,noquota

This root maps to index=0 in the grub cfg:

[root@dhcp-8-127 ~]# grubby --info=ALL
index=0
kernel=/boot/rhvh-4.0-0.20160803.0+1/vmlinuz-3.10.0-327.28.2.el7.x86_64
args="ro crashkernel=auto rd.lvm.lv=r4b_dhcp-8-127/rhvh-4.0-0.20160803.0+1 rd.lvm.lv=r4b_dhcp-8-127/swap rhgb quiet LANG=en_US.UTF-8 img.bootid=rhvh-4.0-0.20160803.0+1"
root=/dev/r4b_dhcp-8-127/rhvh-4.0-0.20160803.0+1
initrd=/boot/rhvh-4.0-0.20160803.0+1/initramfs-3.10.0-327.28.2.el7.x86_64.img
title=rhvh-4.0-0.20160803.0
index=1
kernel=/boot/rhvh-4.0-0.20160727.0+1/vmlinuz-3.10.0-327.22.2.el7.x86_64
args="ro crashkernel=auto rd.lvm.lv=r4b_dhcp-8-127/rhvh-4.0-0.20160727.0+1 rd.lvm.lv=r4b_dhcp-8-127/swap rhgb quiet LANG=en_US.UTF-8 img.bootid=rhvh-4.0-0.20160727.0+1"
root=/dev/r4b_dhcp-8-127/rhvh-4.0-0.20160727.0+1
initrd=/boot/rhvh-4.0-0.20160727.0+1/initramfs-3.10.0-327.22.2.el7.x86_64.img
title=rhvh-4.0-0.20160727.0
index=2
kernel=/boot/vmlinuz-3.10.0-327.22.2.el7.x86_64
args="ro crashkernel=auto rd.lvm.lv=r4b_dhcp-8-127/root rd.lvm.lv=r4b_dhcp-8-127/swap rhgb quiet LANG=en_US.UTF-8"
root=/dev/mapper/r4b_dhcp--8--127-root
initrd=/boot/initramfs-3.10.0-327.22.2.el7.x86_64.img
title=Red Hat Enterprise Linux (3.10.0-327.22.2.el7.x86_64) 7.2
index=3
non linux entry
index=4
non linux entry
index=5
non linux entry
index=6
non linux entry


What is going on here?

Comment 13 Peter Jones 2016-08-15 14:54:31 UTC
> What is going on here?

I don't know - can you include your /boot/grub/grubenv from all relevant snapshots?

If I'm reading all of these comments right, it seems this is essentially an RFE for grubby to be able to identify that /boot/ is on an LVM snapshot, and consider the UUIDs of all relevant DM devices as valid candidates, work out which one we /actually/ have booted from, which might be different from what's mounted, and show output based on that.

Is that right?

If so, I think we need to add a feature to grub2 to add boot=$UUID or something along those lines on the kernel command line, because otherwise there's no way after booting to know where config files were actually loaded from if it's different than the currently configured system.

Comment 14 Fabian Deutsch 2016-08-15 19:03:37 UTC
(In reply to Peter Jones from comment #13)
> > What is going on here?
> 
> I don't know - can you include your /boot/grub/grubenv from all relevant
> snapshots?

Good that you mention this file - I think this could be related/caused by bug 1366785: /boot/grub2/grubenv is a symlink to /boot/efi/EFI/$vendor/grubenv
grub2 load_env fails

> If I'm reading all of these comments right, it seems this is essentially an
> RFE for grubby to be able to identify that /boot/ is on an LVM snapshot, and
> consider the UUIDs of all relevant DM devices as valid candidates, work out
> which one we /actually/ have booted from, which might be different from
> what's mounted, and show output based on that.
> 
> Is that right?

No - /boot is not snapshotted in our design.
But the grub entries point to different thin LV snapshots in a VG.

And it looks like grub has issues to change the defaults

>
> If so, I think we need to add a feature to grub2 to add boot=$UUID or
> something along those lines on the kernel command line, because otherwise
> there's no way after booting to know where config files were actually loaded
> from if it's different than the currently configured system.

As said before, it's not relevenat for us, because we have a single /boot, but might be useful in other designs.

Comment 16 Peter Jones 2017-06-19 14:24:13 UTC
Since the requested information has not been provided, we're closing this.  If you can come up with the relevant config file examples and re-open, we'll reconsider this bug.

Comment 17 Ryan Barry 2017-06-19 14:37:37 UTC
Peter, what configs do you need?

Comment 18 Marek Hruscak 2017-08-02 10:33:59 UTC
(In reply to Ryan Barry from comment #17)
> Peter, what configs do you need?

It looks like /boot/grub2/grubenv from all snapshots is needed, see comment 13 .

Ryan, can you provide them?
Thanks.

Comment 19 Ryan Barry 2017-08-22 12:52:52 UTC
(In reply to Marek Hruscak from comment #18)
> (In reply to Ryan Barry from comment #17)
> > Peter, what configs do you need?
> 
> It looks like /boot/grub2/grubenv from all snapshots is needed, see comment
> 13 .
> 
> Ryan, can you provide them?
> Thanks.

/boot is not snapshotted, everything uses an identical grubenv.

It's very simply:

# GRUB Environment Block
saved_entry=rhvh-4.1-0.20170817.0
#####################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################

Basically, create a new LVM volume a different ID. rsync your filesystem into it. Boot back and forth to examine the differences in grubby.

Alternatively, an earlier version of RHVH and 'yum upgrade' to the newest one.

# grubby --default-kernel --debug
DBG: command line: --default-kernel --debug
DBG: Image entry failed: uuid mismatch: rootdev bfe1a223-38a3-434e-b1a6-f4586f2be4d3, dev fd53ab53-ec12-44b8-8b82-f9d334b8110f
...

# blkid /dev/mapper/rhvh-rhvh--4.*
/dev/mapper/rhvh-rhvh--4.0--0.20170307.0+1: UUID="bfe1a223-38a3-434e-b1a6-f4586f2be4d3" TYPE="ext4" 
/dev/mapper/rhvh-rhvh--4.1--0.20170817.0+1: UUID="fd53ab53-ec12-44b8-8b82-f9d334b8110f" TYPE="ext4"

Comment 20 Sandro Bonazzola 2018-11-28 10:58:58 UTC
This missed 7.2.z, 7.3, acked for 7.4 and missed it, missing 7.5 and 7.6.
Can we have a target milestone for this? 7.6.z? 7.7?

Comment 21 Javier Martinez Canillas 2019-03-15 14:11:22 UTC
If I understood correctly, there are 2 different issues mentioned in the comments of this bugzilla, which makes it confusing to follow. The two bugs seems to be:

1) grubby --default-kernel not printing the default kernel even after was set if the root param in the cmdline is for a partition with a different UUID than the one currently mounted as root.

2) GRUB not getting a default kernel even after it was set correctly.

I think (2) is about the grubenv file getting borked for some reasons (Comment 14 mentioned that it may be the same than bug 1366785). I'll just ignore it since the grubenv file not being correct will lead to GRUB not being able to have a default entry, and is independent to (1).

For (1), I found a much easier way to reproduce it. On a default RHEL7 install, just change the root param to a partition that's already present in the machine (for example I changed root=/dev/mapper/rhel-root to root=/dev/mapper/rhel-swap in one menu entry).

# grubby --info=ALL
index=0
kernel=/boot/vmlinuz-3.10.0-957.el7.x86_64
args="ro crashkernel=auto rd.lvm.lv=rhel/root rd.lvm.lv=rhel/swap rhgb quiet"
root=/dev/mapper/rhel-root
initrd=/boot/initramfs-3.10.0-957.el7.x86_64.img
title=Red Hat Enterprise Linux Workstation (3.10.0-957.el7.x86_64) 7.6 (Maipo)
index=1
kernel=/boot/vmlinuz-3.10.0-932.el7.x86_64
args="ro crashkernel=auto rd.lvm.lv=rhel/root rd.lvm.lv=rhel/swap rhgb quiet"
root=/dev/mapper/rhel-swap
initrd=/boot/initramfs-3.10.0-932.el7.x86_64.img
title=Red Hat Enterprise Linux Workstation (3.10.0-932.el7.x86_64) 7.6 (Maipo)
index=2
kernel=/boot/vmlinuz-0-rescue-83fb8bc5f7924651aebd43f46ba4123f
args="ro crashkernel=auto rd.lvm.lv=rhel/root rd.lvm.lv=rhel/swap rhgb quiet"
root=/dev/mapper/rhel-root
initrd=/boot/initramfs-0-rescue-83fb8bc5f7924651aebd43f46ba4123f.img
title=Red Hat Enterprise Linux Workstation (0-rescue-83fb8bc5f7924651aebd43f46ba4123f) 7.6 (Maipo)
index=3
non linux entry

# grubby --set-default /boot/vmlinuz-3.10.0-957.el7.x86_64 

# grub2-editenv list 
saved_entry=Red Hat Enterprise Linux Workstation (3.10.0-957.el7.x86_64) 7.6 (Maipo)

# grubby --default-kernel
/boot/vmlinuz-3.10.0-957.el7.x86_64

This works as expected, but when using the second entry (whose root=/dev/mapper/rhel-swap):

# grubby --set-default /boot/vmlinuz-3.10.0-932.el7.x86_64 --debug

# grub2-editenv list
saved_entry=Red Hat Enterprise Linux Workstation (3.10.0-932.el7.x86_64) 7.6 (Maipo)

# grubby --default-kernel
#

Which I think is the issue reported in this bugzilla. As mentioned in Comment 9, using the --bad-image-okay option makes grubby to print the output and --debug tells us what's wrong:

# grubby --default-kernel --bad-image-okay
/boot/vmlinuz-3.10.0-932.el7.x86_64

# grubby --default-kernel --debug
DBG: command line: --default-kernel --debug
DBG: Image entry failed: uuid mismatch: rootdev b6e5711f-d2da-4ab8-bae2-d8b930ab0535, dev b0660e51-8210-4c29-8d93-56c741f3804a
DBG: menuentry 'Red Hat Enterprise Linux Workstation (3.10.0-932.el7.x86_64) 7.6 (Maipo)' --class red --class gnu-linux --class gnu --class os --unrestricted $menuentry_id_option 'gnulinux-3.10.0-932.el7.x86_64-advanced-b6e5711f-d2da-4ab8-bae2-d8b930ab0535' { 
DBG:    load_video
DBG:    set gfxpayload=keep
DBG:    insmod gzio
DBG:    insmod part_gpt
DBG:    insmod xfs
DBG:    set root='hd0,gpt2'
DBG:    if [ x$feature_platform_search_hint = xy ]; then
DBG:      search --no-floppy --fs-uuid --set=root --hint-bios=hd0,gpt2 --hint-efi=hd0,gpt2 --hint-baremetal=ahci0,gpt2  45d2bc24-891a-48bd-be95-4395bb5e1059
DBG:    else
DBG:      search --no-floppy --fs-uuid --set=root 45d2bc24-891a-48bd-be95-4395bb5e1059
DBG:    fi
DBG:    linuxefi /vmlinuz-3.10.0-932.el7.x86_64 root=/dev/mapper/rhel-swap ro crashkernel=auto rd.lvm.lv=rhel/root rd.lvm.lv=rhel/swap rhgb quiet
DBG:    initrdefi /initramfs-3.10.0-932.el7.x86_64.img
DBG: }

Now this indeed is confusing and not consistent, since grubby --set-default doesn't require a --bad-image-okay to set the default and also --debug doesn't says anything about the UUID mismatch.

But it's not clear to me what should be the correct fix, if making --set-default to be strict and also require a --bad-image-ok in this case (and print the UUID mismatch with --debug) or to make --default-kernel more lax and not require the --bad-image-ok in this case.

Comment 22 Javier Martinez Canillas 2019-03-18 13:32:16 UTC
(In reply to Javier Martinez Canillas from comment #21)

[snip]

> 
> But it's not clear to me what should be the correct fix, if making
> --set-default to be strict and also require a --bad-image-ok in this case
> (and print the UUID mismatch with --debug) or to make --default-kernel more
> lax and not require the --bad-image-ok in this case.

After some thinking I think we would want the latter, that is to allow --default-kernel to print the default even if there's a UUID mismatch (but still print that with info with --debug).

Comment 26 Jan Stodola 2019-06-26 13:03:15 UTC
Reproduced on RHEL-7.6 using steps from comment 21:

[root@localhost ~]# rpm -q grubby
grubby-8.28-25.el7.x86_64
[root@localhost ~]# grubby --info=ALL
index=0
kernel=/boot/vmlinuz-3.10.0-1058.el7.x86_64
args="ro crashkernel=auto rd.lvm.lv=rhel/root rd.lvm.lv=rhel/swap rhgb quiet LANG=en_US.UTF-8"
root=/dev/mapper/rhel-root
initrd=/boot/initramfs-3.10.0-1058.el7.x86_64.img
title=Red Hat Enterprise Linux Server (3.10.0-1058.el7.x86_64) 7.6 (Maipo)
index=1
kernel=/boot/vmlinuz-3.10.0-957.el7.x86_64
args="ro crashkernel=auto rd.lvm.lv=rhel/root rd.lvm.lv=rhel/swap rhgb quiet LANG=en_US.UTF-8"
root=/dev/mapper/rhel-swap
initrd=/boot/initramfs-3.10.0-957.el7.x86_64.img
title=Red Hat Enterprise Linux Server (3.10.0-957.el7.x86_64) 7.6 (Maipo)
index=2
kernel=/boot/vmlinuz-0-rescue-c57ad8dea5194fb5ad9044b37b88e0a8
args="ro crashkernel=auto rd.lvm.lv=rhel/root rd.lvm.lv=rhel/swap rhgb quiet"
root=/dev/mapper/rhel-root
initrd=/boot/initramfs-0-rescue-c57ad8dea5194fb5ad9044b37b88e0a8.img
title=Red Hat Enterprise Linux Server (0-rescue-c57ad8dea5194fb5ad9044b37b88e0a8) 7.6 (Maipo)
index=3
non linux entry
[root@localhost ~]# grubby --set-default /boot/vmlinuz-3.10.0-957.el7.x86_64 
[root@localhost ~]# grub2-editenv list
saved_entry=Red Hat Enterprise Linux Server (3.10.0-957.el7.x86_64) 7.6 (Maipo)
[root@localhost ~]# grubby --default-kernel
[root@localhost ~]# 

Verification using grubby-8.28-26.el7 on the same system, the default kernel is printed:

[root@localhost ~]# yum update grubby
...
[root@localhost ~]# rpm -q grubby
grubby-8.28-26.el7.x86_64
[root@localhost ~]# grubby --default-kernel
/boot/vmlinuz-3.10.0-957.el7.x86_64
[root@localhost ~]#

Moving to VERIFIED.

Comment 28 errata-xmlrpc 2019-08-06 13:07:10 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://access.redhat.com/errata/RHBA-2019:2227

Comment 29 Red Hat Bugzilla 2023-09-14 03:20:36 UTC
The needinfo request[s] on this closed bug have been removed as they have been unresolved for 1000 days


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