Bug 1340893
Summary: | grubby --default-title doesn't print anything | ||
---|---|---|---|
Product: | Red Hat Enterprise Linux 7 | Reporter: | Jan Stodola <jstodola> |
Component: | grubby | Assignee: | Peter Jones <pjones> |
Status: | CLOSED ERRATA | QA Contact: | Release Test Team <release-test-team-automation> |
Severity: | medium | Docs Contact: | |
Priority: | medium | ||
Version: | 7.2 | CC: | atodorov, bs168, cww, hartsjc, pjones, sfroemer, vanhoof |
Target Milestone: | rc | ||
Target Release: | --- | ||
Hardware: | All | ||
OS: | Linux | ||
Whiteboard: | |||
Fixed In Version: | grubby-8.28-24.el7 | Doc Type: | If docs needed, set a value |
Doc Text: | Story Points: | --- | |
Clone Of: | Environment: | ||
Last Closed: | 2018-10-30 11:41:49 UTC | Type: | Bug |
Regression: | --- | Mount Type: | --- |
Documentation: | --- | CRM: | |
Verified Versions: | Category: | --- | |
oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | |
Cloudforms Team: | --- | Target Upstream Version: | |
Embargoed: | |||
Bug Depends On: | |||
Bug Blocks: | 1256306, 1298243, 1420851, 1477664, 1546815, 1571842 | ||
Attachments: |
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) 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. 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 (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. 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. 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)
~~~
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?
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. ~~~ 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 |
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