Skip to content

Determination of current kernel fails on RHEL 8 #265

@jhowe-uw

Description

@jhowe-uw

Attempting to use infra.leapp v 1.6.1 components to upgrade from RHEL 8.10 to RHEL 9.6

From infra/leapp/roles/remediate/tasks

  • leapp_multiple_kernels.yml
  • leapp_newest_kernel_not_in_use.yml

Query for latest kernel ( assumes array[0] entry )

$ rpm -q kernel --queryformat '%{version}-%{release}.%{arch}\n' | sort -Vr
4.18.0-553.el8_10.x86_64
4.18.0-553.64.1.el8_10.x86_64
4.18.0-553.58.1.el8_10.x86_64

$ grubby --default-kernel | sed 's/^\/boot\/vmlinuz\-//'
4.18.0-553.el8_10.x86_64 

Alternate method:

$ rpm -q --last kernel
kernel-4.18.0-553.64.1.el8_10.x86_64          Fri 01 Aug 2025 11:41:12 AM PDT
kernel-4.18.0-553.58.1.el8_10.x86_64          Mon 28 Jul 2025 02:36:23 PM PDT
kernel-4.18.0-553.el8_10.x86_64               Tue 13 May 2025 03:55:31 PM PDT

So perhaps an alternate incantation to get a list of older kernels to purge in prep for leapp upgrade proper: ( infra.leapp.remediation::leapp_multiple_kernels )

$ rpm -q --last kernel | sed '1d'
kernel-4.18.0-553.58.1.el8_10.x86_64          Mon 28 Jul 2025 02:36:23 PM PDT
kernel-4.18.0-553.el8_10.x86_64               Tue 13 May 2025 03:55:31 PM PDT

$ rpm -q --last kernel | sed '1d' | awk '{print $1}'
kernel-4.18.0-553.58.1.el8_10.x86_64
kernel-4.18.0-553.el8_10.x86_64

Where this manifested for me was during the infra.leapp.analysis phase, as I bring the VM to the most current 8.10 rpms prior to analysis call.

I see an incorrect grubby default kernel assignment, so maybe RHEL has a bug somewhere here where dnf update -y isn't assigning the most recent kernel properly ( as noted in grubby output above ).

So a couple of edge case issues here:

  1. sorting most recent kernel logic needs updating
  2. issue in RHEL 8.10 where the most recent kernel isn't being assigned the default kernel

rpm --last seems more predictable than using the sort -Vr ( maybe that was consistent in the past, or --last is a new feature in more current versions of rpm )

I did a quick search on access.redhat.com to see if this grubby stale kernel issue is known, I didn't find any. It's late, I will follow-up tomorrow.

Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions