Skip to content

kdumpctl: Use only first match in _find_kernel_path_by_release()#153

Open
ddstreet wants to merge 1 commit into
rhkdump:mainfrom
ddstreet:use-first-grubby-info-match
Open

kdumpctl: Use only first match in _find_kernel_path_by_release()#153
ddstreet wants to merge 1 commit into
rhkdump:mainfrom
ddstreet:use-first-grubby-info-match

Conversation

@ddstreet
Copy link
Copy Markdown

@ddstreet ddstreet commented Apr 21, 2026

Running 'grubby --info ALL' (or even for a specific kernel version) can return multiple entries for the same kernel version/release (usually with different append parameters, initrds, etc), so when grepping for a specific kernel version/release, we need to use only the first match.

This results in kdumpctl failing with the error message (from grubby):
"The param $KERNELPATH\n$KERNELPATH is incorrect"
replacing $KERNELPATH with the actual vmlinuz path.

This bug is hidden when /boot is a separate partition, because the grubby script has regex ("/${param##*/}" = "${bls_linux[$i]}") which strips all duplicate lines and base path, and successfully matches "/vmlinuz-*".

This is reproducable by simply moving the /boot contents into a normal dir in the rootfs (instead of separate fs).

Running 'grubby --info ALL' (or even for a specific kernel version)
can return multiple entries for the same kernel version/release
(usually with different append parameters, initrds, etc), so when
grepping for a specific kernel version/release, we need to use only
the first match.

This results in kdumpctl failing with the error message (from grubby):
  "The param $KERNELPATH\n$KERNELPATH is incorrect"
replacing $KERNELPATH with the actual vmlinuz path.

This bug is hidden when /boot is a separate partition, because the
grubby script has regex ("/${param##*/}" = "${bls_linux[$i]}") which
strips all duplicate lines and base path, and successfully matches
"/vmlinuz-*".

This is reproducable by simply moving the /boot contents into a normal
dir in the rootfs (instead of separate fs).
Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request modifies the kdumpctl script to optimize the kernel path lookup within the _find_kernel_path_by_release function. Specifically, it adds the -m 1 flag to the grep command to ensure that only the first matching kernel entry is returned from the grubby output. I have no feedback to provide as there were no review comments to evaluate.

ddstreet added a commit to ddstreet/azurelinux that referenced this pull request Apr 22, 2026
When /boot is not a separate partition, kdumpctl will fail to operate
on any specific kernel version if it is listed multiple times in the
BLS loader entries (for example, with different append
parameters). This fixes it to use only the first matching entry to
determine the kernel image path.

Taken from (not yet merged) upstream PR:
rhkdump/kdump-utils#153
christopherco pushed a commit to microsoft/azurelinux that referenced this pull request Apr 25, 2026
When /boot is not a separate partition, kdumpctl will fail to operate
on any specific kernel version if it is listed multiple times in the
BLS loader entries (for example, with different append
parameters). This fixes it to use only the first matching entry to
determine the kernel image path.

Taken from (not yet merged) upstream PR:
rhkdump/kdump-utils#153
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant