【已解决】VMware Workstation的Ubuntu虚拟机中安装VMWare Tools出现提示:Enter the path to the kernel header files for the 3.8.0-27-generic kernel?

【问题】

折腾:

【吐槽】VMWare Workstation中的VMWare Tools还是很不好用啊

期间,重新安装VMWare Tools,结果又遇到之前就遇到的那个提示:

crifan@ubuntu:vmware-tools-distrib$ sudo ./vmware-install.pl 
The installer found the following conflicting packages installed on the system and will now remove them:
 
open-vm-tools
 
dpkg: warning: ignoring request to remove open-vm-tools, only the config
 files of which are on the system; use --purge to remove them too
A previous installation of VMware Tools has been detected.
 
The previous installation was made by the tar installer (version 4).
 
Keeping the tar4 installer database format.
 
You have a version of VMware Tools installed.  Continuing this install will 
first uninstall the currently installed version.  Do you wish to continue? 
(yes/no) [yes] 
 
Uninstalling the tar installation of VMware Tools.
 
Stopping services for VMware Tools
 
vmware-tools stop/waiting
File /usr/lib/vmware-tools/lib32/libconf/etc/gtk-2.0/gdk-pixbuf.loaders is 
backed up to 
/usr/lib/vmware-tools/lib32/libconf/etc/gtk-2.0/gdk-pixbuf.loaders.old.4.
 
File /usr/lib/vmware-tools/lib32/libconf/etc/pango/pangorc is backed up to 
/usr/lib/vmware-tools/lib32/libconf/etc/pango/pangorc.old.4.
 
This program previously created the file
/usr/lib/vmware-tools/libconf/etc/pango/pangorc, and was about to remove it.  
Somebody else apparently did it already.
 
File /etc/vmware-tools/vmware-user.desktop is backed up to 
/etc/vmware-tools/vmware-user.desktop.old.4.
 
File /usr/lib/vmware-tools/lib32/libconf/etc/fonts/fonts.conf is backed up to 
/usr/lib/vmware-tools/lib32/libconf/etc/fonts/fonts.conf.old.4.
 
This program previously created the file
/usr/lib/vmware-tools/lib32/libconf/etc/pango/pango.modules, and was about to 
remove it.  Somebody else apparently did it already.
 
This program previously created the file
/usr/lib/vmware-tools/libconf/etc/gtk-2.0/gdk-pixbuf.loaders, and was about to 
remove it.  Somebody else apparently did it already.
 
File /usr/lib/vmware-tools/lib32/libconf/etc/gtk-2.0/gtk.immodules is backed up
to /usr/lib/vmware-tools/lib32/libconf/etc/gtk-2.0/gtk.immodules.old.4.
 
This program previously created the file
/usr/lib/vmware-tools/libconf/etc/gtk-2.0/gtk.immodules, and was about to 
remove it.  Somebody else apparently did it already.
 
This program previously created the file
/usr/lib/vmware-tools/lib32/libconf/etc/pango/pangox.aliases, and was about to 
remove it.  Somebody else apparently did it already.
 
update-initramfs: Generating /boot/initrd.img-3.8.0-27-generic
update-initramfs: Generating /boot/initrd.img-3.8.0-19-generic
The removal of VMware Tools 8.8.6 build-1035889 for Linux completed 
successfully.
 
Installing VMware Tools.
 
In which directory do you want to install the binary files? 
[/usr/bin] 
 
What is the directory that contains the init directories (rc0.d/ to rc6.d/)? 
[/etc] 
 
What is the directory that contains the init scripts? 
[/etc/init.d] 
 
In which directory do you want to install the daemon files? 
[/usr/sbin] 
 
In which directory do you want to install the library files? 
[/usr/lib/vmware-tools] 
 
In which directory do you want to install the documentation files? 
[/usr/share/doc/vmware-tools] 
 
The path "/usr/share/doc/vmware-tools" does not exist currently. This program 
is going to create it, including needed parent directories. Is this what you 
want? [yes] 
 
The installation of VMware Tools 8.8.6 build-1035889 for Linux completed 
successfully. You can decide to remove this software from your system at any 
time by invoking the following command: "/usr/bin/vmware-uninstall-tools.pl".
 
Before running VMware Tools for the first time, you need to configure it by 
invoking the following command: "/usr/bin/vmware-config-tools.pl". Do you want 
this program to invoke the command for you now? [yes] 
 
Initializing...
 
 
Making sure services for VMware Tools are stopped.
 
 
 
[EXPERIMENTAL] The VMware FileSystem Sync Driver (vmsync) is a new feature that
creates backups of virtual machines. Please refer to the VMware Knowledge Base 
for more details on this capability. Do you wish to enable this feature? 
[no] 
 
 
Before you can compile modules, you need to have the following installed... 
 
make
gcc
kernel headers of the running kernel
 
 
Searching for GCC...
Detected GCC binary at "/usr/bin/gcc".
The path "/usr/bin/gcc" appears to be a valid path to the gcc binary.
Would you like to change it? [no] 
 
Searching for a valid kernel header path...
The path "" is not a valid path to the 3.8.0-27-generic kernel headers.
Would you like to change it? [yes] 
 
Enter the path to the kernel header files for the 3.8.0-27-generic kernel?

即:

Enter the path to the kernel header files for the 3.8.0-27-generic kernel?

【解决过程】

1.参考:

Error while validating for Ubuntu 12.10 Kernel headers

去安装对应版本的linux source,结果是本身就已经安装好了:

crifan@ubuntu:~$ sudo apt-get install linux-headers-$(uname -r)
Reading package lists... Done
Building dependency tree       
Reading state information... Done
linux-headers-3.8.0-27-generic is already the newest version.
The following packages were automatically installed and are no longer required:
  dkms fakeroot g++-4.7 libdumbnet1 libstdc++6-4.7-dev zerofree
Use 'apt-get autoremove' to remove them.
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
crifan@ubuntu:~$

2.再参考另外那人回复,所以去:

sudo apt-get update&&sudo apt-get dist-upgrade

3.但是参考:

[Linux][Ubuntu]在Ubuntu 12.10中安装和配置vmware tools

所以可以先去看看自己此处是否对应目录已有头文件,结果是有的:

crifan@ubuntu:~$ ls /usr/src/linux-
linux-headers-3.8.0-19/         linux-headers-3.8.0-27/         linux-source-3.2.0/
linux-headers-3.8.0-19-generic/ linux-headers-3.8.0-27-generic/ linux-source-3.2.0.tar.bz2
crifan@ubuntu:~$ ls /usr/src/linux-headers-3.8.0-
linux-headers-3.8.0-19/         linux-headers-3.8.0-27/         
linux-headers-3.8.0-19-generic/ linux-headers-3.8.0-27-generic/ 
crifan@ubuntu:~$ ls /usr/src/linux-headers-3.8.0-27-generic/
arch    Documentation  fs       ipc      kernel    mm              samples   sound   usr
block   drivers        include  Kbuild   lib       Module.symvers  scripts   tools   virt
crypto  firmware       init     Kconfig  Makefile  net             security  ubuntu
crifan@ubuntu:~$ ls /usr/src/linux-headers-3.8.0-27-generic/include
acpi         clocksource  crypto  generated  keys   math-emu  memory  net     ras   rxrpc  sound   trace  video
asm-generic  config       drm     Kbuild     linux  media     misc    pcmcia  rdma  scsi   target  uapi   xen
crifan@ubuntu:~$

所以,手动输入对应的路径,但是还是提示是非法的路径:

Searching for a valid kernel header path...
The path "" is not a valid path to the 3.8.0-27-generic kernel headers.
Would you like to change it? [yes] 
 
Enter the path to the kernel header files for the 3.8.0-27-generic kernel? /usr/src/linux-headers-3.8.0-27-generic/include
 
The path "/usr/src/linux-headers-3.8.0-27-generic/include" is not a valid path 
to the 3.8.0-27-generic kernel headers.
Would you like to change it? [yes]

又试了试,其他几个header,结果也还是不行:

crifan@ubuntu:~$ uname -r
3.8.0-27-generic
crifan@ubuntu:~$ ls /usr/src/linux-headers-3.8.0-19/include
acpi         clocksource  drm     keys   math-emu  memory  net     ras   rxrpc  sound   trace  video
asm-generic  crypto       Kbuild  linux  media     misc    pcmcia  rdma  scsi   target  uapi   xen
crifan@ubuntu:~$ ls /usr/src/linux-headers-3.8.0-19-generic/include
acpi         clocksource  crypto  generated  keys   math-emu  memory  net     ras   rxrpc  sound   trace  video
asm-generic  config       drm     Kbuild     linux  media     misc    pcmcia  rdma  scsi   target  uapi   xen
crifan@ubuntu:~$ ls /usr/src/linux-headers-3.8.0-27-generic/include
acpi         clocksource  crypto  generated  keys   math-emu  memory  net     ras   rxrpc  sound   trace  video
asm-generic  config       drm     Kbuild     linux  media     misc    pcmcia  rdma  scsi   target  uapi   xen
crifan@ubuntu:~$ ls /usr/src/linux-headers-3.8.0-27/include
acpi         clocksource  drm     keys   math-emu  memory  net     ras   rxrpc  sound   trace  video
asm-generic  crypto       Kbuild  linux  media     misc    pcmcia  rdma  scsi   target  uapi   xen
crifan@ubuntu:~$

和:

Enter the path to the kernel header files for the 3.8.0-27-generic kernel? /usr/src/linux-headers-3.8.0-19/include       
 
The path "/usr/src/linux-headers-3.8.0-19/include" is not a valid path to the 
3.8.0-27-generic kernel headers.
Would you like to change it? [yes] yes
 
Enter the path to the kernel header files for the 3.8.0-27-generic kernel? /usr/src/linux-headers-3.8.0-19-generic/include
 
The path "/usr/src/linux-headers-3.8.0-19-generic/include" is not a valid path 
to the 3.8.0-27-generic kernel headers.
Would you like to change it? [yes] yes
 
Enter the path to the kernel header files for the 3.8.0-27-generic kernel? /usr/src/linux-headers-3.8.0-27-generic/include
 
The path "/usr/src/linux-headers-3.8.0-27-generic/include" is not a valid path 
to the 3.8.0-27-generic kernel headers.
Would you like to change it? [yes] yes
 
Enter the path to the kernel header files for the 3.8.0-27-generic kernel? /usr/src/linux-headers-3.8.0-27/include
 
The path "/usr/src/linux-headers-3.8.0-27/include" is not a valid path to the 
3.8.0-27-generic kernel headers.
Would you like to change it? [yes] yes
 
Enter the path to the kernel header files for the 3.8.0-27-generic kernel?

4.再去参考:

VMware Tools: Fix “no valid kernel header path”

去试试:

sudo apt-get update  
sudo apt-get install kernel-headers kernel-devel gcc make

结果根本找不到:

crifan@ubuntu:~$ sudo apt-get install kernel-headers kernel-devel gcc make
Reading package lists... Done
Building dependency tree       
Reading state information... Done
E: Unable to locate package kernel-headers
E: Unable to locate package kernel-devel
crifan@ubuntu:~$

5.参考

Error while validating for Ubuntu 12.10 Kernel headers

去重启Ubuntu。

然后再去安装build-essential:

sudo apt-get install build-essential

再去安装linux header:

sudo apt-get install linux-headers-$(uname -r)

然后再去安装试试:

突然看到提示说之前安装了open-vm-tools,会有冲突,

所以,手动去卸载:

sudo apt-get autoremove open-vm-tools

再重新安装,结果竟然还是检测到已经安装了open-vm-tools,然后还由于无法继续调用

/usr/bin/vmware-uninstall-tools.pl

而终于运行了。

最后的最后,还是通过,重新安装open-vm-tools,而得以正常的使用文件夹共享,但是剪贴板共享,还是不行。

6.再参考:

VMWare Tools Installation – Kernel header files path not valid.

去修改vmware-install.pl,但是,此刻,就只是之前的错误:

无法继续安装vmware-install.pl了。

因为:

始终出错,显示:

cannot execute /usr/bin/vmware-uninstall-tools.pl

而去/usr/bin下面看了看,的确没有vmware-uninstall-tools.pl

导致:

无论如何,都无法继续安装或卸载当前的vmware tools了。。。

7.后来是发现,本身vmware-tools下面有个bin目录,其下就有个vmware-uninstall-tools.pl,所以sudo cp一下到/usr/bin中后,再去执行,就可以找到此文件了。

【总结】

最后,还是通过:

先卸载之前的open-vm-tools

再安装vmware-tools.pl

再安装open-vm-tools

而解决了所有问题,使得可以:

剪贴板共享可用,文件共享可用。

没有找到其他更好的办法。


【后记 2013-09-02】

1.后来,在折腾:

【记录】继续折腾VMWare Workstation 8下的虚拟机Ubuntu 13.04中的文件夹共享

【已解决】VMware Workstation 8下Ubuntu 13.04中安装VMware Tools出错:/tmp/vmware-root/modules/vmci-only/linux/driver.c:127:4: error: implicit declaration of function ‘__devexit_p’ [-Werror=implicit-function-declaration]

期间,最终,找到了此问题的:

原因:

Ubuntu 13.04是最新的3.0的Linux内核,其内核版本的头文件的位置发生了变化,

导致之前,相对旧的VMWare Tools,找不到对应的头文件,因此而报错。

解决办法:

用当前,实际上已经存在的头文件,做个软链接:

sudo ln -s /usr/src/linux-headers-$(uname -r)/include/generated/uapi/linux/version.h /usr/src/linux-headers-$(uname -r)/include/linux/version.h

就可以了。

结论:

VMWare,尤其是VMWare Tools,还是做得很不好:

【吐槽】VMWare Workstation中的VMWare Tools还是很不好用啊

相比之下,Virtualbox,就没有这类很挫的问题:

VirtualBox教程中的:)

【教程】如何为VirtualBox安装 Guest Additions/增强工具包/功能增强包/增强功能包



5 Thoughts on “【已解决】VMware Workstation的Ubuntu虚拟机中安装VMWare Tools出现提示:Enter the path to the kernel header files for the 3.8.0-27-generic kernel?

  1. 我不懂怎么解决了==

  2. /usr/src/linux-headers-$(uname -r)/include/linux/下没有version.h呢,怎么解决?

  3. 重要信息是最后的结论。

  4. 折腾了两天,终于在你这找到了答案。一样一样的问题,亏得你能把折腾的过程记录下来,感谢!

发表评论

电子邮件地址不会被公开。 必填项已用*标注

无觅相关文章插件,快速提升流量