
If you have ever tried to install an NVIDIA driver, set up VirtualBox, or compile a custom kernel module on Fedora 43 and hit an immediate wall of error messages, the missing piece was almost certainly kernel headers. Installing kernel headers on Fedora 43 is the foundational step that lets your system compile code that directly communicates with the Linux kernel. Without these files in place, the compiler has no reference for kernel functions, data structures, or system call interfaces, and every module build attempt will fail. This guide walks you through the complete process to install kernel headers on Fedora 43, explains what each command actually does, and covers the troubleshooting scenarios you are most likely to encounter as a sysadmin or developer.
Fedora 43 separates kernel development into two packages, kernel-headers and kernel-devel, and mixing them up or skipping one entirely is the single most common mistake beginners make. This guide covers both, explains when you need each one, and gives you verified commands with expected output so you can confirm your environment is correctly configured at every step. By the end, you will have a working kernel development environment on Fedora 43, the correct build toolchain installed, and a maintenance habit that survives every future kernel update.
What Are Kernel Headers and Why Does Fedora 43 Need Them?
Kernel headers are a collection of C header files that define the programming interface between Linux kernel internals and everything outside the kernel, including device drivers, kernel modules, and userspace applications. Think of them as a formal contract written in C: the headers declare the exact functions, constants, and data structures that the kernel exposes, and any software that needs to talk to the kernel must reference that contract during compilation.
When you run gcc to compile a kernel module, the compiler reads these header files to understand what struct module, printk(), or copy_from_user() looks like in memory. Without the headers, gcc produces a fatal error on the very first line of any kernel-facing source file.
The Two Packages You Need to Know
Fedora 43 ships kernel development files across two separate packages, and understanding the distinction saves you hours of debugging:
- kernel-devel: Provides the Makefiles, build scripts, kernel configuration, and internal header files needed to compile kernel modules. It installs into
/usr/src/kernels/<version>/. This package must match your running kernel version exactly. - kernel-headers: Provides the C header files for compiling userspace programs that use kernel APIs. It installs into
/usr/include/linux/and/usr/include/asm/. Since Fedora 26, this package versions independently from the running kernel, so a version number mismatch betweenkernel-headersand your running kernel is completely normal and expected.
Here is a side-by-side breakdown:
| Feature | kernel-headers |
kernel-devel |
|---|---|---|
| Purpose | Userspace API declarations | Module build infrastructure |
| Installs to | /usr/include/linux/ |
/usr/src/kernels/ |
| Must match running kernel? | No | Yes, exact match required |
| Needed for NVIDIA/VirtualBox? | No | Yes |
| Needed for glibc builds? | Yes | No |
For most practical scenarios, compiling NVIDIA drivers, VirtualBox modules, DKMS packages, or any out-of-tree kernel module, kernel-devel is the critical package. Install both to cover all bases.
When Do You Actually Need Kernel Headers?
Not every Fedora 43 user needs these packages. You need them when:
- Installing proprietary NVIDIA or AMD GPU drivers
- Building VirtualBox or VMware kernel modules
- Using DKMS or akmods-managed drivers that auto-rebuild on kernel updates
- Developing and testing custom Linux kernel modules
- Compiling low-level system libraries like glibc from source
- Writing C code that interfaces directly with kernel system calls
If you only run standard desktop applications on Fedora 43, skip these packages entirely. They add no benefit and consume disk space without a real use case.
Prerequisites
Before you run a single command, confirm the following:
- Operating System: Fedora 43 (this guide targets
fc43packages specifically) - User Privileges: A non-root user with
sudoaccess, or direct root access - Internet Connection: Active connection to Fedora’s official DNF repositories
- Package Manager:
dnfinstalled and working (it is the default on all Fedora 43 installations) - Terminal Access: A working terminal emulator or SSH session
- Recommended: Run a full system update before starting to prevent kernel and kernel-devel version mismatches, which is the number one cause of failed module builds
No advanced Linux knowledge is required. If you know how to open a terminal and run commands, you can follow this guide from start to finish.
Step 1: Update Your Fedora 43 System
Before touching any kernel-related package, bring your entire system up to date. This step is not optional. If DNF has stale metadata or your installed kernel is behind the version Fedora’s repositories track, the kernel-devel version that DNF offers may not match the kernel you are currently running, and the entire build environment will be broken from the start.
Run the following command:
sudo dnf upgrade --refresh
What This Command Does
The upgrade subcommand updates all installed packages. The --refresh flag forces DNF to bypass its local metadata cache and pull fresh package lists directly from Fedora’s configured repositories. Without --refresh, DNF may use cached repository data that is hours or days old and miss a recently published kernel-devel package.
Critical Step: Reboot if the Kernel Was Updated
Watch the DNF output carefully. If you see a line like:
Installing: kernel-6.17.x-300.fc43.x86_64
That means DNF just installed a newer kernel. You must reboot before continuing:
sudo reboot
After the reboot, Fedora 43 will load the new kernel. The kernel-devel you install next must match the kernel that is actively running, not the one that was running before the update. Skipping this reboot is the most common cause of version mismatch errors.
Step 2: Check Your Running Kernel Version
With the system updated and rebooted if necessary, check which kernel version is currently active. This version string is what you will use in every subsequent package installation command.
uname -r
Expected Output
On a Fedora 43 system, the output looks like this:
6.17.4-300.fc43.x86_64
Breaking this version string down:
6.17— Linux kernel major and minor version.4— Patch level-300— Fedora build number.fc43— Fedora 43 release identifier.x86_64— System architecture
Copy or note this string. You will reference it when verifying your kernel-devel installation in later steps.
Check All Installed Kernels
To see every kernel version currently installed on the system:
rpm -qa kernel | sort
If you see multiple kernels listed, confirm that the output of uname -r matches the newest one. If it does not, reboot and select the correct kernel from the GRUB menu.
Step 3: Install kernel-devel on Fedora 43
This is the core installation step. The kernel-devel package provides everything the compiler needs to build modules against your running Fedora 43 kernel: Makefiles, build scripts, the kernel configuration file, and all internal header files.
Install kernel-devel Matching Your Running Kernel
sudo dnf install kernel-devel-$(uname -r)
Why Use $(uname -r) Here?
The $(uname -r) syntax is shell command substitution. The shell executes uname -r first, gets the version string like 6.17.4-300.fc43.x86_64, and inserts it directly into the dnf install command. The final command DNF receives is:
sudo dnf install kernel-devel-6.17.4-300.fc43.x86_64
This guarantees a perfect version match every time, regardless of which kernel version your system runs. Typing the version string manually introduces typo risk. Using $(uname -r) removes it entirely.
DNF Confirmation Prompt
DNF will display the package size, any dependencies being pulled in, and ask for confirmation:
================================================================================
Package Arch Version Repository Size
================================================================================
Installing:
kernel-devel x86_64 6.17.4-300.fc43 fedora 15 M
Transaction Summary
================================================================================
Install 1 Package
Total download size: 15 M
Installed size: 65 M
Is this ok [y/N]:
Type y and press Enter.
Alternative: Install the Latest kernel-devel
If you just ran sudo dnf upgrade --refresh and rebooted into the new kernel, you can also use this simpler form:
sudo dnf install kernel-devel
Without the version suffix, DNF installs the latest available kernel-devel. This is safe only immediately after a full system update and reboot, where the running kernel is guaranteed to be the latest one in the repositories.
Step 4: Install kernel-headers on Fedora 43
Install kernel-headers when you need to compile userspace applications that call into kernel APIs, or when building low-level system libraries like glibc from source. This package is not required for compiling kernel modules but it completes the Kernel Headers on Fedora 43 setup for full development use.
sudo dnf install kernel-headers
No Version Suffix Needed
Unlike kernel-devel, kernel-headers does not require a version suffix. Since Fedora 26, the kernel-headers package versions independently from the running kernel. DNF installs the current version from the repository, and any version difference between kernel-headers and your running kernel is intentional behavior, not an error.
After installation, header files land in:
/usr/include/linux/— General Linux kernel API headers/usr/include/asm/— Architecture-specific headers
The C compiler checks these paths automatically during any userspace build that includes <linux/...> headers. You do not need to configure any compiler flags manually.
Step 5: Install Essential Build Tools
Kernel headers and kernel-devel provide the reference files, but the actual compilation process requires a working toolchain. Three packages cover everything you need to configure Fedora 43 kernel module builds.
Install all three in one command:
sudo dnf install gcc make elfutils-libelf-devel
What Each Package Does
- gcc: The GNU Compiler Collection. It compiles C source code into binary kernel modules. Without
gcc, themakebuild process cannot compile anything. - make: The build automation tool. It reads the
Makefileinside/usr/src/kernels/<version>/and orchestrates the entire compilation sequence. Every kernel module build starts with amakecommand. - elfutils-libelf-devel: Handles ELF (Executable and Linkable Format) binary operations. Kernel modules are ELF binaries, and this library gives the build system the tools it needs for module symbol resolution and verification.
On a freshly installed Fedora 43 desktop, gcc and make may already be present. DNF will skip packages that are already installed and only download what is missing.
Why This Matters for DKMS and akmods
If you manage DKMS or akmods-based drivers like the NVIDIA proprietary driver or VirtualBox kernel modules, these tools are what DKMS calls automatically when a new kernel is installed. Without gcc and make in place, DKMS silently fails to rebuild modules during kernel updates and you reboot into a system with a broken GPU driver or a missing VirtualBox host adapter.
Step 6: Verify the Installation
Never assume a package installed correctly. A quick verification step catches problems before they surface as confusing errors during an actual module build, often in the middle of an unrelated workflow.
Verify kernel-devel Matches the Running Kernel
rpm -q kernel-devel-$(uname -r)
Expected output:
kernel-devel-6.17.4-300.fc43.x86_64
If the output says package kernel-devel-6.17.4-300.fc43.x86_64 is not installed, go back to Step 3. Check whether a reboot is needed if DNF installed a newer kernel during the system update.
Verify kernel-headers Is Installed
rpm -q kernel-headers
Expected output (version number may differ from your running kernel — this is normal):
kernel-headers-6.17.4-300.fc43.x86_64
Verify the Build Directory Exists and Is Populated
ls -la /usr/src/kernels/$(uname -r)
You should see a directory with files including Makefile, Module.symvers, and subdirectories like include/ and scripts/:
total 6128
drwxr-xr-x. 25 root root 4096 Apr 15 10:30 .
-rw-r--r--. 1 root root 595 Apr 14 08:00 .config
drwxr-xr-x. 3 root root 4096 Apr 15 10:30 arch
-rw-r--r--. 1 root root 264372 Apr 14 08:00 Makefile
-rw-r--r--. 1 root root 5765123 Apr 14 08:00 Module.symvers
drwxr-xr-x. 120 root root 4096 Apr 15 10:30 include
drwxr-xr-x. 2 root root 4096 Apr 15 10:30 scripts
If this directory is empty or does not exist, kernel-devel either did not install or installed a mismatched version.
Verify the Build Toolchain
gcc --version && make --version
Both commands should return version information without errors:
gcc (GCC) 14.2.1 20241221 (Red Hat 14.2.1-7)
GNU Make 4.4.1
If either command returns command not found, reinstall the build tools from Step 5.
Troubleshooting Common Issues
Error 1: fatal error: linux/module.h: No such file or directory
This is the most common error during kernel module compilation on Fedora 43. It means kernel-devel is missing or does not match the running kernel.
Diagnose the issue:
rpm -q kernel-devel-$(uname -r)
If the output is package ... is not installed, install the correct version:
sudo dnf install kernel-devel-$(uname -r)
If DNF reports No match for argument, a reboot into the latest kernel is required before the matching kernel-devel becomes available in the repositories.
Error 2: No Package kernel-devel-X.X.X-XXX.fc43 Available
This error appears when you try to install kernel-devel for a kernel version that no longer exists in Fedora’s active repositories. Older kernel versions get pruned from the repositories after a few release cycles.
The fix is straightforward. Update the system, reboot into the latest kernel, and install the matching kernel-devel:
sudo dnf upgrade --refresh
sudo reboot
After reboot:
sudo dnf install kernel-devel-$(uname -r)
If you specifically need kernel-devel for an older kernel that has been removed from repositories, retrieve it from Koji, Fedora’s official build system, using the koji CLI tool.
Error 3: DKMS or akmods Modules Fail to Build After Kernel Update
After any Fedora 43 kernel update, DKMS and akmods must rebuild all registered modules against the new kernel. This rebuild requires a matching kernel-devel for the new kernel version.
Install the new kernel-devel first:
sudo dnf install kernel-devel-$(uname -r)
Force DKMS to rebuild all registered modules:
sudo dkms autoinstall
For akmods-managed packages:
sudo akmods --force
If modules still fail to load after rebuilding, regenerate the initramfs:
sudo dracut --force
Then reboot. The rebuilt modules will load automatically.
Error 4: DNF Cache Causes “No Match” Errors
Stale DNF metadata occasionally causes “no match” errors for packages that actually exist in the repositories. Clear the cache and retry:
sudo dnf clean all
sudo dnf install kernel-devel-$(uname -r)
Error 5: Version Mismatch Between Kernel and kernel-devel
Check both versions side by side:
uname -r
rpm -q kernel-devel
If the version strings differ, you are running a kernel for which no matching kernel-devel is installed. Reboot into the kernel version that has a matching kernel-devel, or install kernel-devel for the running kernel using the version-specific install command from Step 3.
Maintaining Kernel Headers After Fedora 43 Kernel Updates
Fedora 43 ships kernel updates frequently, and every new kernel requires a fresh kernel-devel installation to maintain a working module build environment. This is not a bug, it is how the Linux kernel version contract works.
After every sudo dnf upgrade session that installs a new kernel:
- Reboot into the new kernel
- Run:
sudo dnf install kernel-devel-$(uname -r)
The $(uname -r) substitution makes this command safe to run after every reboot following a kernel update. It always targets the currently running kernel, so there is no version ambiguity.
For systems running DKMS or akmods drivers, this command is what triggers the automatic module rebuild for NVIDIA, VirtualBox, and other managed modules. Add it to your personal post-update checklist or wrap it in a simple shell alias:
alias update-kdev='sudo dnf install kernel-devel-$(uname -r)'
How to Remove Kernel Development Packages
If you no longer need to build or maintain kernel modules on Fedora 43, remove the development packages to reclaim disk space.
Remove kernel development packages:
sudo dnf remove kernel-devel kernel-headers
Remove the build toolchain if it was installed solely for kernel work:
sudo dnf remove gcc make elfutils-libelf-devel
DNF will warn you if other installed packages depend on gcc or make before removing them. Read the warning output carefully before confirming.
Verify the packages are gone:
rpm -q kernel-devel kernel-headers
Expected output:
package kernel-devel is not installed
package kernel-headers is not installed
The /usr/src/kernels/ directory is removed along with kernel-devel, freeing up the 60-80 MB that the build infrastructure occupied.
Congratulations! You have successfully installed Kernel Headers. Thanks for using this tutorial for installing the Kernel Headers on your Fedora 43 Linux system. For additional or useful information, we recommend you check the official Fedora website.