23

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.

2
  • 1
    check the output of rpm -ql kernel-headers; I think it puts files in /usr/include/linux, but I may be out-of-date. It'd be good if you could indicate what path you give to the vmware-tools installer and also what it reports back. Commented Jul 13, 2015 at 13:26
  • In my case I had to install kernel-devel and reboot the vm Commented Nov 12, 2021 at 12:07

9 Answers 9

32

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)"
3
  • This worked on a Surface Book & VMWare config. Commented Oct 31, 2016 at 6:27
  • Works on centos 7, spent over two hours before.. Thanks! Commented Jul 13, 2017 at 13:04
  • It worked. Thanks. Not sure if kernel-headers part of this devel. Commented Oct 15, 2018 at 16:17
11

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
1
  • That was it. I'd got to that page earlier but misread it as "if you do need the full source use kernel-devel". Thanks Commented Jul 13, 2015 at 14:00
4

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

/lib/modules/3.10.0-327.36.2.el7.x86_64/build/include

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

1
  • Answers so straightforward like this deserve more up votes. Commented Sep 27, 2018 at 13:16
3

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
0
2

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.

2

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*
0

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.

1
  • open-vm-tools is not really an alternative to the vmware tools in certain cases. eg. open-vm-tools does not support hgfs for sharing files between guest and host. Vmware supports hgfs on centos 7. Commented Sep 1, 2018 at 10:01
0

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)"
0

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
./vmware-install.pl

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.