知识屋:更实用的电脑技术知识网站
所在位置:首页 > 操作系统 > linux

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

发布时间:2014-09-05 14:28:03作者:知识屋

解决在xubuntu13.04上安装vmhgfs失败,导致不能共享问题
 
问题描述:
安装vmware tools时,出现以下错误。
 
1
/tmp/modconfig-5e6o62/vmhgfs-only/inode.c:888:4: error: implicit declaration of function ‘vmtruncate’ [-Werror=implicit-function-declaration]
2
cc1: some warnings being treated as errors
3
make[2]: *** [/tmp/modconfig-5e6o62/vmhgfs-only/inode.o] Error 1
4
make[2]: *** Waiting for unfinished jobs....
5
make[1]: *** [_module_/tmp/modconfig-5e6o62/vmhgfs-only] Error 2
6
make[1]: Leaving directory `/usr/src/linux-headers-3.8.0-18-generic'
7
make: *** [vmhgfs.ko] Error 2
8
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文件内容:
 
01
#!/bin/bash
02
#
03
# Patch to fix VMware-Tools installation in kernel 3.8.x
04
# Working for Ubuntu 13.04 (Xubuntu and Kubuntu also)
05
#
06
 
07
# Get VMwareTools file (it should be in the default format VMwareTools-9.x.x...)
08
VMFILE=`ls | grep VMwareTools-9.*`
09
 
10
if [[ ! $VMFILE ]]
11
then
12
  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"
13
  exit
14
fi
15
 
16
# Check for vmware-tools-distrib folder
17
if [[ ! -d vmware-tools-distrib ]]
18
then
19
  printf "/nExtracting VMware-tools.../n"
20
  # Extract VMware Tools
21
  tar xf $VMFILE
22
else
23
  printf "/n/vmware-tools-distrib already exists./nPlease remove it before applying this patch./n/n"
24
  exit
25
fi
26
 
27
# Record the current directory
28
PATCH_DIR=$PWD
29
 
30
printf "/nApplying patch to VMware-Tools.../n/n"
31
sleep 3
32
pushd vmware-tools-distrib/lib/modules/source
33
 
34
# Make a backup of vmhgfs.tar
35
cp vmhgfs.tar vmhgfs.tar.backup
36
# Extract vmhgfs.tar
37
tar xf vmhgfs.tar
38
# Go to extracted vmhgfs.tar
39
pushd vmhgfs-only/
40
# Apply patch
41
patch -p1 < $PATCH_DIR/vmtools.inode.c.patch
42
popd
43
# Remove old vmhgfs.tar
44
rm -rf vmhgfs.tar
45
# Repack new vmhgfs.tar
46
tar cf vmhgfs.tar vmhgfs-only
47
# Remove vmhgfs-only dir which is not needed
48
rm -rf vmhgfs-only
49
popd
50
 
51
printf "/nPatch Applied!/n"
52
printf "Now try to install VMware-Tools./n/n"
vmtools.inode.c.patch文件内容:
01
--- ./inode.c   2013-02-26 02:18:24.000000000 +0000
02
+++ ./inode.c   2013-05-03 00:34:59.995053850 +0100
03
@@ -885,7 +885,8 @@
04
    ASSERT(inode);
05
  
06
    LOG(4, (KERN_DEBUG "VMware hgfs: HgfsTruncatePages: entered/n"));
07
-   result = compat_vmtruncate(inode, newSize);
08
+    //result = compat_vmtruncate(inode, newSize);
09
+   result = 0; // Fix for kernels 3.8.x due to an error in truncate function
10
    if (result) {
11
       LOG(4, (KERN_DEBUG "VMware hgfs: HgfsTruncatePages: vmtruncate failed "
12
               "with error code %d/n", result));
(免责声明:文章内容如涉及作品内容、版权和其它问题,请及时与我们联系,我们将在第一时间删除内容,文章内容仅供参考)
收藏
  • 人气文章
  • 最新文章
  • 下载排行榜
  • 热门排行榜