Cant install headers for new kernel

I seem to have allowed a kernel upgrade, which is fine in itself.

However it stopped my displaylink screens from working.

During trying to fix that I found the headers for this new kernel don’t seem to be available…..

Am I doing the wrong thing? Should this fix itself if I wait? Any suggestions?

sudo dnf install linux-headers-$( uname -r )
Last metadata expiration check: 0:15:11 ago on Thu 11 Dec 2025 11:53:43 GMT.
No match for argument: linux-headers-5.14.0-611.11.1.el9_7.x86_64
Error: Unable to find a match: linux-headers-5.14.0-611.11.1.el9_7.x86_64

Package is kernel-headers:

dnf install kernel-headers

Thanks - For some reason I thought google was telling me that the short version was simply an abbreviation for the longer one.

its a bit odd on the user-friendliness front:

You install kernel-headers, and it tells you the full name is installed. But if you ask to install the full name it says it’s unknown :slight_smile:

But I guess that resolves it. TVM

$ sudo dnf install kernel-headers
Package kernel-headers-5.14.0-611.11.1.el9_7.x86_64 is already installed.
Dependencies resolved.
Nothing to do.
Complete!

It depends which kernel you are booted into. If you are booted in a 9.6 kernel, then it won’t find the kernel-headers for that kernel, because the one that exists in the repos is for 9.7. Also, linux-headers is a package name from Debian/Ubuntu, so it won’t work anyway for EL-based distros.

In RHEL, the command would work, since kernel-headers for all kernels are available. So if we did:

dnf install kernel-headers-`uname -r`

that would work on RHEL when booted in an older kernel. But that is not possible for Rocky, since only the latest release is supported.

TFT Explanation

Not sure I followed, as I am booted into 9.7 with kernel 5.14.0-611.11.1.el9_7.x86_64 and if I read you right that name for the desired headers SHOULD match?

But it doesn’t

$sudo dnf install linux-headers-$( uname -r )

No match for argument: linux-headers-5.14.0-611.11.1.el9_7.x86_64
Error: Unable to find a match: linux-headers-5.14.0-611.11.1.el9_7.x86_64

———–
$sudo dnf install kernel-headers

Package kernel-headers-5.14.0-611.11.1.el9_7.x86_64 is already installed.
Dependencies resolved.
Nothing to do.
Complete!
—————
However:

$sudo dnf list installed | grep kernel-header
kernel-headers.x86_64 5.14.0-611.11.1.el9_7 @appstream

I don’t need an answer, it’s all good now.

There is also There can be only one! issue.

# dnf rq --installonly
kernel-0:5.14.0-611.11.1.el9_7.x86_64
kernel-core-0:5.14.0-611.11.1.el9_7.x86_64
kernel-devel-0:5.14.0-611.11.1.el9_7.x86_64
kernel-modules-0:5.14.0-611.11.1.el9_7.x86_64
kernel-modules-core-0:5.14.0-611.11.1.el9_7.x86_64

# dnf list installed kernel*
Installed Packages
kernel.x86_64                       5.14.0-611.11.1.el9_7         @baseos   
kernel-core.x86_64                  5.14.0-611.11.1.el9_7         @baseos   
kernel-devel.x86_64                 5.14.0-611.11.1.el9_7         @appstream
kernel-devel-matched.x86_64         5.14.0-611.11.1.el9_7         @appstream
kernel-headers.x86_64               5.14.0-611.11.1.el9_7         @appstream
kernel-modules.x86_64               5.14.0-611.11.1.el9_7         @baseos   
kernel-modules-core.x86_64          5.14.0-611.11.1.el9_7         @baseos   
kernel-srpm-macros.noarch           1.0-14.el9                    @appstream
kernel-tools.x86_64                 5.14.0-611.11.1.el9_7         @baseos   
kernel-tools-libs.x86_64            5.14.0-611.11.1.el9_7         @baseos

Note that I do have kernel-headers, but they are not in the “install-only” list?
That is, I can have multiple versions of kernel, kernel-core, kernel-devel, kernel-modules, and kernel-modules-core simultaneously installed, but only one kernel-headers. The files of kernel-headers are in /usr/include with no version number.

You do plain dnf install kernel-headers and its files are used for compilation of modules for every kernel version. I don’t know whether the el9_7 headers are appropriate for el9_6 kernels.

As already said, it’s not going to work because linux-headers is a Debian/Ubuntu package. The equivalent in EL world is kernel-headers. Had you used my example from my previous post, eg:

you would see I wrote kernel-headers and not linux-headers. But again, as I also wrote, only the latest package of kernel-headers is available, so it would work when booted into the same kernel version as the kernel you are running. For RHEL as mentioned, there are multiple kernel-headers package, and so would work even when booted into older kernels.

yes I think I am in typo-land - my apologies.

I will regroup and try to become coherent :slight_smile:

1 Like

Yeah, thanks. I’m beginning to see that once I have jump over to a new kernel version, I sort of have to stay jumped.
Which would be great if everything worked :slight_smile:

But my displaylink monitors now don’t - see other thread - so I’m quietly frustrated. Or sometimes noisily.

Google is not a good way to work with Rocky, it’s biased towards debian and ubuntu.

1 Like

A general comment about the kernel-headers package. It is only necessary if you intend to rebuild glibc and, thus, the entire operating system. When you see a message like “your kernel headers for kernel xxx cannot be found …”, you most likely need the kernel-devel package, not the kernel-headers package.

I understand kernel-devel is called linux-headers in Debian/Ubuntu.

Thanks. I think the need for headers was provoked by displaylink compiling it’s evdi graphics driver, which seems to need to know the layout of some system structs.

Structs which apparently changed with 611 causing it to fail to compile,which started my grief.

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.