解决在xubuntu13.04上安装vmhgfs失败,导致不能共享问题

本问题的解决方法,来源于:http://ubuntuforums.org/showthread.php?t=2136277&page=3

问题描述:

安装vmware tools时,出现以下错误。

/tmp/modconfig-5e6o62/vmhgfs-only/inode.c:888:4: error: implicit declaration of function ‘vmtruncate’ [-Werror=implicit-function-declaration]
cc1: some warnings being treated as errors
make[2]: *** [/tmp/modconfig-5e6o62/vmhgfs-only/inode.o] Error 1
make[2]: *** Waiting for unfinished jobs....
make[1]: *** [_module_/tmp/modconfig-5e6o62/vmhgfs-only] Error 2
make[1]: Leaving directory `/usr/src/linux-headers-3.8.0-18-generic'
make: *** [vmhgfs.ko] Error 2
make: Leaving directory `/tmp/modconfig-5e6o62/vmhgfs-only'

问题原因:

这是vmware tools的一个bug,在linux kernel 3.8.x就会导致这个问题。

问题解决方法:

创建一个文件夹,将'vmhgfs-fix.sh', 'vmtools.inode.c.patch' 和 'VMwareTools-9.x.x.tar.gz' 放到里面,执行./vmhgfs-fix.sh 自动打补丁,然后再安装文件夹中解压好的vmware tools即可。

vmhgfs-fix.sh文件内容:

#!/bin/bash
#
# Patch to fix VMware-Tools installation in kernel 3.8.x
# Working for Ubuntu 13.04 (Xubuntu and Kubuntu also)
#

# Get VMwareTools file (it should be in the default format VMwareTools-9.x.x...)
VMFILE=`ls | grep VMwareTools-9.*`

if [[ ! $VMFILE ]]
then
  printf "\nERROR: \nVMwareTools-9.(...).tar.gz not found.\n\nYou should place it in the current folder and/or \nRename it as VMwareTools-9... (default format name)\n\n"
  exit
fi

# Check for vmware-tools-distrib folder
if [[ ! -d vmware-tools-distrib ]]
then
  printf "\nExtracting VMware-tools...\n"
  # Extract VMware Tools
  tar xf $VMFILE
else
  printf "\n/vmware-tools-distrib already exists.\nPlease remove it before applying this patch.\n\n"
  exit
fi

# Record the current directory
PATCH_DIR=$PWD

printf "\nApplying patch to VMware-Tools...\n\n"
sleep 3
pushd vmware-tools-distrib/lib/modules/source

# Make a backup of vmhgfs.tar
cp vmhgfs.tar vmhgfs.tar.backup
# Extract vmhgfs.tar
tar xf vmhgfs.tar
# Go to extracted vmhgfs.tar
pushd vmhgfs-only/
# Apply patch
patch -p1 < $PATCH_DIR/vmtools.inode.c.patch
popd
# Remove old vmhgfs.tar
rm -rf vmhgfs.tar
# Repack new vmhgfs.tar
tar cf vmhgfs.tar vmhgfs-only
# Remove vmhgfs-only dir which is not needed
rm -rf vmhgfs-only
popd

printf "\nPatch Applied!\n"
printf "Now try to install VMware-Tools.\n\n"
vmtools.inode.c.patch文件内容:

--- ./inode.c	2013-02-26 02:18:24.000000000 +0000
+++ ./inode.c	2013-05-03 00:34:59.995053850 +0100
@@ -885,7 +885,8 @@
    ASSERT(inode);
 
    LOG(4, (KERN_DEBUG "VMware hgfs: HgfsTruncatePages: entered\n"));
-   result = compat_vmtruncate(inode, newSize);
+	 //result = compat_vmtruncate(inode, newSize);
+   result = 0; // Fix for kernels 3.8.x due to an error in truncate function
    if (result) {
       LOG(4, (KERN_DEBUG "VMware hgfs: HgfsTruncatePages: vmtruncate failed "
               "with error code %d\n", result));

转载于:https://my.oschina.net/wxf/blog/136637

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值