How to Fix VirtualBox Kernel Headers Not Found Error

1 min

This quick guide would help you to fix the “VirtualBox Kernel Headers Not Found” error.

Reason for the error

When you run Fedora or any related distro (such as RHEL, CentOS, etc.) in VirtualBox as a guest, you get this error while installing the VirtualBox guest additions.

The primary reason is the difference in Kernel versions between the guest and the host system.

For example, suppose your host system has Linux Kernel 5.19, and you install any distribution with a different version, say 5.14. In that case, you may run into this error while running the setup script for the virtual box guest additions.

The VirtualBox guest addition set-up requires the necessary Kernel modules to be built inside the guest system. Then it checks whether the Kernel modules match between guest and host; otherwise, it throws this error.


Fix the Kernel Headers Not found error in VirtualBox

To solve this, open a terminal inside the guest system.

And install the necessary Kernel packages as mentioned below. This command is for Fedora and RPM-based distros. You can use apt for Ubuntu-based distributions.

sudo dnf install kernel-headers kernel-devel

For Debian, Ubuntu, Linux Mint or other apt-based systems, use the following command:

sudo apt-get install build-essential linux-headers-$(uname -r) dkms

And then reboot.


After reboot, try to re-run the VirtualBox guest addition installation script. And the error should be fixed.

If not, drop a note below.

After fixing the error
After fixing the Kernel headers not found error

Note: Although it’s mentioned that only for Fedora and related distros. But the same applies to Ubuntu and related distros as well. The idea is the same to install the necessary packages in the guest system.


Creator and author of Connect with me via Telegram, 𝕏 (Twitter), or send us an email.
Notify of

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Oldest Most Voted
Inline Feedbacks
View all comments