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

我怕爱的太早我们不能终老 提交于 2019-12-04 00:55:42

问题


I have VirtualBox 4.3.10 and Vagrant 1.4.3 installed on my Ubuntu 14.04 64 bit Desktop.

Earlier, worked with vagrant technology but this time, multiple issue. Let me describe what I have done

  1. clone private git to local system /opt/lampp/htdocs/{project} : done

  2. root@desktop:/opt/lampp/htdocs/{project}$ vagrant up

gives message on terminal while execution

GuestAdditions versions on your host (4.3.10) and guest (4.2.0) do not match.

command completed with below message

Failed to mount folders in Linux guest. This is usually beacuse the "vboxsf" file system is not available. Please verify that the guest additions are properly installed in the guest and can work properly. The command attempted was:

...

I understand this is version difference.

  1. check vagrant vbguest --status

    GuestAdditions 4.3.10 running --- OK.

  2. Open browser and run with http://192.168.0.33 (mentioned on README.md file of private git repo) but it didn't work.

UPDATE

  1. Installed vagrant-vbguest as suggested here

    $:sudo vagrant plugin install vagrant-vbguest

    Installed the plugin 'vagrant-vbguest (0.10.0)'!

By doing this,message of version difference of GuestAdditions described in 2. is gone

  1. restart vagrant halt and then vagrant up

Bringing machine 'default' up with 'virtualbox' provider...
[default] Clearing any previously set forwarded ports...
[default] Clearing any previously set network interfaces...
[default] Preparing network interfaces based on configuration...
[default] Forwarding ports...
[default] -- 22 => 2222 (adapter 1)
[default] -- 80 => 8080 (adapter 1)
[default] Booting VM...
[default] Waiting for machine to boot. This may take a few minutes...
[default] Machine booted and ready!
GuestAdditions 4.3.10 running --- OK.
[default] Configuring and enabling network interfaces...
[default] Mounting shared folders...
[default] -- /vagrant

Failed to mount folders in Linux guest. This is usually beacuse the "vboxsf" file system is not available. Please verify that the guest additions are properly installed in the guest and can work properly. The command attempted was:

    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

Do I need to change anything in local vagrantfile or change vagrant version or something else?

Some say it is a bug whilesome gives solution for ubuntu < 14.04

Kindly suggest the solution hints and how to fix this issue?


回答1:


 vagrant plugin install vagrant-vbguest

worked well for me (Virtual Box 5.0.22, Vagrant 1.8.4). It took muck longer to provision initially because the plugin downloaded gcc and a bunch of other tools before linking the guest additions .iso to the correct place.




回答2:


Apparently there is a bug in the VirtualBox Guest Additions 4.3.10 installer: https://www.virtualbox.org/ticket/12879

There seems to be a simple workaround to this, by creating a symbolic link within Vagrant-VM:

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

You could add this to your provisioning configuration to make sure you don't hit the bug again:

NEWEST_VBOXGUESTADDITIONS_DIR=`find /opt/ -maxdepth 1 -mindepth 1 -name "VBoxGuestAdditions-*" | tail -n 1`;
if [[ ! -d "/usr/lib/VBoxGuestAdditions" && -n "$NEWEST_VBOXGUESTADDITIONS_DIR" ]];
then
    ln -s ${NEWEST_VBOXGUESTADDITIONS_DIR}/lib/VBoxGuestAdditions /usr/lib/VBoxGuestAdditions
fi



回答3:


This line of code in "Vagrantfile" was the solution for me:

config.vm.synced_folder "./", "/vagrant", id: "vagrant-root", type: "nfs"



回答4:


In my case, this error was fixed by rebuilding the kernel on the guest machine with sudo service vboxadd setup.



来源:https://stackoverflow.com/questions/28494349/vagrant-failed-to-mount-folders-in-linux-guest-vboxsf-file-system-is-not-av

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!