VirtualBox

Ticket #17491 (closed defect: fixed)

Opened 5 years ago

Last modified 4 weeks ago

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

Reported by: kl0ckren 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

comment:1 follow-up: ↓ 2 Changed 5 years ago by 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.

comment:2 in reply to: ↑ 1 ; follow-up: ↓ 5 Changed 5 years ago by kl0ckren

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 Changed 5 years ago by kl0ckren

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 Changed 5 years ago by kl0ckren

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

comment:5 in reply to: ↑ 2 ; follow-up: ↓ 6 Changed 5 years ago by 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?

comment:6 in reply to: ↑ 5 Changed 5 years ago by kl0ckren

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 follow-up: ↓ 8 Changed 5 years ago by 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.

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

comment:8 in reply to: ↑ 7 Changed 5 years ago by kl0ckren

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 Changed 5 years ago by socratis

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 Changed 4 weeks ago by galitsyn

  • Status changed from new to closed
  • Resolution set to fixed

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.

www.oracle.com
ContactPrivacy policyTerms of Use