Vagrant Error: Unable to Mount VirtualBox Shared Folders (Guest Additions, vboxsf)

前端 未结 11 1458
滥情空心
滥情空心 2021-01-31 08:32

The Issue

I installed Vagrant on Windows 10 so I can create a personal local development environment in a virtual machine. Everything I\'ve read about Vagrant said I c

11条回答
  •  温柔的废话
    2021-01-31 09:09

    Summary

    The problem with the synced/shared folders not working anymore all of a sudden is, that the VirtualBox Guest additions kernel module is not loaded.

    The problem is not directly connected to the VirtualBox version! It may have been the case in the past, but the following explanation covers about 95% of the occurences of this problem.


    Explanation

    This is mainly caused by an automatic update of the linux kernel, for example by having cronapt running in the virtual machine.

    If the kernel gets a new version, the dkms module for the guest additions can not be restarted after a reboot of the virtual machine. The service file /etc/init.d/virtualbox-guest-utils checks if there is a kernel module in

    /lib/modules/`uname -r`
    

    folder for vboxguest and vboxsf.

    Let the kernel version at initial setup of the guest additions be: 1.2.3

    The updated kernel has the version: 1.2.4

    uname -r would result in 1.2.4, while the dkms module was installed with the kernel version 1.2.3. This would cause the virtualbox guest addition service to abort execution and fail with an error message like modprobe xxxx failed.....

    Solution

    What we need to do is, install the headers of the kernel alongside with the new kernel version, so that the dkms module for the virtualbox guest additions can be automatically rebuilt with them.

    Fortunately there is a meta package, that lets us have the newest version of the kernel headers installed.

    It seems to be named differently in different linux flavours. Here is a small list of them.

    Debian

    sudo apt install linux-headers-amd64

    Ubuntu

    sudo apt install linux-headers-generic

    CentOS (untested)

    Thx to @Jayen Chondigara

    sudo yum -y install kernel-headers kernel-devel

提交回复
热议问题