ubuntu 安装 VMware Tool 时include 出错

问题:ubuntu 10 安装 VMware Tool 时include 文件检测出错

解决:

 

安装VMware可以改变虚拟机显示的大小,也可以让真机喝虚拟机实现字符串相互拷贝,相互分享共享目录......

步骤:

sudo ./vmware-install.pl

 

Console代码
1.What is the location of the directory of C header files that match your running  
2.kernel? [/usr/src/linux/include] <直接按 Enter>  
3.  
4.The path "/usr/src/linux/include"  is not an existing directory.  
What is the location of the directory of C header files that match your running
kernel? [/usr/src/linux/include] <直接按 Enter>

The path "/usr/src/linux/include" is not an existing directory. 

 

由于 Kernel 版本是 APT 抓下來的最新版,所以会需要输入 “/usr/src/linux-headers-2.6.35-22-generic/include “

要注意的是,VMWare Tools 安装时会询问目前系统使用的 Kernel header,所以如果 /usr/src 下有多个 Kernel header 目录,最好先执行 “uname -r“ 指令,确认应该使用那个本版。另外可以不直接使用 “/usr/src/linux-headers-2.6.35-22-generic/include” ,先 “sudo ln -s /usr/src/linux /usr/src/linux-headers-2.6.35-22-generic/include”

 

Console代码
1.What is the location of the directory of C header files that match your running  
2.kernel? [/usr/src/linux/include] /usr/src/linux-headers-2.6 . 35 - 22 -generic/include  
What is the location of the directory of C header files that match your running
kernel? [/usr/src/linux/include] /usr/src/linux-headers-2.6.35-22-generic/include
 

按回车以后,还是报错说,指定的Kernel headers喝当前系统使用的版本不匹配。

 

Console代码
1.The directory of kernel headers (version @@VMWARE@@ UTS_RELEASE) does not match  
2.your running kernel (version 2.6 . 35 - 22 -generic). Even if the module were to  
3.compile successfully, it would not load into the running kernel.    
The directory of kernel headers (version @@VMWARE@@ UTS_RELEASE) does not match
your running kernel (version 2.6.35-22-generic). Even if the module were to
compile successfully, it would not load into the running kernel.   

 

但事实并不是不匹配,而是 Kernel 中有一个变量 UTS_RELEASE 的不存在了。以前这个定义放在 /usr/src/linux-headers-2.6.35-22-generic/include/linux/version.h ,而现在已经移到了/usr/src/linux-headers-2.6.35-22-generic/include/linux /utsrelease.h。所以简单的方法,我们只需要在version.h中添加 #define UTS_RELEASE "2.6.35-22-generic" (具体值使用 “uname -r“ 查看)

 

接下来继续,又会有新的错误提示!! -_-|| 找不到 autoconf.h 原因是因为 autoconf.h 不再VMware tools 安装程序预设的寻址目录中。

 

Console代码
1.The path  "/usr/src/linux-headers-2.6.35-22-generic/include"  is a kernel header  
2.file directory, but it does not contain the file "linux/autoconf.h"  as  
3.expected. This can happen if the kernel has never been built, or if you have  
4.invoked the "make mrproper"  command in your kernel directory. In any case, you  
5.may want to rebuild your kernel.    
The path "/usr/src/linux-headers-2.6.35-22-generic/include" is a kernel header
file directory, but it does not contain the file "linux/autoconf.h" as
expected. This can happen if the kernel has never been built, or if you have
invoked the "make mrproper" command in your kernel directory. In any case, you
may want to rebuild your kernel.   

 

可以简单的把它链接过来:

cd /usr/src/linux-headers-2.6.35-22-generic/include/linux

sudo ln -s ../generated/autoconf.h ./ 

然后应该能顺利完成安装了。

### 安装 VMware Tools 的方法 在 Ubuntu 系统中安装 VMware Tools 是一项常见的任务,它能够显著提升用户体验并增强功能支持。以下是详细的安装过程: #### 准备工作 确保虚拟机已正确配置,并运行最新的 Ubuntu 版本。如果尚未安装 VMware Tools,则可以通过菜单选项触发安装流程。 打开虚拟机后,在 VMware 菜单栏选择 **【虚拟机】→ 【重新安装 VMware Tools】** 或者 **【安装 VMware Tools】**(取决于是否已经安装过)。当安装包准备就绪VMware 底部会出现提示信息[^1]。 --- #### 步骤 1: 挂载 VMware Tools ISO 文件 执行以下命令挂载 VMware 提供的光盘镜像到系统中的 `/mnt/cdrom` 目录下: ```bash sudo mkdir -p /mnt/cdrom sudo mount /dev/cdrom /mnt/cdrom ``` 确认挂载成功后,进入该目录查看文件列表: ```bash ls /mnt/cdrom ``` 此应能看到 `vmware-tools-distrib.tar.gz` 压缩包或其他相关文件[^2]。 --- #### 步骤 2: 解压并编译 VMware Tools 解压缩 VMware Tools 并导航至解压后的目录: ```bash cd /tmp tar zxpf /mnt/cdrom/VMwareTools-*.tar.gz cd vmware-tools-distrib/ ``` 随后运行脚本来完成安装: ```bash sudo ./vmware-install.pl -d ``` 参数 `-d` 表示接受默认设置自动完成安装。如果有特殊需求,也可以手动调整某些选项[^3]。 --- #### 步骤 3: 验证安装结果 重启虚拟机以应用更改: ```bash sudo reboot ``` 验证 VMware Tools 是否正常工作,例如检查屏幕分辨率是否自适应窗口大小以及跨系统的剪贴板共享功能是否可用[^4]。 --- #### 可能遇到的问题及解决办法 1. 如果发现安装过程中缺少必要的内核头文件或开发工具链,请先安装它们: ```bash sudo apt update && sudo apt install build-essential linux-headers-$(uname -r) ``` 2. 若旧版本的 VMware Tools 已经存在,建议卸载后再重试: ```bash sudo vmware-uninstall-tools.pl ``` --- #### 总结 通过上述步骤即可顺利完成 VMware Tools 在 Ubuntu 中的安装。此操作不仅提升了虚拟机性能,还增强了与其他操作系统之间的交互能力。
评论 9
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值