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 1731924 - "grubby --default-kernel" returns "rpm-sort: Invalid input /boot and exit with code 0
Summary: "grubby --default-kernel" returns "rpm-sort: Invalid input /boot and exit wit...
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 8
Classification: Red Hat
Component: grubby
Version: 8.0
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: rc
: 8.0
Assignee: Bootloader engineering team
QA Contact: Release Test Team
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2019-07-22 12:14 UTC by Michal Reznik
Modified: 2023-04-29 10:22 UTC (History)
5 users (show)

Fixed In Version: grubby-8.40-38.el8
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2020-04-28 16:59:27 UTC
Type: Bug
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)
/boot content (5.27 MB, application/gzip)
2019-07-22 12:14 UTC, Michal Reznik
no flags Details


Links
System ID Private Priority Status Summary Last Updated
Red Hat Issue Tracker RHELPLAN-30363 0 None None None 2023-04-29 10:22:12 UTC
Red Hat Product Errata RHBA-2020:1882 0 None None None 2020-04-28 16:59:32 UTC

Description Michal Reznik 2019-07-22 12:14:47 UTC
Created attachment 1592579 [details]
/boot content

Description of problem:

At the end of upgrade process from RHEL7 to RHEL8, we try to get currently set default kernel running:

# grubby --default-kernel

but if fails as follows:

rpm-sort: Invalid input 
/boot

# echo $?
0


Version-Release number of selected component (if applicable):

grubby-8.40-34.el8.x86_64

How reproducible:


Steps to Reproduce:
1. system with EFI
2. leapp upgrade (specific patch is currently needed; can be provided)
3. grubby --default-kernel

Actual results:

Command # grubby --default-kernel fails

Expected results:

Command #grubby --default-kernel returns default kernel

Additional info:

On vanilla RHEL8 the command works just fine. Attaching /boot content (without kernels and initramfs'es). 

In case any additional info is needed, please let us know.

Comment 1 Javier Martinez Canillas 2019-07-22 12:48:01 UTC
Hello Michal,

The problem is that /boot/loader/entries is empty and that's what grubby uses to determine what are the boot entries.

I agree that the error message should be improved to mention that there are no BLS snippets in /boot/loader/entries instead of this cryptic message, but I believe that's what causing your issue.

Comment 2 Pavel Odvody 2019-07-22 13:04:02 UTC
(In reply to Javier Martinez Canillas from comment #1)
> Hello Michal,
> 
> The problem is that /boot/loader/entries is empty and that's what grubby
> uses to determine what are the boot entries.
> 
> I agree that the error message should be improved to mention that there are
> no BLS snippets in /boot/loader/entries instead of this cryptic message, but
> I believe that's what causing your issue.

Thanks for looking into this, Javier, while I agree that the error message could provide more context I've been also wondering what is the correct course of action here - i.e. who/what/how is supposed to populate the BLS snippets so that we can actually upgrade EFI systems?

Comment 3 Javier Martinez Canillas 2019-07-22 13:35:04 UTC
(In reply to Pavel Odvody from comment #2)
> (In reply to Javier Martinez Canillas from comment #1)
> > Hello Michal,
> > 
> > The problem is that /boot/loader/entries is empty and that's what grubby
> > uses to determine what are the boot entries.
> > 
> > I agree that the error message should be improved to mention that there are
> > no BLS snippets in /boot/loader/entries instead of this cryptic message, but
> > I believe that's what causing your issue.
> 
> Thanks for looking into this, Javier, while I agree that the error message
> could provide more context I've been also wondering what is the correct
> course of action here - i.e. who/what/how is supposed to populate the BLS
> snippets so that we can actually upgrade EFI systems?

I'm not that familiar with Leapp but on a vanilla RHEL8 the BLS snippets are populated by the kernel-install script when a kernel package is installed.

There's also a grub2-switch-to-blscfg script that can be used to switch a grub configuration from non-BLS to BLS. This script also will populate the BLS snippets among other things.

Comment 4 Ina 2019-10-30 12:01:22 UTC
Seeing that bug again with uefi http://pastebin.test.redhat.com/809957

```
[  188.031165] upgrade[390]: 2019-10-30 07:43:18.202 DEBUG    PID: 624 leapp.workflow.Finalization.kernelcmdlineconfig: External command has started: ['grubby', '--update-kernel=/boot/vmlinuz-4.18.0-147.el8.x86_64', '--args=net.ifnames=0']
[  188.054036] upgrade[390]: rpm-sort: Invalid input
[  188.068491] upgrade[390]: The param /boot/vmlinuz-4.18.0-147.el8.x86_64 is incorrect
```

Comment 5 Javier Martinez Canillas 2019-10-31 09:05:46 UTC
(In reply to Ina from comment #4)
> Seeing that bug again with uefi http://pastebin.test.redhat.com/809957
> 
> ```
> [  188.031165] upgrade[390]: 2019-10-30 07:43:18.202 DEBUG    PID: 624
> leapp.workflow.Finalization.kernelcmdlineconfig: External command has
> started: ['grubby', '--update-kernel=/boot/vmlinuz-4.18.0-147.el8.x86_64',
> '--args=net.ifnames=0']
> [  188.054036] upgrade[390]: rpm-sort: Invalid input
> [  188.068491] upgrade[390]: The param /boot/vmlinuz-4.18.0-147.el8.x86_64
> is incorrect
> ```

This seems to be caused by /boot/loader/entries not having any BLS config file.

Can you please share the content of your /boot/loader/entries directory as well as the following files /boot/grub2/grubenv and /etc/grub2-efi.cfg ?

Comment 6 Ina 2019-10-31 09:10:54 UTC
(In reply to Javier Martinez Canillas from comment #5)
> (In reply to Ina from comment #4)
> > Seeing that bug again with uefi http://pastebin.test.redhat.com/809957
> > 
> > ```
> > [  188.031165] upgrade[390]: 2019-10-30 07:43:18.202 DEBUG    PID: 624
> > leapp.workflow.Finalization.kernelcmdlineconfig: External command has
> > started: ['grubby', '--update-kernel=/boot/vmlinuz-4.18.0-147.el8.x86_64',
> > '--args=net.ifnames=0']
> > [  188.054036] upgrade[390]: rpm-sort: Invalid input
> > [  188.068491] upgrade[390]: The param /boot/vmlinuz-4.18.0-147.el8.x86_64
> > is incorrect
> > ```
> 
> This seems to be caused by /boot/loader/entries not having any BLS config
> file.
> 
> Can you please share the content of your /boot/loader/entries directory as
> well as the following files /boot/grub2/grubenv and /etc/grub2-efi.cfg ?


Sorry for not giving all the details in the previous comment - you are absolutely right, empty /boot/loader/entries was the cause of the failure. Yesterday I workarounded that as you advised earlier, by calling grub2-switch-to-blscfg before executing the grubby command.

Comment 7 Javier Martinez Canillas 2019-11-27 16:29:53 UTC
(In reply to Ina from comment #6)
> (In reply to Javier Martinez Canillas from comment #5)
> > (In reply to Ina from comment #4)
> > > Seeing that bug again with uefi http://pastebin.test.redhat.com/809957
> > > 
> > > ```
> > > [  188.031165] upgrade[390]: 2019-10-30 07:43:18.202 DEBUG    PID: 624
> > > leapp.workflow.Finalization.kernelcmdlineconfig: External command has
> > > started: ['grubby', '--update-kernel=/boot/vmlinuz-4.18.0-147.el8.x86_64',
> > > '--args=net.ifnames=0']
> > > [  188.054036] upgrade[390]: rpm-sort: Invalid input
> > > [  188.068491] upgrade[390]: The param /boot/vmlinuz-4.18.0-147.el8.x86_64
> > > is incorrect
> > > ```
> > 
> > This seems to be caused by /boot/loader/entries not having any BLS config
> > file.
> > 
> > Can you please share the content of your /boot/loader/entries directory as
> > well as the following files /boot/grub2/grubenv and /etc/grub2-efi.cfg ?
> 
> 
> Sorry for not giving all the details in the previous comment - you are
> absolutely right, empty /boot/loader/entries was the cause of the failure.
> Yesterday I workarounded that as you advised earlier, by calling
> grub2-switch-to-blscfg before executing the grubby command.

Thanks for confirming. But still grubby shouldn't print a cryptic error message in this case, that would only confuse users.

Comment 8 Petr Janda 2019-11-29 14:41:56 UTC
Reproduced on RHEL-8.2-20191120.0 x86_64

By following steps:
1) install RHEL-8.2 (EFI is not needed)
2) cp -a /boot/loader/entries /boot/loader/entries.backup
3) grubby --default-kernel

it prints
rpm-sort: Invalid input
/boot

message and exits with code 0

providing qa_ack

As a note: I think in such case grubby should exit with different exit code.

Comment 9 Javier Martinez Canillas 2019-11-29 14:56:00 UTC
(In reply to Petr Janda from comment #8)
> Reproduced on RHEL-8.2-20191120.0 x86_64
> 
> By following steps:
> 1) install RHEL-8.2 (EFI is not needed)
> 2) cp -a /boot/loader/entries /boot/loader/entries.backup
> 3) grubby --default-kernel
> 
> it prints
> rpm-sort: Invalid input
> /boot
> 
> message and exits with code 0
> 
> providing qa_ack
>

Thanks a lot.
 
> As a note: I think in such case grubby should exit with different exit code.

I'm not sure if grubby should consider not finding any entries an error. So at least for this bug I would just like to avoid printing the cryptic / confusing message.

Comment 11 Zdenek Veleba 2020-03-09 15:17:04 UTC
Verified
grubby-8.40-38.el8.x86_64
RHEL-8.2.0-20200227.0

Comment 13 errata-xmlrpc 2020-04-28 16:59:27 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-2020:1882


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