kdump-lib: use EFI var to find UKI

Resolves: RHEL-116406
Upstream: kdump-utils
Confilicts: None

commit edb8363d7efedfdc964576e4e30bc67c8fbeb941
Author: Li Tian <litian@redhat.com>
Date:   Wed Sep 24 17:29:56 2025 +0800

    kdump-lib: use EFI var to find UKI

    The UKI in ESP is not guaranteed to be named after machine ID.
    Machine ID is unknown at the time image is built. Thus
    builders like Image Builder names UKI 'fff...f-$(uname -r).efi'.
    The StubImageIdentifier points the true loaded UKI.

    Signed-off-by: Li Tian <litian@redhat.com>

Signed-off-by: Philipp Rudo <prudo@redhat.com>
This commit is contained in:
Philipp Rudo 2026-01-29 15:33:30 +01:00
parent d084f628fa
commit 70f3c44226
2 changed files with 47 additions and 0 deletions

View File

@ -0,0 +1,46 @@
From edb8363d7efedfdc964576e4e30bc67c8fbeb941 Mon Sep 17 00:00:00 2001
From: Li Tian <litian@redhat.com>
Date: Wed, 24 Sep 2025 17:29:56 +0800
Subject: [PATCH] kdump-lib: use EFI var to find UKI
The UKI in ESP is not guaranteed to be named after machine ID.
Machine ID is unknown at the time image is built. Thus
builders like Image Builder names UKI 'fff...f-$(uname -r).efi'.
The StubImageIdentifier points the true loaded UKI.
Signed-off-by: Li Tian <litian@redhat.com>
---
kdump-lib.sh | 12 ++++++++++--
1 file changed, 10 insertions(+), 2 deletions(-)
diff --git a/kdump-lib.sh b/kdump-lib.sh
index 639256c..232d065 100755
--- a/kdump-lib.sh
+++ b/kdump-lib.sh
@@ -502,13 +502,21 @@ prepare_kexec_args()
prepare_kdump_kernel()
{
local kdump_kernelver=$1
- local dir img boot_dirlist boot_imglist kdump_kernel machine_id
+ local dir img boot_dirlist boot_imglist kdump_kernel machine_id uki_img
+ local img_identifier_path="/sys/firmware/efi/efivars/StubImageIdentifier-4a67b082-0a4c-41cf-b6c7-440b29bb8c4f"
read -r machine_id < /etc/machine-id
+ # UKI is not guaranteed named after machine ID. Use EFI var as reference.
+ if [[ -f $img_identifier_path ]]; then
+ uki_img=$(tr -cd '[:print:]/' < "$img_identifier_path" | sed 's/\\/\//g')
+ else
+ uki_img="EFI/Linux/$machine_id-$kdump_kernelver.efi"
+ fi
+
boot_dirlist=${KDUMP_BOOTDIR:-"/boot /boot/efi /efi /"}
boot_imglist="$KDUMP_IMG-$kdump_kernelver$KDUMP_IMG_EXT \
$machine_id/$kdump_kernelver/$KDUMP_IMG \
- EFI/Linux/$machine_id-$kdump_kernelver.efi"
+ $uki_img"
# The kernel of OSTree based systems is not in the standard locations.
if is_ostree; then
--
2.52.0

View File

@ -28,6 +28,7 @@ Patch17: 0017-kdumpctl-clean-up-backup-restore-_default_initrd.patch
Patch18: 0018-kdumpctl-add-comments-to-different-initrd-variables.patch
Patch19: 0019-spec-drop-dependency-for-binutils.patch
Patch20: 0020-kdump-lib-always-disable-systemd-gpt-auto-generator.patch
Patch21: 0021-kdump-lib-use-EFI-var-to-find-UKI.patch
%ifarch ppc64 ppc64le