[分享]XP下VMware模拟Ubuntu不能使用共享文件夹问题解决vmhgfs

Kvm、VMware、Virtualbox、Xen、Qemu 等
回复
头像
yang
帖子: 190
注册时间: 2007-10-18 19:57

[分享]XP下VMware模拟Ubuntu不能使用共享文件夹问题解决vmhgfs

#1

帖子 yang » 2008-01-18 20:47

目前XP下使用VMware workstation 6.0.2虚拟ubuntu后,即使安装了VMware Tools并设置了共享文件夹后,虽然可以看到/mnt/hgfs/但仍旧不能访问共享目录的解决方案。

问题:主要问题是在安装vmware tools时编译vmhgfs模块出错:

代码: 全选

/tmp/vmware-config0/vmhgfs-only/filesystem.c: In function ‘HgfsInitFileSystem’:
/tmp/vmware-config0/vmhgfs-only/filesystem.c:582: error: too few arguments to function ‘kmem_cache_create’
/tmp/vmware-config0/vmhgfs-only/filesystem.c:593: error: too few arguments to function ‘kmem_cache_create’
make[2]: *** [/tmp/vmware-config0/vmhgfs-only/filesystem.o] Error 1
make[1]: *** [_module_/tmp/vmware-config0/vmhgfs-only] Error 2
make[1]: Leaving directory `/usr/src/linux-headers-2.6.22-14-generic'
make: *** [vmhgfs.ko] Error 2
make: Leaving directory `/tmp/vmware-config0/vmhgfs-only'
Unable to build the vmhgfs module. 
解决:请将vmware tools的安装文件解压到用户目录下(~/vmware-tools-distrib)。
首先进入此目录:

代码: 全选

$ cd ~/vmware-tools-distrib
把将要更改的文件分离出来备份:

代码: 全选

$ mv lib/modules/source/vmhgfs.tar vmhgfs.tar.orig
解压缩此文件:

代码: 全选

$ tar -xvf vmhgfs.tar.orig
编辑文件解压后生成的vmhgfs-only目录中的compat_slab.h:

代码: 全选

$ vim vmhgfs-only/compat_slab.h
找到此行:

代码: 全选

if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 22) || defined(VMW_KMEMCR_HAS_DTOR)
更改为:

代码: 全选

if LINUX_VERSION_CODE <= KERNEL_VERSION(2, 6, 22) || defined(VMW_KMEMCR_HAS_DTOR)
就是把小于(<)改为小于等于(<=).

现在我们已基本完成了,仅需重新打包压缩更改的文件夹,并把它拷贝回去(lib/modules/source/vmhgfs.tar):

代码: 全选

tar -cvf lib/modules/source/vmhgfs.tar vmhgfs-only
将此vmhgfs.tar文件复制到ubuntu系统的vmware-tools中(/usr/lib/vmware-tools/modules/source/):

代码: 全选

$ sudo cp lib/modules/source/vmhgfs.tar /usr/lib/vmware-tools/modules/source/vmhgfs.tar
重新设置vmware tools:

代码: 全选

$ sudo vmware-config-tools.pl
一路按回车键。

来源
ACER TM3220 | XP Pro & Ubuntu Hardy --------
Intel M 740 1.73 Ghz | 14.1" WXGA TFT LCD 1280x800
ATI Mobility Radeon X700 PCI EX/64MB VRAM
80 GB HDD & 802.11 b/g wireless LAN
头像
mcmonk
帖子: 6
注册时间: 2008-11-11 21:55
来自: 武汉

Re: [分享]XP下VMware模拟Ubuntu不能使用共享文件夹问题解决vmhgfs

#2

帖子 mcmonk » 2008-11-11 23:39

可是我没有找到compat_slab.h这个文件
里面就只有
autoconf driver.c main.c vm_basic_asm_x86_64.h
buildNumber.h driver-config.h main.h vm_basic_asm_x86.h
compat_sched.h escBitvector.h Makefile vm_basic_defs.h
compat_version.h hgfsDevLinux.h Makefile.kernel vm_basic_types.h
cpName.c hgfs.h Makefile.normal vmware.h
cpName.h hgfsProto.h staticEscape.c vmware_pack_begin.h
cpNameInt.h hgfsUtil.c staticEscape.h vmware_pack_end.h
cpNameLinux.c hgfsUtil.h vm_assert.h vmware_pack_init.h
dev.c includeCheck.h vm_basic_asm.h
这些东西,就是没有你说的这个文件,该怎么办阿?
我已经重装Ubuntu好多次了,可惜每次都看不到共享了的文件夹
rna2008
帖子: 4
注册时间: 2008-12-07 0:27

Re: [分享]XP下VMware模拟Ubuntu不能使用共享文件夹问题解决vmhgfs

#3

帖子 rna2008 » 2008-12-12 12:48

同问啊,有没有人回答一下啊
不能加=号
出现E325: ATTENTION
Found a swap file by the name "vmhgfs-only/.compat_slab.h.swp"
owned by: layman dated: Sat Dec 6 01:03:00 2008
file name: ~layman/公共的/vmware-tools-distrib/vmhgfs-only/compat_slab.
h
modified: YES
user name: layman host name: layman-desktop
process ID: 6130
While opening file "vmhgfs-only/compat_slab.h"
dated: Tue Mar 4 09:45:55 2008

(1) Another program may be editing the same file.
If this is the case, be careful not to end up with two
different instances of the same file when making changes.
Quit, or continue with caution.

(2) An edit session for this file crashed.
If this is the case, use ":recover" or "vim -r vmhgfs-only/compat_slab.h"
to recover the changes (see ":help recovery").
If you did this already, delete the swap file "vmhgfs-only/.compat_slab.h.sw
p"
to avoid this message.
ilawp
帖子: 1
注册时间: 2008-12-18 11:58

Re: [分享]XP下VMware模拟Ubuntu不能使用共享文件夹问题解决vmhgfs

#4

帖子 ilawp » 2008-12-18 12:02

用资源管理器那个东西找到这个文件,改为可读写,然后打开,编辑。。。。
还是图形界面好,鼠标万岁。
问题是现在还看不到共享文件夹,刚学Ubuntu,感觉好痛苦
。用的是8.04,不知道应该怎么改
rna2008 写了:同问啊,有没有人回答一下啊
不能加=号
出现E325: ATTENTION
Found a swap file by the name "vmhgfs-only/.compat_slab.h.swp"
owned by: layman dated: Sat Dec 6 01:03:00 2008
file name: ~layman/公共的/vmware-tools-distrib/vmhgfs-only/compat_slab.
h
modified: YES
user name: layman host name: layman-desktop
process ID: 6130
While opening file "vmhgfs-only/compat_slab.h"
dated: Tue Mar 4 09:45:55 2008

(1) Another program may be editing the same file.
If this is the case, be careful not to end up with two
different instances of the same file when making changes.
Quit, or continue with caution.

(2) An edit session for this file crashed.
If this is the case, use ":recover" or "vim -r vmhgfs-only/compat_slab.h"
to recover the changes (see ":help recovery").
If you did this already, delete the swap file "vmhgfs-only/.compat_slab.h.sw
p"
to avoid this message.
头像
jiet
帖子: 37
注册时间: 2008-10-25 14:55
来自: 成都
联系:

Re: [分享]XP下VMware模拟Ubuntu不能使用共享文件夹问题解决vmhgfs

#6

帖子 jiet » 2009-04-09 15:20

老问题了啊,还是没解决
饭后百步走,活到九十九
头像
Jarson
帖子: 2371
注册时间: 2008-07-21 9:44
来自: 深圳
联系:

Re: [分享]XP下VMware模拟Ubuntu不能使用共享文件夹问题解决vmhgfs

#7

帖子 Jarson » 2009-04-09 16:23

关注下,LZ能否解释下
defined(VMW_KMEMCR_HAS_DTOR)
的意思,这个宏(常量?)定义的作用是?
if LINUX_VERSION_CODE <= KERNEL_VERSION(2, 6, 22) || defined(VMW_KMEMCR_HAS_DTOR)
这条语句的意思是?
头像
mxl800
帖子: 81
注册时间: 2009-04-13 9:11

Re: [分享]XP下VMware模拟Ubuntu不能使用共享文件夹问题解决vmhgfs

#8

帖子 mxl800 » 2009-04-14 16:56

可是我打开LZ说的文件,内容如下


#ifndef __COMPAT_SLAB_H__
# define __COMPAT_SLAB_H__


#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 2, 0)
# include <linux/slab.h>
#else
# include <linux/malloc.h>
#endif

/*
* Before 2.6.20, kmem_cache_t was the accepted way to refer to a kmem_cache
* structure. Prior to 2.6.15, this structure was called kmem_cache_s, and
* afterwards it was renamed to kmem_cache. Here we keep things simple and use
* the accepted typedef until it became deprecated, at which point we switch
* over to the kmem_cache name.
*/
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 20)
# define compat_kmem_cache struct kmem_cache
#else
# define compat_kmem_cache kmem_cache_t
#endif

#endif /* __COMPAT_SLAB_H__ */


没有楼主说的语句呀,怎么改??
火星无罪,提问有理!
sademperor
帖子: 3
注册时间: 2008-09-12 11:15

Re: [分享]XP下VMware模拟Ubuntu不能使用共享文件夹问题解决vmhgfs

#9

帖子 sademperor » 2009-04-15 16:17

同文,我的文件和ls内容易洋,vmware的版本是6.0.0的。按照lz所说的方法改后,依然不成功。
rnon
帖子: 11
注册时间: 2009-04-23 16:22

Re: [分享]XP下VMware模拟Ubuntu不能使用共享文件夹问题解决vmhgfs

#10

帖子 rnon » 2009-05-04 17:47

我的按你这样配置下来 还是不行哦 这个是为什么呢/
snowbest
帖子: 5
注册时间: 2009-05-04 20:42

Re: [分享]XP下VMware模拟Ubuntu不能使用共享文件夹问题解决vmhgfs

#11

帖子 snowbest » 2009-05-07 8:46

:em06 不可行

windows xp sp2
vmware6.5
ubuntu9.04
chinasunjh
帖子: 27
注册时间: 2009-03-10 21:46

Re: [分享]XP下VMware模拟Ubuntu不能使用共享文件夹问题解决vmhgfs

#12

帖子 chinasunjh » 2009-05-07 13:28

请参照如下主题测试一下:
viewtopic.php?f=65&t=199385
snowbest
帖子: 5
注册时间: 2009-05-04 20:42

Re: [分享]XP下VMware模拟Ubuntu不能使用共享文件夹问题解决vmhgfs

#13

帖子 snowbest » 2009-05-08 11:42

难道vmware-tools的版本不同?

12楼,我尝试过了,还是不行
chinasunjh
帖子: 27
注册时间: 2009-03-10 21:46

Re: [分享]XP下VMware模拟Ubuntu不能使用共享文件夹问题解决vmhgfs

#14

帖子 chinasunjh » 2009-05-09 16:56

snowbest 写了:难道vmware-tools的版本不同?

12楼,我尝试过了,还是不行
应该是版本的问题,我的是6.5版的,如果不行,尽可能按照错误描述打开相关文件,看看报错行,一般来讲都是与内核版本相关的语句部分,如有一定的C基础,可自行尝试修改,如没有经验,则只能等新版本出来了。
snowbest
帖子: 5
注册时间: 2009-05-04 20:42

Re: [分享]XP下VMware模拟Ubuntu不能使用共享文件夹问题解决vmhgfs

#15

帖子 snowbest » 2009-05-11 2:29

我也是6.5,不过是精简版的
ubuntu是9.04..
我是一点儿C基础都没有,能看懂,但是不知道怎么办
回复