Kernel headers and custom kernel diffrent versions

Hi, guys. I want to use custom build of LTS kernel 5.4, but i have kernel-headers 5.7 installed. Should i use same version of kernel-headers as my custom kernel? Or i can use newest kernel-headers with old kernel version?

1 Like

You typically don’t need kernel-headers as a user.
Only for compiling DKMS/AKMOD drivers, or when developing/building something.

1 Like

But i have custom wifi driver. Can i have problems with it in kernel 5.4 and headers 5.7?

BTW during kernel building it use /usr/include/** this is kernel-headers?

1 Like

Yes, this can be a problem.
Install the kernel-headers matching your kernel version.


I was downloaded kernel sources 5.4.98. I read that kernel-headers must be same or lower to kernel version. Is it right? Where i can get headers same version?, maybe?

Kernel headers do not need to be rebuilt for every kernel, so they won’t necessarily match versions:

1 Like

You should be able to get a listing of past versions with the following:

dnf list kernel-headers --showduplicates

Then, select the one you want and install. Although, that may not be a viable option on fedora, as opposed to RHEL, since that version is many fedora releases behind.

As someone else already mentioned, check Build System Info | koji to see if the specific version is available.

Alternatively, download the sources from upstream, install rpmdevtools and rpm-build along with any other required development tools and then copy the most recent config to the source directory.

tar xvf linux-5.4.98.tar.xz && cd linux-5.4.98
cp -r /boot/config-5.7.1-100.fc31.x86_64 .config
make menuconfig
make rpm-pkg

The last part should create the appropriate kernel rpms. As you’re only concerned with the kernel-headers package, you can install just that from $HOME/rpmbuild/RPMS/

See the fedora wiki for more info.