Linux – VirtualBox: mount a shared folder automatically in Gentoo

gentoolinux-kernelvagrantvirtualbox

I'm currently writing a template (in veewee) to build a vagrant box running Funtoo x86_64.
Currently, my box fails the last step for vagrant basebox validate, in which a shared folder has to be mounted automatically in the guest system.

What are the prerequisites for automounting of shared folders? I searched for it in the documentation for Gentoo and for VirtualBox, had a look at templates for Ubunto boxes – but still don't know how to replicate the automounting behavior of the default Ubuntu box.

I'm using genkernel with the gentoo-sources. The virtualbox-guest-additions are installed and the virtualbox daemon is started.

I'd love an answer containing these requirements (with some of my best guesses):

  • Kernel config (NFS v3/4, automounter, …?)
  • Userspace programs (do I need additional packages? which daemons in which runlevel?)
  • Directories and permissions (do I need a /media dir belonging to some user, do certain users like vagrant and root need a membership in the vboxguest group or a vboxsf group – which does not exist yet?)

but any kind of help would be great – even a single link or a hunch…

UPDATE: What I did so far…
I can mount shared folders manually, what I'm interested in is automatic mounting.

The VirtualBox website mentions a group vboxsf that should be created on installation of the additions – I don't see that group in /etc/group, I have vboxguest, though.

It also says that shared folders are mounted under /media with a prefix of sf_ (controllable by /VirtualBox/GuestAdd/SharedFolders/MountDir and /VirtualBox/GuestAdd/SharedFolders/MountPrefix). I don't have a /media directory either – and both properties were not set on my VM.

I created both the directory and the group and set the properties to their default values, but I'm still out of luck.

Best Answer

The state in the last paragraph is sufficient - add /media, add the group vboxsf and reboot (which I didn't when I tried this before).

Related Question