What to do when the VirtualBox shared folder cannot be mounted
table of contents
Hello.
I'm Mandai, in charge of Wild on the development team.
VirtualBox's shared folders are very convenient and I find them very useful.
However, one day I suddenly couldn't mount it, and I didn't know what to do at that time, so I ended up exchanging files in various other ways.
Recently, I finally found out the cause of this problem, so I would like to write down a method to deal with it.
When developing game APIs, the production environment is often Linux, so I use a Windows machine, but I still get by with a pattern of having a similar environment on hand with a VM.
Regarding the environment around the VM, I use VirtualBox, and the VM OS image is generally CentOS.
Reinstall tools from Level 1 Guest Additions CD
This is the first thing that comes to mind.
This is a slightly old article, but VirtualBox Shared Folder Memorandum | dark_green's diary | SLAD , this often occurs when updating the kernel module using yum etc.
Since it's a VM, can I handle it more roughly?
When you select "Insert CD Image" from "Device" in the VirtualBox menu, the installation tool will start automatically.
If the CD is already mounted on your desktop, just double-click the CD icon.
I don't think it's a good idea to introduce it and say this, but if it can be cured, I don't have to worry about it.
Level 2 Resetting the shared folder
There were cases in the past when this method became visible.
This can be configured from the VM settings in VirtualBox Manager.
Or, if you are viewing the VM UI, there is a folder icon in the bottom right corner, so click on it.
If the directories on both the host and guest sides are set correctly, it may be mounted.
Level 3 Replace the symbolic link of mount.vboxsf
Finally, the workaround that was recovered this time is to change the link destination of the mount.vboxsf symbolic link.
What happened was that the entity of mount.vboxsf, which is the mount command to create 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, but the file exists in the path /usr/lib64/VBoxGuestAdditions/mount.vboxsf.
So, what to do about this?
# cd /sbin sudo ln -sf /usr/lib/VBoxGuestAdditions/mount.vboxsf mount.vboxsf
Just change the direction of the symbolic link to mount.vboxsf under VBoxGuestAdditions, which is also under /usr/lib.
If it is set to automount, restart the VM and use the df command to see that it is properly mounted.
Since the OS is a 64-bit version of CentOS, /usr/lib64 would seem to be fine, but apparently it is not.
I think this may be due to a problem with the Guest Additions CD installer, but what do you think, Oracle-san?
This also seems to have happened after updating the kernel module.
After all, updating the VM kernel seems to have various risks.
That's it.