18

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.

  • 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. – Jeff Schaller Jul 13 '15 at 13:26
8

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
  • 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 – Kvothe Jul 13 '15 at 14:00
21

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)"
  • This worked on a Surface Book & VMWare config. – ThinkCode Oct 31 '16 at 6:27
  • Works on centos 7, spent over two hours before.. Thanks! – h0x91B Jul 13 '17 at 13:04
  • Finally.... Worked on CentOS7. Thanks a lot – VM_AI Aug 31 '18 at 6:52
  • It worked. Thanks. Not sure if kernel-headers part of this devel. – Murali Mopuru Oct 15 '18 at 16:17
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

  • Answers so straightforward like this deserve more up votes. – WesternGun Sep 27 '18 at 13:16
2

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

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.

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.

  • 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. – Gaurav Sep 1 '18 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

protected by Community yesterday

Thank you for your interest in this question. Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count).

Would you like to answer one of these unanswered questions instead?

Not the answer you're looking for? Browse other questions tagged or ask your own question.