Vagrant error : Failed to mount folders in Linux guest

后端 未结 21 2355
臣服心动
臣服心动 2020-11-27 08:46

I have some issues with Vagrant shared folders, my base system is Ubuntu 13.10 desktop.

I do not understand why I have this error is something that is not right conf

相关标签:
21条回答
  • 2020-11-27 09:23

    This is 2017. Just in case someone faces the same issue.

    For bento/centos-6.7, I was getting same error. That was solved by adding plugin vagrant-vbguest (0.13.0). c:> vagrant plugin install vagrant-vbguest

    Box url: http://opscode-vm-bento.s3.amazonaws.com/vagrant/virtualbox/opscode_centos-7.0_chef-provisionerless.box

    This centos-7 version was giving me same error

    Error:

    ==> build: Mounting shared folders...
        build: /vagrant => C:/projects/
    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 attempted was:
    
    mount -t vboxsf -o uid=1000,gid=1000 vagrant /vagrant
    
    The error output from the command was:
    
    /sbin/mount.vboxsf: mounting failed with the error: No such device
    

    My Configuration:

    C:\projects>vagrant -v
    Vagrant 1.9.1
    
    C:\projects> vboxmanage -v
    5.0.10r104061
    
    C:\projects>vagrant plugin list
    vagrant-cachier (1.2.1)
    vagrant-hostmanager (1.8.5)
    vagrant-hosts (2.8.0)
    vagrant-omnibus (1.5.0)
    vagrant-share (1.1.6, system)
    vagrant-vbguest (0.13.0)
    vagrant-vbox-snapshot (0.0.10)
    

    Since I already have vagrant-vbguest plugin, it tries to update the VBoxGuestAdditions in centos-7 when it sees different version of VBGuestAdditions are installed in Host 5.0.10 and guest 4.3.20.

    I even have checked that symbolic link exists.

    [root@build VBoxGuestAdditions]# ls -lrt /usr/lib
    lrwxrwxrwx.  1 root root   53 Jan 14 12:06 VBoxGuestAdditions -> /opt/VBoxGuestAdditions-5.0.10/lib/VBoxGuestAdditions
    [root@build VBoxGuestAdditions]# mount -t vboxsf -o uid=1000,gid=1000 vagrant /vagrant
    /sbin/mount.vboxsf: mounting failed with the error: No such device
    

    This did not work as suggested by user3006381

    vagrant ssh
    sudo yum -y install kernel-devel
    sudo yum -y update
    exit
    vagrant reload --provision
    

    Solution for centos-7: as given by psychok7 worked

    Diabled autoupdate. config.vbguest.auto_update = false Then vagrant destroy --force and vagrant up

    Result:

    javareport: Guest Additions Version: 4.3.20
    javareport: VirtualBox Version: 5.0
    ==> javareport: Setting hostname...
    ==> javareport: Configuring and enabling network interfaces...
    ==> javareport: Mounting shared folders...
    javareport: /vagrant => C:/projects
    
    C:\project>
    
    0 讨论(0)
  • 2020-11-27 09:24

    I found this issue addressed here vagrant issues. Two ways to do it:

    1. Run this on guest (i.e. after you ssh into vbox via vagrant ssh )

      sudo ln -s /opt/VBoxGuestAdditions-4.3.10/lib/VBoxGuestAdditions /usr/lib/VBoxGuestAdditions
      

      Then run vagrant reload to correctly mount the folders.

    2. As @klang pointed out, update the VBoxGuestAdditions.iso file on your mac:

      wget https://www.virtualbox.org/download/testcase/VBoxGuestAdditions_4.3.11-93070.iso‌​
      sudo cp VBoxGuestAdditions_4.3.11-93070.iso /Applications/VirtualBox.app/Contents/MacOS/VBoxGuestAdditions.iso
      

    UPDATE (16may2014)

    Since the iso is no longer available, you can use the 4.3.12 one (http://dlc.sun.com.edgesuite.net/virtualbox/4.3.12/VBoxGuestAdditions_4.3.12.iso)

    note : the binary vbox4.3.12 for os X is not available at this time

    0 讨论(0)
  • 2020-11-27 09:24

    As mentioned in Vagrant issue #3341 this was a Virtualbox bug #12879.

    It affects only VirtualBox 4.3.10 and was completely fixed in 4.3.12.

    0 讨论(0)
  • 2020-11-27 09:25

    The plugin vagrant-vbguest solved my problem:

    $ vagrant plugin install vagrant-vbguest
    

    Output:

    $ vagrant reload
    ==> default: Attempting graceful shutdown of VM...
    ...
    ==> default: Machine booted and ready!
    GuestAdditions 4.3.12 running --- OK.
    ==> default: Checking for guest additions in VM...
    ==> default: Configuring and enabling network interfaces...
    ==> default: Exporting NFS shared folders...
    ==> default: Preparing to edit /etc/exports. Administrator privileges will be required...
    ==> default: Mounting NFS shared folders...
    ==> default: VM already provisioned. Run `vagrant provision` or use `--provision` to force it
    

    Just make sure you are running the latest version of VirtualBox

    0 讨论(0)
  • 2020-11-27 09:26

    I experienced the same issue with Centos 7, I assume due to an outdated kernel in combination with an updated version of VirtualBox. Based on Blizz's update, this is what worked for me (vagrant-vbguest plugin already installed):

    vagrant ssh
    sudo yum -y install kernel-devel
    sudo yum -y update
    exit
    vagrant reload --provision
    
    0 讨论(0)
  • 2020-11-27 09:27

    Fix Step by step:

    If you not have vbguest plugin, install it:

    $ vagrant plugin install vagrant-vbguest
    

    Run Vagrant

    It is show a error.

    $ vagrant up
    

    Login on VM

    $ vagrant ssh
    

    Fix!

    In the guest (VM logged).

    $ sudo ln -s /opt/VBoxGuestAdditions-4.3.10/lib/VBoxGuestAdditions /usr/lib/VBoxGuestAdditions
    

    Back on the host, reload Vagrant

    $ vagrant reload
    
    0 讨论(0)
提交回复
热议问题