Sunday, October 30, 2011

Unable to find the sources of your current Linux kernel

When you are installing Oracle Linux (or other distributions) within a Oracle VirtualBox virtualization environment you do want to install the Guest Additions most likely. Depending on what you have included in your installation you might be missing some packages which result in failure of the installation of the Guest Additions.

Last “version” of this issue I encountered was represented by this error message:

The headers for the current running kernel were not found. 
If the following module compilation fails then this could be the reason.

Building the main Guest Additions module!
(Look at /var/log/vboxadd-install.log to find out what went wrong)

When you take a look in the mentioned log located in /var/log/vboxadd-install.log I encountered the following line:

Failed to install using DKMS, attempting to install without
/tmp/vbox.0/Makefile.include.header:94: *** Error: unable to find the sources of your current Linux kernel. Specify KERN_DIR= and run Make again.  Stop.

This indicates that you do not have all the packages you need to rebuild some of the kernel parts. To resolve this you have to install the following GCC, kernel-dev and kernel-headers. You can do so by executing the following yum command:

yum install gcc kernel-devel kernel-headers

That is under the impression that you have already configured your yum repository to your enterprise yum repository or to the public yum server available online at Oracle. If you have not configured yum you can read in this blogpost how you should configure your yum settings.

Secondly you have to make sure you have a variable names KERN_DIR pointing to your sources kernel. In my case this is /usr/src/kernerls/2.6.32-131.0.15.el6.i686
Post a Comment