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, if your host system has Linux Kernel 5.19 for example and you are installing any distribution with a different version, say 5.14, then 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; otherwise, it throws this error.

error
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.

sudo dnf install kernel-headers kernel-devel

And then reboot.

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 its 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.


Arindam

Creator of debugpoint.com. All time Linux user and open-source supporter. Connect with me via Telegram, Twitter, LinkedIn, or send us an email.
Subscribe
Notify of
guest

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

0 Comments
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x