Fixing the VMware Tools HGFS module under Linux

HGFS is an awesome little tool that lets you expose chosen folders on your Mac to a VM. This allows you to develop on your Mac and test content from your VM without having to first transfer files between your host system and the VM. Problem is the HGFS module in VMware Tools v9.9.2 that comes with the latest versions of VMware Fusion will not compile.

You’ll see the following errors:

make[1]: Entering directory `/usr/src/linux-headers-3.2.0-4-amd64'
 CC [M] /tmp/modconfig-7P0yca/vmhgfs-only/backdoor.o
 CC [M] /tmp/modconfig-7P0yca/vmhgfs-only/backdoorGcc64.o
 CC [M] /tmp/modconfig-7P0yca/vmhgfs-only/bdhandler.o
 CC [M] /tmp/modconfig-7P0yca/vmhgfs-only/cpName.o
 CC [M] /tmp/modconfig-7P0yca/vmhgfs-only/cpNameLinux.o
 CC [M] /tmp/modconfig-7P0yca/vmhgfs-only/cpNameLite.o
 CC [M] /tmp/modconfig-7P0yca/vmhgfs-only/dentry.o
 CC [M] /tmp/modconfig-7P0yca/vmhgfs-only/dir.o
 CC [M] /tmp/modconfig-7P0yca/vmhgfs-only/file.o
 CC [M] /tmp/modconfig-7P0yca/vmhgfs-only/filesystem.o
 CC [M] /tmp/modconfig-7P0yca/vmhgfs-only/fsutil.o
 CC [M] /tmp/modconfig-7P0yca/vmhgfs-only/hgfsBd.o
 CC [M] /tmp/modconfig-7P0yca/vmhgfs-only/hgfsEscape.o
 CC [M] /tmp/modconfig-7P0yca/vmhgfs-only/hgfsUtil.o
 CC [M] /tmp/modconfig-7P0yca/vmhgfs-only/inode.o
 /tmp/modconfig-7P0yca/vmhgfs-only/inode.c: In function ‘HgfsPermission’:
 /tmp/modconfig-7P0yca/vmhgfs-only/inode.c:1978:34: error: ‘struct dentry’ has no member named ‘d_alias’
 /tmp/modconfig-7P0yca/vmhgfs-only/inode.c:1978:34: warning: initialization from incompatible pointer type [enabled by default]
 /tmp/modconfig-7P0yca/vmhgfs-only/inode.c:1978:34: warning: (near initialization for ‘dentry’) [enabled by default]
 /tmp/modconfig-7P0yca/vmhgfs-only/inode.c:1978:34: error: ‘struct dentry’ has no member named ‘d_alias’
 make[4]: *** [/tmp/modconfig-7P0yca/vmhgfs-only/inode.o] Error 1
 make[3]: *** [_module_/tmp/modconfig-7P0yca/vmhgfs-only] Error 2
 make[2]: *** [sub-make] Error 2
 make[1]: *** [all] Error 2
 make[1]: Leaving directory `/usr/src/linux-headers-3.2.0-4-amd64'
 make: *** [vmhgfs.ko] Error 2
 make: Leaving directory `/tmp/modconfig-7P0yca/vmhgfs-only'

VMware are taking their sweet time fixing the problem, but there is a workaround. Follow the steps below.

Install vmware tools but don’t run when the question comes up. Then do the following:

  1. cd /usr/lib/vmware-tools/modules/source
  2. tar xf vmhgfs.tar
  3. rm vmhgfs.tar
  4. sed -i -e”s/d_alias/d_u.d_alias/” vmhgfs-only/inode.c
  5. tar cf vmhgfs.tar vmhgfs-only
  6. rm -rf vmhgfs-only

What you’re doing there is patching inode.c.  HGFS will then compile cleanly.

Update: This issue is now fixed in VMware Fusion 7.1.2. HGFS in this version complies cleanly without needing any modifications.

1 thought on “Fixing the VMware Tools HGFS module under Linux”

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top