What to do when you can't mount a shared folder in VirtualBox

Hello.
I'm Mandai, the Wild team member in charge of development.

VirtualBox's shared folders are very convenient and I find them incredibly useful.
However, sometimes they suddenly stop mounting, and when that happens, I don't know what to do, so I end up using various other methods to transfer files.

I recently finally figured out the cause of the problem, so I thought I'd make a note of the solution.

When developing game APIs, the production environment is often Linux, so I'm using a Windows machine, but I'm still getting by by keeping a similar environment on my local machine using a VM.

As for the VM environment, we use VirtualBox, and the VM OS image is generally CentOS

 

Reinstall the tools from the Level 1 Guest Additions CD

This is the first thing that comes to mind

This is a slightly older article, but"VirtualBox Shared Folder Notes | dark_green's Diary | Slashdot," this often occurs when updating kernel modules using yum or similar tools.
Since it's a VM, maybe it's okay to handle it a bit more roughly?

In VirtualBox, selecting "Insert CD Image" from the "Devices" menu will automatically launch the installation tool.
If the CD is already mounted on your desktop, simply double-click the CD icon.

I know it may seem strange to say this after introducing this product, but if it can cure the problem, I wouldn't be so worried

 

Level 2 Reconfiguring shared folders

This is the solution that has been used in cases in the past where the problem has become visible

This can be configured in the VM settings within the VirtualBox Manager.
Alternatively, if you are viewing the VM's UI, click the folder icon in the bottom right corner.

If the directories on both the host and guest sides are set correctly, it may be possible to mount it

 

Level 3: Replace the mount.vboxsf symbolic link

Finally, the solution that worked this time was to change the destination of the mount.vboxsf symbolic link

What was happening was that the actual entity of mount.vboxsf, which is the mount command for creating a shared folder, was actually different

which mount.vboxsf /sbin/mount.vboxsf ls -al | grep vboxsf mount.vboxsf -> /usr/lib64/VBoxGuestAdditions/mount.vboxsf

This does not mean that the file does not exist; it does exist in the path /usr/lib64/VBoxGuestAdditions/mount.vboxsf

So, what to do about this is,

# cd /sbin sudo ln -sf /usr/lib/VBoxGuestAdditions/mount.vboxsf mount.vboxsf

Simply change the destination of the symbolic link to mount.vboxsf under VBoxGuestAdditions, which is also located under /usr/lib

If it is set to mount automatically, restart the VM and you will see that it is mounted properly using the df command

Since the OS is the 64-bit version of CentOS, /usr/lib64 should be fine, but it seems that's not the case.
I suspect this is due to the Guest Additions CD installer, but what do you think, Oracle?

This seems to have happened after I updated the kernel module

It seems that updating the VM kernel is risky in many ways

That's all

If you found this article helpful,please give it a "Like"!
3
Loading...
3 votes, average: 1.00 / 13
30,678
X Facebook Hatena Bookmark pocket

The person who wrote this article

About the author

Yoichi Bandai

My main job is developing web APIs for social games, but thankfully I'm also given the opportunity to work on various other tasks, including marketing.
My image rights within Beyond are treated as CC0.