Empty kernel directory but kernel-headers are installed

Host – Windows 7

Guest – CentOS

I am trying to install kernel-headers using yum since during the installation of vmware-tools I get a message asking for the path to the kernel header files for the 3.10.0-229.7.2.e17.x86_64.

Running yum install kernel-headers returns Package kernel-headers-3.10.0-229.7.2.e17.x86_64 already installed and latest version. But the directory /usr/src/kernels is empty.

Are the kernel headers installed somewhere else? Or should I be asking yum to install something else?

Path provided to vmware-tools for kernel headers

Searching for a valid kernel header path...
The path "" is not a valid path to the 3.10.0-229.7.2.e17.x86_64 kernel headers.
Would you like to change it? [yes]

Providing the path /usr/include/linux gives the same response again but with “” replaced with the path provided.

Asked By: Kvothe


The correct package to install all of the required dependencies for building kernel modules is kernel-devel (see the CentOS documentation for more information).

The headers are not installed in /usr/src/kernels, rather they’re installed in a number of directories below /usr/include (the default location for C header files). You can list the contents of the kernel-headers package you installed using:

rpm -ql kernel-headers
Answered By: mjturner

I had the same issue and the above solution did not work for me. It could be the build of CentOS 7 I am using.
Here is what solved the problem for me…

install kernel headers

yum -y install kernel-devel

set symbolic link so vmware tools can find version.h

export kernel_headers=`ls -hd /usr/src/kernels/3*`
sudo ln -s ${kernel_headers}/include/generated/uapi/linux/version.h ${kernel_headers}/include/linux/version.h
Answered By: patrick fogarty

I had same problem. After much googling, this solution worked for me. It first determines the installed kernel version and then uses that exact version to install the kernel header package.

sudo yum install "kernel-devel-uname-r == $(uname -r)"
Answered By: MarkAu

I installed the kernel-devel package, but it turns out that the headers were for a different kernel version than the one that was running on my instance. In order to fix the problem, I ran

sudo yum upgrade

and rebooted, and then vmware-tools installed without a fuss.

Answered By: sffc

On CentOS version 7 given below is the path for kernel-headers.


After running yum install kernel-headers twice (updated to the latest), the problem got fixed. Make sure the running kernel version and the kernel headers version are same. My kernel version is 3.10.0-327.36.2.el7.x86_64

Answered By: Shanraj

I’ve had exactly the same issue.

In my case i just had to remove kernel-dev* et install it again :

yum -y remove kernel-devel*
yum -y install kernel-devel*
Answered By: AxldenieD

I believe I found a work-around for this.

I’ve been reading suggestions (even on VMWare’s website) that recommend installing the open-vm-tools as opposed to the VMWare tools.

yum install open-vm-tools

There are some caveats of course, after installing, remember to reboot the virtual machine.

Also, now instead of the green check mark that usually shows in vSphere, instead it shows the grey “?” but does recognize the tools are running and shows the IP address, and OS that is running as well as the “Running (3rd-party/Independent)” display.

So hopefully this will help someone. I’ve spent two days on this, and finally found this answer, and it worked for me, running ESXi 5.1 and vCenter with CentOS 7.2 as the guest os.

Answered By: Eric

To answer the question,
Kernel source is installed under /usr/src/kernels/. kernel-devel is the package to install.

To provide solution to the problem,
The reason for the problem is that the kernel that is installed is old and kernel-devel has an update in repository. So installing kernel-devel installs source of a newer kernel and hence vmware tools config script doesn’t find the source.
There are two possible solutions.

  1. Update the kernel so that both kernel and kernel-devel are new.

    sudo yum upgrade

Reboot so that new kernel is loaded and then run vmware tools config script.

  1. Updating kernel is not always feasible. If that is the case install kernel-devel version that is same as the installed kernel version.

    sudo yum install "kernel-devel-uname-r == $(uname -r)"
Answered By: Gaurav

This is what worked for me on a fresh minimal-Centos installation:

sudo yum update
sudo yum upgrade
sudo yum install "kernel-devel-uname-r == $(uname -r)" gcc
Answered By: Carsten
Categories: Answers Tags: ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.