Skip to content

[Bug] - dnf-plugins-core (4.3.0) missing upstream fix for kernel-name-based reboot detection — needs-restarting -r never detects AL2023 kernel updates #1125

Description

@ermeaney

Describe the bug

dnf needs-restarting -r never reports a reboot as required after a kernel-only
update on AL2023, even when a newer kernel6.12 build is installed and confirmed
as the next-boot kernel via grubby. Root cause: AL2023's packaged
dnf-plugins-core (currently 4.3.0-13.amzn2023.0.6, latest available in the
amazonlinux repo as of this writing) predates an upstream fix for exactly this
scenario, released in dnf-plugins-core 4.8.0.

Root cause

needs_restarting.py's reboot-hint logic matches installed packages against a
hardcoded list:

NEED_REBOOT = ['kernel', 'kernel-rt', 'glibc', 'linux-firmware',
               'systemd', 'dbus', 'dbus-broker', 'dbus-daemon',
               'microcode_ctl']

In AL2023's shipped version (4.3.0), the match is by literal package name:

for pkg in installed.filter(name=NEED_REBOOT):

AL2023 names its kernel package kernel6.12 (major version embedded, to allow
side-by-side kernel installs) — that string is never literally 'kernel', so a
kernel update is invisible to this check, regardless of provides.

Upstream already fixed this in commit
c989427d53
("needs-restarting: detect packages providing NEED_REBOOT", released in
4.8.0), changing the match to provides-based:

for pkg in installed.filter(provides=NEED_REBOOT):

The commit message: "This allows the 'needs-restarting' plugin to detect if any
alternative kernels have been installed/updated since the system last booted."

— our exact scenario. We confirmed live that kernel6.12 does correctly
Provide: kernel = <version>, so the provides-based match would work correctly
on AL2023 today if the newer plugin were packaged.

To Reproduce (live-tested on an AL2023 EKS worker node)

  1. Node has two kernel6.12 NEVRAs installed side by side (normal AL2023
    pattern): the running one, and a newer one installed well after last boot.
    rpm -q kernel6.12 --qf '%{VERSION}-%{RELEASE} installed:%{INSTALLTIME:date}\n'
    6.12.68-92.122.amzn2023 installed:Fri Feb 13 16:07:15 2026
    6.12.95-124.187.amzn2023 installed:Tue Aug 11 12:12:00 2026
    
  2. uname -r6.12.68-92.122.amzn2023.x86_64 (still running the old one)
  3. Boot time (uptime -s) → 2026-03-24 18:00:13 — clearly before the newer
    kernel's install time.
  4. grubby --default-kernel/boot/vmlinuz-6.12.95-124.187.amzn2023.x86_64
    — correctly identifies the newer kernel as next-boot.
  5. rpm -q --whatprovides kernel → returns both installed kernel6.12
    packages, confirming both declare Provides: kernel.
  6. dnf needs-restarting -r:
    No core libraries or services have been updated since boot-up.
    Reboot should not be necessary.
    
    — incorrect. Confirmed via direct hawkey query
    (base.sack.query().installed().filter(provides=NEED_REBOOT)) that the
    provides-based match does correctly return the newer kernel package with
    the right installtime — the only thing preventing detection is that the
    installed plugin still filters by name=, not provides=.

Expected behavior

dnf needs-restarting -r should exit 1 (reboot required) once a newer
kernel6.12 build is installed after the current boot, matching upstream
dnf-plugins-core 4.8.0+ behavior.

Additional context

  • dnf --version: 4.14.0
  • rpm -q dnf-plugins-core: dnf-plugins-core-4.3.0-13.amzn2023.0.6
  • Confirmed via dnf --refresh repoquery --available dnf-plugins-core against
    the live amazonlinux repo that 4.3.0-13.amzn2023.0.6 is the newest version
    currently packaged — this isn't a node/instance staleness issue, AL2023 hasn't
    shipped the fix at all yet.
  • Impact: any automation relying on needs-restarting -r's exit code to decide
    whether to reboot a node for kernel updates (e.g. kured, configured with
    rebootSentinelCommand: needs-restarting -r) silently never reboots for
    kernel-only updates on AL2023 — worse than a false positive, since nodes
    accumulate unapplied kernel security patches indefinitely while reporting
    "reboot should not be necessary."
  • Requesting: update/backport dnf-plugins-core past 4.8.0 (or backport just
    commit c989427d53) into AL2023's repos.

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