Vagrant up fails to mount linked directory
There are times where a system update breaks your system. Perhaps some configuration gets overwritten or something that seems unrelated suddenly breaks. In this case my vagrant setup broke, the linked /vagrant directory couldn't be mounted anymore. After some searching on Google I found this issue on GitHub. The comment from lenciel gave the solution.
This is usually a result of the guest’s package manager upgrading the kernel without rebuilding the VirtualBox Guest Additions. Ran
sudo /etc/init.d/vboxadd setup
on the guest solved this problem for me.
What this command does is first remove and then install the kernel modules of VirtualBox. First I ran the command and then I ran the mount -a
command which fixed my problem. It turns out the virtual machine had some kernel updates, but the VirtualBox Guest Additions weren't updated afterwards.
Remembering to run the command isn't something I like doing, hence this blog post which will serve as an external memory. Luckily there is a vagrant plugin (vagrant-vbguest) that helps in making sure the guest additions are in sync with your host's VirtualBox version. It can also be used to reinstall the guest additions to the virtual machine. Perhaps it's still necessary to mount the linked directories again but vagrant vbguest
and mount -a
are certainly easier to remember.