Failed to mount folders in Linux guest, “vboxsf” file system is not available?

September 20, 2016

Vagrant is one of the preferred tools of my developer colleagues. Previously I wrote about exporting & importing Vagrant boxes.

Today one of my colleagues pinged me regarding a broken Vagrant box where it was not possible to share folders between guest & host machine. We’re using Vagrant with VirtualBox and the VirtualBox Guest Additions makes it easy to share folders.

The error that Vagrant displayed was pretty obvious about the issue with Guest Additions.

Vagrant was unable to mount VirtualBox shared folders. This is usually because the filesystem "vboxsf" is not available. This filesystem is made available via the VirtualBox Guest Additions and kernel module. Please verify that these guest additions are properly installed in the guest. This is not a bug in Vagrant and is usually caused by a faulty Vagrant box. For context, the command attemped was:

set -e mount -t vboxsf -o uid=`id -u vagrant`,gid=`getent group vagrant | cut -d: -f3` vagrant /vagrant mount -t vboxsf -o uid=`id -u vagrant`,gid=`id -g vagrant` vagrant /vagrant

The error output from the command was:

No such file or directory

It happened that the version of Guest Additions and that of VirtualBox were different. An upgrade would surely solve the issue. A much quicker solution is to have the “vagrant-vbguest” plugin take care of keeping VirtualBox Guest Additions updated.

$ vagrant plugin install vagrant-vbguest

That’s it! Next time you vagrant up it does a check on the VirtualBox Guest Additions and updates accordingly.