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 1340893 - grubby --default-title doesn't print anything
Summary: grubby --default-title doesn't print anything
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: grubby
Version: 7.2
Hardware: All
OS: Linux
medium
medium
Target Milestone: rc
: ---
Assignee: Peter Jones
QA Contact: Release Test Team
URL:
Whiteboard:
Depends On:
Blocks: 1256306 1298243 1420851 1477664 1546815 1571842
TreeView+ depends on / blocked
 
Reported: 2016-05-30 15:12 UTC by Jan Stodola
Modified: 2021-12-10 14:39 UTC (History)
7 users (show)

Fixed In Version: grubby-8.28-24.el7
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2018-10-30 11:41:49 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)
/boot/grub2/grub.cfg (4.04 KB, text/plain)
2016-05-30 15:12 UTC, Jan Stodola
no flags Details
Patch removes displayDefaultTitle use of configureGrub2 var (1.13 KB, patch)
2018-01-28 03:33 UTC, James Hartsock
no flags Details | Diff
Patch to make sure the bootloader selection or default is taken into account everywhere. (1.47 KB, patch)
2018-01-31 18:10 UTC, Peter Jones
no flags Details | Diff


Links
System ID Private Priority Status Summary Last Updated
Red Hat Knowledge Base (Solution) 1237743 0 None None None 2018-01-24 00:26:35 UTC
Red Hat Knowledge Base (Solution) 2960321 0 None None None 2017-03-08 21:37:56 UTC
Red Hat Product Errata RHBA-2018:3286 0 None None None 2018-10-30 11:42:10 UTC

Description Jan Stodola 2016-05-30 15:12:16 UTC
Created attachment 1162858 [details]
/boot/grub2/grub.cfg

Description of problem:
"grubby --default-title" doesn't print the title of the default boot entry:

[root@localhost ~]# rpm -q grubby
grubby-8.28-17.el7.x86_64
[root@localhost ~]# grubby --default-index
0
[root@localhost ~]# grubby --default-kernel
/boot/vmlinuz-3.10.0-327.el7.x86_64
[root@localhost ~]# grubby --default-title
[root@localhost ~]# echo $?
0
[root@localhost ~]#

grub.cfg is attached.

Version-Release number of selected component (if applicable):
grubby-8.28-17.el7

How reproducible:
always

Steps to Reproduce:
1. install RHEL-7.2 GA
2. run "grubby --default-title"

Actual results:
Nothing is printed

Expected results:
The title of the default boot entry is printed

Comment 1 James Hartsock 2016-12-16 22:47:16 UTC
Looks to be consistent issue on RHEL 7 and even Fedora 24

grubby-8.28-8.el7.x86_64
  default-kernel: /boot/vmlinuz-3.10.0-123.el7.x86_64
  default-title: 

grubby-8.28-11.el7.x86_64
  default-kernel: /boot/vmlinuz-3.10.0-229.el7.x86_64
  default-title: 

grubby-8.28-17.el7.x86_64
  default-kernel: /boot/vmlinuz-3.10.0-327.el7.x86_64
  default-title: 

grubby-8.28-18.el7.x86_64
  default-kernel: /boot/vmlinuz-3.10.0-514.el7.x86_64
  default-title: 

grubby-8.40-3.fc24.x86_64
  default-kernel: /boot/vmlinuz-4.8.13-200.fc24.x86_64
  default-title: 



Am able (on RHEL 7 too) use grub2-editenv

# grub2-editenv list
saved_entry=Fedora (4.8.13-200.fc24.x86_64) 24 (Server Edition)

Comment 6 James Hartsock 2018-01-23 04:46:14 UTC
Peter, any thoughts on LT_TITLE vs. LT_MENUENTRY type for displayDefaultTitle?

Clearly the test I ran isn't valid for all environments, but think it does show this is why grubby --default-title is failing to display anything on RHEL & Fedora currently.

Comment 7 James Hartsock 2018-01-24 00:26:35 UTC
After getting another chance to look at the code I saw that while we were in the following part of the loop, on RHEL 7 should be in the else part of the loop and everything would work just fine.

grubby.c:
5354                 if (!configureGrub2)

So then saw that configureGrub2 is set via the command line flag of --grub2, and if add that everything works as desired on RHEL 7 & Fedora

# grubby --help | grep -e --grub2
      --grub2                             configure grub2 bootloader
# grubby --default-title
# grubby --grub2 --default-title
Red Hat Enterprise Linux Server, with Linux 3.10.0-123.el7.x86_64

---

So defect this BZ was opened for can now be closed; however, maybe grubby should be modified to do at least 1 of the following?

1. Changed so can be compiled with --grub2 as default for RHEL 7, Fedora, etc
2. Have a config file that RHEL 7 ships that sets grub2 as default
3. grubby able to determine itself if running on grub2 or not

Comment 8 Steffen Froemer 2018-01-26 15:44:33 UTC
(In reply to James Hartsock from comment #7)
> ---
> 
> So defect this BZ was opened for can now be closed; however, maybe grubby
> should be modified to do at least 1 of the following?
> 
> 1. Changed so can be compiled with --grub2 as default for RHEL 7, Fedora, etc
> 2. Have a config file that RHEL 7 ships that sets grub2 as default
> 3. grubby able to determine itself if running on grub2 or not

I would appreciate if one of the above solutions will be applied or shipped with RHEL7 by default.
Otherwise I have to create another BZ, as the customer will request it directly.

Comment 9 James Hartsock 2018-01-28 00:01:07 UTC
My customer also came back that --grub2 flag is ridiculous since grub2 is clearly the default on this platform.

Looking at the man page, it looks like grubby should default to grub2 anyway, so the need for --grub2 would seem to be a defect here!



   Default Behavior
       The default bootloader target is primarily determined by the  architec‐
       ture  for  which  grubby  has been built.  Each architecture has a pre‐
       ferred bootloader, and each bootloader has its own configuration  file.
       If no bootloader is selected on the command line, grubby will use these
       default settings to search for an existing configuration.  If no  boot‐
       loader  configuration  file is found, grubby will use the default value
       for that architecture.  These defaults are listed in the table below.

       ┌────────────────┬────────────┬─────────────────────────────────┐
       │ Arch           │ Bootloader │ Configuration File              │
       ├────────────────┼────────────┼─────────────────────────────────┤
       │ x86_64 [BIOS]  │ grub2      │ /boot/grub2/grub.cfg            │
       ├────────────────┼────────────┼─────────────────────────────────┤
       │ x86_64 [UEFI]  │ grub2      │ /boot/efi/EFI/redhat/grub.cfg   │
       ├────────────────┼────────────┼─────────────────────────────────┤
       │ i386           │ grub2      │ /boot/grub2/grub.cfg            │
       ├────────────────┼────────────┼─────────────────────────────────┤
       │ ia64           │ elilo      │ /boot/efi/EFI/redhat/elilo.conf │
       ├────────────────┼────────────┼─────────────────────────────────┤

<snip>
       --grub2
              Use a grub2 style configuration file. This  is  the  default  on
              x86_64  architecture  as well as the ppc64 and ppc64le architec‐
              tures running on Power8 or later hardware.

Comment 10 James Hartsock 2018-01-28 03:33:15 UTC
Created attachment 1387079 [details]
Patch removes displayDefaultTitle use of configureGrub2 var

Wrote a test in the displayDefaultTitle section:

1. Removed the need of configureGrub2
2. look grub by default (as does on RHEL 7 anyway)
3. If grub blank line, then read grub2.


This very well be wrong approach, but just a thought I had while looking at the code this evening again.  It does pass 'make test' and the binary works for me on RHEL 7 x86_64

~~~
# ./grubby --grub --default-title
Could not find bootloader configuration file.

# ./grubby --grub2 --default-title
Red Hat Enterprise Linux Server (3.10.0-693.11.6.el7.x86_64) 7.4 (Maipo)

# ./grubby --default-title
Red Hat Enterprise Linux Server (3.10.0-693.11.6.el7.x86_64) 7.4 (Maipo)
~~~

Comment 11 Peter Jones 2018-01-31 18:10:13 UTC
Created attachment 1389131 [details]
Patch to make sure the bootloader selection or default is taken into account everywhere.

Well, we need --grub2 to actually work, because it makes "make test" have fewer special cases and more readable.  That said, I'd rather fix the fact that configureGrub2 isn't set when we've already decided on grub2 in the code just above there.  Something like the attached patch (which fixes another minor bug with the same code on other platforms as well) should work for you?

Comment 12 James Hartsock 2018-01-31 20:17:34 UTC
Peter,

Much more elegant fix, lines up with some other sections of code too!

As you expected, the patch does solve the issue for me on RHEL 7 & Fedora boxes I have

RHEL7
~~~
# grubby --default-title
Red Hat Enterprise Linux Server (3.10.0-693.17.1.el7.x86_64) 7.4 (Maipo)

# grubby --grub2 --default-title
Red Hat Enterprise Linux Server (3.10.0-693.17.1.el7.x86_64) 7.4 (Maipo)

# grubby --grub --default-title
Could not find bootloader configuration file.
~~~

Fedora
~~~
# ./grubby --default-title
Fedora (4.14.15-300.fc27.x86_64) 27 (Server Edition)

# ./grubby --grub2 --default-title
Fedora (4.14.15-300.fc27.x86_64) 27 (Server Edition)

# ./grubby --grub --default-title
Could not find bootloader configuration file.
~~~

Comment 17 errata-xmlrpc 2018-10-30 11:41:49 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-2018:3286


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