VirtualBox

7 年 前 建立

3 年 前 結束

#17491 closed defect (fixed)

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

回報者: Jonas Almroth 負責人:
元件: shared folders 版本: VirtualBox 5.2.6
關鍵字: symlink, shared folder, mount error 副本:
Guest type: Linux Host type: Linux

描述

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.

更動歷史 (10)

comment:1 7 年 前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.

回覆:  1 ; comment:2 7 年 前Jonas Almroth 編輯

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 7 年 前Jonas Almroth 編輯

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 7 年 前Jonas Almroth 編輯

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

回覆:  2 ; comment:5 7 年 前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?

回覆:  5 comment:6 7 年 前Jonas Almroth 編輯

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 7 年 前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.

最後由 paulk 編輯於 7 年 前 (上一筆) (差異)

回覆:  7 comment:8 7 年 前Jonas Almroth 編輯

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 7 年 前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 3 年 前galitsyn 編輯

狀態: newclosed
處理結果: fixed

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

注意: 瀏覽 TracTickets 來幫助您使用待辦事項功能

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette