VirtualBox

Opened 6 years ago

Closed 21 months ago

#17491 closed defect (fixed)

VirtualBox 5.2.6: Can't mount shared folder on Linux guest if shared folder is a symlink

Reported by: Jonas Almroth Owned by:
Component: shared folders Version: VirtualBox 5.2.6
Keywords: symlink, shared folder, mount error Cc:
Guest type: Linux Host type: Linux

Description

We have provisioning scripts for the VM:s on an NFS share, and create symlinks to folders on this share that we use as shared folders.

This used to work before upgrading VirtualBox from the very stable version 5.0.32. After upgrading to VirtualBox 5.2.x, mounting stopped working on Linux guests but still work great on Windows guests.

We tried Guest Additions 5.0.40, 5.1.30 and all 5.2.x versions with the same result:

$ sudo mkdir -p /mnt/shared

$ sudo mount.vboxsf shared /mnt/shared

mount.vboxsf: mounting failed with the error: Invalid argument

When instead creating a local folder, the same commands execute without error.

Change History (10)

comment:1 by Socratis, 6 years ago

From the User Manual, ch. 4.3 Shared folders:

Shared folders must physically reside on the host

and this has been a requirement for a long, long time. Not sure why it was working.

in reply to:  1 ; comment:2 by Jonas Almroth, 6 years ago

Replying to socratis:

From the User Manual, ch. 4.3 Shared folders:

Shared folders must physically reside on the host

and this has been a requirement for a long, long time. Not sure why it was working.

Thank you for pointing this out.

It does not work even if the symlink points to a local folder, though.

The very same manual page also states:

"Starting with version 4.0, VirtualBox shared folders also support symbolic links (symlinks)"

comment:3 by Jonas Almroth, 6 years ago

After issuing this command and restarting the machine, it still doesn't work on Linux guests.

VBoxManage setextradata "MyCoolVM" VBoxInternal2/SharedFoldersEnableSymlinksCreate/MyCoolShare 1

comment:4 by Jonas Almroth, 6 years ago

Bind mounting the NFS share works, so why shouldn't symlinks work as well?

On the host:

$ sudo mount --bind /path/to/nfs/share /home/vmadmin/shared

Now this works in guest:

# mount.vboxsf shared /mnt/shared

in reply to:  2 ; comment:5 by Socratis, 6 years ago

Replying to kl0ckren:

"Starting with version 4.0, VirtualBox shared folders also support symbolic links (symlinks)"

I assume it means local symlinks, not NFS ones. Did you try with a local link?

in reply to:  5 comment:6 by Jonas Almroth, 6 years ago

Replying to socratis:

Replying to kl0ckren:

"Starting with version 4.0, VirtualBox shared folders also support symbolic links (symlinks)"

I assume it means local symlinks, not NFS ones. Did you try with a local link?

Yes, I did try with local symlinks. Works with Windows guests, not Linux guests.

comment:7 by paulk, 6 years ago

The current default is to have the host show symlinks rather than resolve them. To get the behavior you want, create /etc/modprobe.d/vboxsf.conf on the guest.

Put one line in that file exactly like this:

options vboxsf follow_symlinks=1

Then reboot the guest.

Last edited 6 years ago by paulk (previous) (diff)

in reply to:  7 comment:8 by Jonas Almroth, 6 years ago

Replying to paulk:

The current default is to have the host show symlinks rather than resolve them. To get the behavior you want, create /etc/modprobe.d/vboxsf.conf on the guest.

Put one line in that file exactly like this:

options vboxsf follow_symlinks=1

Then reboot the guest.

Thank you very much, it does work this way!

However, is there any reason why the default behaviour was changed (on Linux)? Can I make a request to change it back? With ~10,000 VM:s of different Linux flavours dating back to 2009 running on ~500 servers in our labs/test rig, I can't really apply any other changes than installing new versions of Guest Additions :/

comment:9 by Socratis, 6 years ago

Can I make a request to change it back?

What if a bug was fixed? A security patch was issued? Would you still want the behavior reverted?

With ~10,000 VM:s of different Linux flavours dating back to 2009 running on ~500 servers in our labs/test rig, I can't really apply any other changes than installing new versions of Guest Additions

Well, if I had 10000 VMs running on 500 servers, first of all I would get a support contract. This is not a personal use anymore AFAICT. But, besides that, I would definitely stick with what works and keep the update on hold until I figured 100% what's going on.

comment:10 by galitsyn, 21 months ago

Resolution: fixed
Status: newclosed

Thank you for reporting the issue. It should be fixed in VirtualBox 6.1.36. Please refer to https://www.virtualbox.org/wiki/Downloads page.

Note: See TracTickets for help on using tickets.

© 2023 Oracle
ContactPrivacy policyTerms of Use