How-To: vmware-tools hgfs module on Ubuntu Gutsy Gibbon (7.10)

1 minute read

At the moment, the vmware-tools provided with workstation 6.0.2 do not compile under Ubuntu Gutsy 7.10.

Only one module fails: vmhgfs. This module allow one to share a folder on the host with the guest.

This tutorial will show the few changes required in order to be able to compile this module, and therefore ease file sharing between the host and the guest.

The original error that one might get while compiling the tools will have the following:

CC [M] /tmp/vmware-config0/vmhgfs-only/filesystem.o
/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' 

In this tutorial, I will consider that the vmware-tools’s .tar.gz is already untarred in your home dir and that user can gain root credential with sudo.

First of all, you need to get in the working directory of vmware-tools:

  $ cd ~/vmware-tools-distrib

Then, we will back up the old vmhgfs.tar:

  $ mv lib/modules/source/vmhgfs.tar vmhgfs.tar.orig

Now, we untar vmhgfs.tar.orig:

  $ tar -xvf vmhgfs.tar.orig

Now edit vmhgfs-only/compat_slab.h:

  $ vim vmhgfs-only/compat_slab.h

and change:

  if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 22) || defined(VMW_KMEMCR_HAS_DTOR)

with

  if LINUX_VERSION_CODE <= KERNEL_VERSION(2, 6, 22) || defined(VMW_KMEMCR_HAS_DTOR)

Finally, re-tar vmhgfs-only directory in lib/modules/source/vmhgfs.tar:

  $ tar -cvf lib/modules/source/vmhgfs.tar vmhgfs-only

Then copy this new tar into /usr/lib/vmware-tools/modules/source/ :

  $ sudo cp lib/modules/source/vmhgfs.tar /usr/lib/vmware-tools/modules/source/vmhgfs.tar

That’s it, now you can re-run the tools config script:

  $ sudo vmware-config-tools.pl