So, you've gone and upgraded to or installed Ubuntu 8.04 Hardy Heron to a VMware virtual machine, but you find that the guest-host directory sharing doesn't work, amongst other things.
You've gone on to do the usual VMware tools install/upgrade via the VM->Install VMware Tools... feature in VMware Workstation, but you run into the following error when compiling the vmhgfs module:
Below paragraph is some technical info that most users can skip over:
make -C /lib/modules/2.6.24-19-generic/build/include/.. SUBDIRS=$PWD SRCROOT=$PWD/. modules
make: Entering directory `/usr/src/linux-headers-2.6.24-19-generic'
CC [M] /tmp/tmp/vmhgfs-only/backdoor.o
CC [M] /tmp/tmp/vmhgfs-only/backdoorGcc32.o
CC [M] /tmp/tmp/vmhgfs-only/bdhandler.o
CC [M] /tmp/tmp/vmhgfs-only/cpName.o
In file included from include/linux/string.h:11,
include/linux/types.h:40: error: conflicting types for ‘uintptr_t’
/tmp/tmp/vmhgfs-only/vm_basic_types.h:170: error: previous declaration of ‘uintptr_t’ was here
make: *** [/tmp/tmp/vmhgfs-only/cpName.o] Error 1
make: *** [_module_/tmp/tmp/vmhgfs-only] Error 2
make: Leaving directory `/usr/src/linux-headers-2.6.24-19-generic'
make: *** [vmhgfs.ko] Error 2
Well, it seems that VMware has not updated their tools to work well with Linux kernel 2.6.24, and the Linux kernel team threw in a definition of uintptr_t outside the usual place it's defined -- in stdint.h. This may mean that they determined that inclusion of stdint.h is not safe to include in kernel code.
Here are the steps to fixing this:
- Perform the VM->Install VMware Tools... action in VMware to get the VMware Tools virtual CD mounted in Ubuntu.
- Bring up a terminal window, existing user is fine (does not have to be root).
- Make sure build-essential package, and the patch package are installed using:
(I put them separately so you could more easily tell if one or the other failed)
sudo aptitude install build-essential
sudo aptitude install patch
- Change to a temporary directory:
- expand the VMware Tools:
tar zxvf /media/cdrom/VMwareTools-6.0.4-93057.tar.gz
- expand the vmhgfs source code also in the current temp directory using:
You should now have a directory called vmhgfs-only which was expanded from the vmhgfs.tar file.
tar xvf vmware-tools-distrib/lib/modules/source/vmhgfs.tar
- Now, download the patch file I have put together and attached to this post. This patch file fixes the vmhgfs module sources so they properly compile for kernel 2.6.24.
NOTE: This will only apply to the tools package included with Workstation 6.0.4 build 93057. YMMV with other VMware products and versions.
- Apply the patch file to the sources we just expanded. From the directory where vmhgfs-only resides, execute:
patch -p1 < /path/to/vmhgfs_6.0.4-93057__linux-2.6.24_fix.patch.txt
- Force remove the old vmhgfs.tar file from the extracted tools install files, as the permissions on this file are read-only.
rm -f vmware-tools-distrib/lib/modules/source/vmhgfs.tar
- Package the modified sources up back into a tar file, replacing the original removed vmhgfs.tar file in vmware-tools-distrib:
tar cvf vmware-tools-distrib/lib/modules/source/vmhgfs.tar vmhgfs-only
- Make the permissions of the vmhgfs.tar file the same as the original one -- which I see as being -r--r--r-- (444 octal) (this is optional)
chmod 444 vmware-tools-distrib/lib/modules/source/vmhgfs.tar
- Now all that is left to do is execute the VMware tools installer from the vmware-tools-distrib directory, just like you would normally when installing VMware tools. This time, however, the vmhgfs module should compile successfully when configuring.
NOTE: The patch file has been named with a .txt extension so that it will properly upload to the Ubuntu forums. This should have no effect on the way the patch file applies.