Take the 2-minute tour ×
Ask Different is a question and answer site for power users of Apple hardware and software. It's 100% free, no registration required.

When I use VMware Fusion with an Ubuntu guest (it worked long ago, but this problem has existed over several generations of ubuntu, at least including natty, oneiric and precise) and shared folders using vmhgfs, no matter what I do, many of my symlinks are broken.

The ones that are broken are symlinks that point to files in subdirectories, such as foo -> bar/blah. They're broken because they're presented to linux as foo->bar.

Anyone have any idea what's going wrong? This has, in the past worked for me, but it just doesn't now. It seems like a bug in vmhgfs.

Please don't suggest using NFS, SMB, etc. I'm specifically interested in getting HGFS working.

share|improve this question
    
Works for me using Ubuntu 10.04 LTS (lucid) with Fusion 4.1.2 on OS X 10.6.8 64 bit. (I wouldn't recommend using anything but an LTS version of Ubuntu with VMware.) How are you creating the symlinks? Have you tried re-installing the VMware tools? Can you give us one complete actual example? (In many cases the information left out in simplifying a real case to an example case is crucial to understanding the problem.) –  Old Pro May 5 '12 at 21:36
    
Yes, it did work long ago, and I've done all of the things you suggest many times, and I've also use open-vm tools and compiled everything myself. I can't use lucid, too old. My example is complete. Simply do the following: "mkdir bar; touch bar/blah; ln -s bar/blah foo". Then try to "cat foo"; you'll get a "foo is a directory" type error. –  Nathan Binkert May 7 '12 at 17:01

6 Answers 6

the following solution does not properly fit the original question, as it does not provide a solution to use symlinks in the host as symlinks within guests. nevertheless it can be useful in certain situations, specially for windows guests:

Adding ...

sharedFolderX.followSymlinks = "TRUE"

to your .vmx file, where X stands for any given shared folder in question, makes the symlink transparent to the guest. so the symlinks now show as a regular file or folder within the guest. the mapping take place in the host.

this works for the following versions and above

  • VMware ACE 2.0.x
  • VMware Fusion 2.x
  • VMware Player 2.x (Linux)
  • VMware Workstation 6.x (Linux)

as of Dec 24, 2013.

please refer to the VMware KB article Symbolic Links Do Not Work in Folders Shared Between Linux/Mac Hosts and Windows Guests (1007277) for more details and affected/supported versions.


---- edit by Martin (as comments not yet allowed).
---- credits also to Mike as he provided the link to the VMware KB in his answer.

share|improve this answer
    
Woah Martin - heck of an edit. I normally deny major overhauls like that since it's better to post a new answer, but couldn't find fault with your huge improvement. Welcome to Ask Different! –  bmike Jun 19 at 20:57

I worked around this by using NFS. However that this only gives read-only access.

(NFS server config adapted from http://www.behanna.org/osx/nfs/howto1.html)

On the host edit /etc/exports:

sudo vi /etc/exports

Add a line like the following (presuming your host network is using the 192.168.69.0 subnet, which is what vmware's NAT uses):

/Users -network 192.168.69.0 -mask 255.255.255.0

Enable nfsd:

sudo nfsd enable

Test your work:

showmount -e

On the Linux guest install the nfs client. On Ubuntu this is nfs-common:

sudo apt-get install nfs-common

Create a mount point, if it doesn't already exist:

sudo mkdir /mnt/host

Add the mount to fs-tab:

sudo nano /etc/fstab

Add a line like this to /etc/fsatb:

/192.168.69.1:/Users /mnt/host nfs _netdev,auto 0 0

Mount the share (it will be automatically mounted at next boot):

sudo mount -a
share|improve this answer

New solution: use old school NFS.

On the OS X host (I have Mountain Lion 10.8.2 as of this writing):

sudo vi /etc/exports

Add a line like

/Users/foo -mapall=foo:staff -network 172.16.241.0 -mask 255.255.255.0

where foo is your username. Note that this will mean that from the perspective of the guest mount all files on the host will be owned by you and have group "staff". Then

sudo nfsd enable
sudo nfsd start

On the Linux guest

sudo apt-get install nfs-common

Then add a line like this to /etc/fstab

172.16.241.1:/Users/foo /mnt/foo_nfs nfs auto,soft,intr,rsize=8192,wsize=8192,rw 0 0

then

sudo mkdir /mnt/foo_nfs
sudo mount /mnt/foo_nfs
share|improve this answer
    
I now see that glennr had a similar answer. However, my version gives read/write access. –  Marty Vona Feb 21 '13 at 22:34

Maybe this can help. http://kb.vmware.com/selfservice/microsites/search.do?language=en_US&cmd=displayKC&externalId=1007277

share|improve this answer

We're looking for long answers that provide some explanation and context. Don't just give a one-line answer; explain why your answer is right, ideally with citations. Answers that don't include explanations may be removed.

    
I know about that. The problem there is that symlinks don't show up in the guest as symlinks, but as the actual files where they came from. For windows, which doesn't really support symlinks, that makes sense. My guest is Linux and I want the symlinks to be symlinks. I have several symlinks that point to directories on the local machine, so I can, for example, keep linux binaries and mac binaries separate in my home directory. –  Nathan Binkert Apr 29 '12 at 16:32
    
Welcome to Ask Different and thanks for posting an answer Mike! Can you please summarize the contents of the link you posted? Link have a tendency to disappear over time, leaving an answer that is not relevant to those who may find your answer down the road. Thank you! –  daviesgeek May 23 '12 at 3:37

Confirmed works under Ubuntu 10.04 LTS and fails under Ubuntu 12.04 LTS:

root$> mkdir bar
root$> touch bar/blah
root$> ls -l bar
total 1
-rw-r--r-- 1 503 80 0 May  7 16:37 blah
root$> ln -s bar/blah foo
root$> ls -l foo
lrwxr-xr-x 1 503 80 8 May  7 16:30 foo -> bar/blah
root$> cat foo
cat: foo: Is a directory
root$> cd foo
root$> ls -l
total 1
drwxr-xr-x 1 503 80 102 May  7 17:02 blah

I suggest filing a bug report with VMware

share|improve this answer

I am working around this by using smb sharing instead of hgfs:

http://communities.vmware.com/message/2089295

sudo apt-get install smbfs
sudo mkdir /mnt/foo_smb
echo "username=foo" > /etc/samba/user # where foo is my username on the host.

Add this line to /etc/fstab

//172.16.241.1/foo /mnt/foo_smb cifs noauto,credentials=/etc/samba/user,rw,uid=bar 0 0

where bar is my username on the guest. Finally

sudo mount /mnt/foo_smb

on the guest.

UNFORTUNATELY, after upgrading to os x 10.8.2 recently, this stopped working. Apparrently apple has replaced their SMB server with something called SMBX.

http://comments.gmane.org/gmane.linux.kernel.cifs/3517

Attempting to mount with the fstab entry above now gives

mount error(22): Invalid argument
Refer to the mount.cifs(8) manual page (e.g. man mount.cifs)

This can be partially worked around by adding the extra options

iocharset=utf8,nounix,noserverinfo,sec=ntlmssp

but unfortunately the nounix option means that symlinks will not work.

Another option is to add something like

sharedFolder0.followSymlinks = "TRUE"

to the vmx file, but this means symlinks will look like regular files, not symlinks.

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

share|improve this answer

We're looking for long answers that provide some explanation and context. Don't just give a one-line answer; explain why your answer is right, ideally with citations. Answers that don't include explanations may be removed.

    
Welcome to Ask Different! Answers on Ask Different need to be more than just a link. It's okay to include a link, but please summarize or excerpt it in the answer. The idea is to make the answer stand alone. Please take a look at the FAQs for more info. Thanks. –  Nathan Greenstein Jul 29 '12 at 16:22
    
Yeah, that's what I've been using as well. –  Nathan Binkert Jul 29 '12 at 19:53

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.