21

I just installed Ubuntu 13.04 inside of VMware Fusion Pro 5. I have the virtual machine configured for read-only sharing of my home directory, but there's no /mnt/hgfs directory and there's no /etc/fstab line.

What can I do to mount my Mac home directory inside of the Ubuntu VM?

2
  • Have you tried running sudo vmware-config-tools? Have you tried to reinstall the guest additions?
    – Bob
    Apr 27, 2013 at 3:25
  • I can't believe this is still an issue in 2023.
    – Joe
    Aug 18, 2023 at 17:27

7 Answers 7

22
sudo mkdir /mnt/hgfs

Use the above command first, followed by the following:

sudo /usr/bin/vmhgfs-fuse .host:/ /mnt/hgfs -o subtype=vmhgfs-fuse,allow_other

I am using macOS and VMware Fusion with Ubuntu 18.x.

3
  • 1
    Worked for me on VM Workstation Player 15 running Guest OS : Ubuntu 18.04 and Host OS : Windows 10
    – Vinay
    Mar 3, 2020 at 8:40
  • Works on Kali too. Not permanent though. You need to mount on every restart. What makes it less annoying in Fusion is that you can just copy and paste files between host and guest, something you can't do in VirtualBox and therefore shared folders is a must.
    – DimiDak
    May 6, 2021 at 19:18
  • This still required in VMWare Fusion Professional Version 12.2.5 (20904517) 2023
    – Joe
    Aug 18, 2023 at 17:29
27

For some reason, the auto-installed VMWare tools didn't do the job, but Ubuntu has a tool called vmware-hgfsmounter, if I installed it then I could do this:

sudo apt-get install open-vm-tools
sudo mkdir /mnt/hgfs
sudo mount -t vmhgfs .host:/ /mnt/hgfs

After running these commands, /mnt/hgfs should now contain your shares.

3
  • 16
    It gives me error: cannot mount filesystem: No such device Aug 30, 2014 at 8:03
  • 2
    Note: I only had to do the first line, accept all the defaults and reboot. Then it worked. (I already had vmware tools installed and shared folders was working until I updated 12.04 LTS yesterday). Nov 19, 2014 at 17:52
  • sadly did not work on ubuntu 19 - but the suggestion to use vmgfs-fuse in laktak's answer did work (sudo /usr/bin/vmhgfs-fuse .host:/ /mnt/hgfs -o subtype=vmhgfs-fuse,allow_other)
    – Goblinhack
    Aug 24, 2019 at 21:50
12

For Ubuntu 16.04 I had to use vmhgfs-fuse, see https://github.com/vmware/open-vm-tools/issues/199#issuecomment-335525133:

This impacts the Shared Folders client as we have switched from a kernel mode component to a FUSE file system component to provide the Shared Folders file system.

This results in a new mount command to be used for creating the shared file system. For Linux kernel versions we use the FUSE file system which will now mean you should be using the following command:

sudo /usr/bin/vmhgfs-fuse .host:/ /mnt/hgfs -o subtype=vmhgfs-fuse,allow_other
1
  • 2
    This worked for me on Ubuntu 18! If relevant I'm on a Mac Mojave Host and VMware Fusion Version 11.0.3 May 22, 2019 at 15:49
3

I was having the same problem, not being able to mount hgfs at all. I tried re-installing vmware-tools, then I tried installing vm-open-vm-tools and still no joy. I did notice that when I tried install open-vm-tools and reinstalling vm-ware-tools via vmware-install.pl, I got a failure notice for invalid gcc headers path. You can try this by installing vmware-tools without the -d switch for defaults. You will see the notice for the invalid path. I install headers with apt-get, you may or may not need to create a link to version.h. If version.h exists in /usr/src/linux-headers-$(uname -r)/include/linux/, skip that step.

sudo apt-get install gcc make linux-headers-$(uname -r)

sudo ln -s /usr/src/linux-headers-$(uname -r)/include/generated/uapi/linux/version.h /usr/src/linux-headers-$(uname -r)/include/linux/

Installed the headers, I uninstalled open-vm-tools and reinstalled vmware tools using vmware-install.pl. This time hgfs was mounted correctly and my shared folder is there as well. Re-booted and it is still there.

2

I came across this question without realising that vmwaretools was actually failing to compile properly when I installed it. It seems to finish normally but actually has error messages, part of which look a little like this:

make[2]: *** [/tmp/modconfig-TRYAHr/vmhgfs-only/inode.o] Error 1
make[2]: *** Waiting for unfinished jobs....
make[1]: *** [_module_/tmp/modconfig-TRYAHr/vmhgfs-only] Error 2
make[1]: Leaving directory `/usr/src/linux-headers-3.16.0-38-generic'
make: *** [vmhgfs.ko] Error 2
make: Leaving directory `/tmp/modconfig-TRYAHr/vmhgfs-only'

The solution I discovered is that vmware tools needs to be patched before it will compile successfully. This amazing repo has the answers:

https://github.com/rasa/vmware-tools-patches

1
  • The git-repo is really amazing, thanks for the hint!
    – Danny Lo
    Jun 18, 2015 at 18:34
1

After upgrading a VM from Kubuntu 12.10 to 13.04 I hit the same problem using VMware Fusion 5.0.3 on OS X 10.8.3. Reinstalling VMware tools rebooting did not help. Some issue between the VMware drivers and the new kernel I guess (my new kernel version is Linux ubuntu 3.8.0-19-generic). I was able to access the shares using open-vm-tools as described in an answer by the OP but his last line has a typo and should read

sudo mount -t vmhgfs .host:/ /mnt/hgfs
1
  • 1
    Thanks, I edited my last line to fix the typo. Note that Stack Overflow allows you to edit people's answers to fix these types of problems. May 8, 2013 at 16:47
0

You can also edit the files directly to fix this issue. This is a bit of a pain, but the commands follow.

vmhgfs

cd /vmware-tools-distrib/lib/modules/source
tar xf vmhgfs.tar
cd vmhgfs-only/

Open and edit inode.c. Edit line 888, change

result = compat_vmtruncate(inode, newSize);

to

result = 0;

Then save the file and exit the editor. Finally, tar it back up:

cd ..
rm -rf vmhgfs.tar
tar cf vmhgfs.tar vmhgfs-only/
rm -rf vmhgfs-only/

vmci

cd ./lib/modules/source
tar -xvf vmci.tar.

Open and edit ./vmci-only/linux/driver.c.

Edit line 127, change

.remove = __devexit_p(vmci_remove_device),

to

.remove = vmci_remove_device,

Edit line 1753, change

static init __devinit vmci_probe_device(struct pci_dev *pdev, const struct pci_device_id *id) 

to

static int vmci_probe_device(struct pci_dev *pdev, const struct pci_device_id *id)

Edit line 1981, change

static void __devexit vmci_remove_device(struct pci_dev* pdev)

to

static void vmci_remove_device(struct pci_dev* pdev)

Close and save ./vmci-only/linux/driver.c. Then tar the files back up.

tar -cf vmci.tar vmci-only

Now you can run ./vmware-install.pl and it should successfully install HGFS.

I needed to fix both of these broken modules to get HGFS working. Other sites report just needing to fix the vmhgfs module.

Sources:

HGFS: https://answers.launchpad.net/ubuntu/+question/227866

VMCI: http://kb.vmware.com/selfservice/microsites/search.do?language=en_US&cmd=displayKC&externalId=2050666

1
  • As an FYI, this worked to get the /mnt/hgfs folder mounted, reading and writing. However I am getting segfaults when running commands like python setup.py develop (as an example,) so this is not a working solution. Note that I get the segfaults with open-vm-tools answer as well as the modified files per my answer. So something else is broken. I am going to open a new question on this topic soon. May 10, 2013 at 22:41

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .