Vagrant error : Failed to mount folders in Linux guest
Asked Answered
O

22

284

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 configured ? Is a NFS issue or Virtualbox Guest Additions ? I have tried with different many boxes but the same issue.

Failed to mount folders in Linux guest. This is usually because
    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

Here is the complete process after vagrant up :

$ vagrant up
Bringing machine 'default' up with 'virtualbox' provider...
==> default: Importing base box 'u131032'...
==> default: Matching MAC address for NAT networking...
==> default: Setting the name of the VM: vagrant_default_1396020504136_46442
==> default: Clearing any previously set forwarded ports...
==> default: Clearing any previously set network interfaces...
==> default: Preparing network interfaces based on configuration...
    default: Adapter 1: nat
    default: Adapter 2: hostonly
==> default: Forwarding ports...
    default: 22 => 2222 (adapter 1)
==> default: Running 'pre-boot' VM customizations...
==> default: Booting VM...
==> default: Waiting for machine to boot. This may take a few minutes...
    default: SSH address: 127.0.0.1:2222
    default: SSH username: vagrant
    default: SSH auth method: private key
    default: Error: Connection timeout. Retrying...
    default: Error: Remote connection disconnect. Retrying...
    default: Error: Remote connection disconnect. Retrying...
    default: Error: Remote connection disconnect. Retrying...
    default: Error: Remote connection disconnect. Retrying...
    default: Error: Remote connection disconnect. Retrying...
    default: Error: Remote connection disconnect. Retrying...
    default: Error: Remote connection disconnect. Retrying...
    default: Error: Remote connection disconnect. Retrying...
    default: Error: Remote connection disconnect. Retrying...
    default: Error: Remote connection disconnect. Retrying...
    default: Error: Remote connection disconnect. Retrying...
    default: Error: Remote connection disconnect. Retrying...
==> default: Machine booted and ready!
GuestAdditions versions on your host (4.3.10) and guest (4.2.16) do not match.
 * Stopping VirtualBox Additions
   ...done.
Reading package lists...
Building dependency tree...
Reading state information...
The following packages were automatically installed and are no longer required:
  dkms libdrm-intel1 libdrm-nouveau2 libdrm-radeon1 libfontenc1
  libgl1-mesa-dri libglapi-mesa libice6 libllvm3.3 libpciaccess0 libpixman-1-0
  libsm6 libtxc-dxtn-s2tc0 libxaw7 libxcomposite1 libxdamage1 libxfixes3
  libxfont1 libxkbfile1 libxmu6 libxpm4 libxrandr2 libxrender1 libxt6
  x11-common x11-xkb-utils xfonts-base xfonts-encodings xfonts-utils
  xserver-common xserver-xorg-core
Use 'apt-get autoremove' to remove them.
The following packages will be REMOVED:
  virtualbox-guest-dkms* virtualbox-guest-utils* virtualbox-guest-x11*
0 upgraded, 0 newly installed, 3 to remove and 0 not upgraded.
After this operation, 11.1 MB disk space will be freed.
(Reading database ... 65615 files and directories currently installed.)
Removing virtualbox-guest-dkms ...

-------- Uninstall Beginning --------
Module:  virtualbox-guest
Version: 4.2.16
Kernel:  3.11.0-18-generic (i686)
-------------------------------------

Status: Before uninstall, this module version was ACTIVE on this kernel.

vboxguest.ko:
 - Uninstallation
   - Deleting from: /lib/modules/3.11.0-18-generic/updates/dkms/
 - Original module
   - No original module was found for this module on this kernel.
   - Use the dkms install command to reinstall any previous module version.


vboxsf.ko:
 - Uninstallation
   - Deleting from: /lib/modules/3.11.0-18-generic/updates/dkms/
 - Original module
   - No original module was found for this module on this kernel.
   - Use the dkms install command to reinstall any previous module version.


vboxvideo.ko:
 - Uninstallation
   - Deleting from: /lib/modules/3.11.0-18-generic/updates/dkms/
 - Original module
   - No original module was found for this module on this kernel.
   - Use the dkms install command to reinstall any previous module version.

depmod....

DKMS: uninstall completed.

------------------------------
Deleting module version: 4.2.16
completely from the DKMS tree.
------------------------------
Done.
Removing virtualbox-guest-x11 ...
Purging configuration files for virtualbox-guest-x11 ...
Removing virtualbox-guest-utils ...
Purging configuration files for virtualbox-guest-utils ...
Processing triggers for ureadahead ...
Processing triggers for man-db ...
Reading package lists...
Building dependency tree...
Reading state information...
dkms is already the newest version.
dkms set to manually installed.
linux-headers-3.11.0-18-generic is already the newest version.
linux-headers-3.11.0-18-generic set to manually installed.
The following packages were automatically installed and are no longer required:
  libdrm-intel1 libdrm-nouveau2 libdrm-radeon1 libfontenc1 libgl1-mesa-dri
  libglapi-mesa libice6 libllvm3.3 libpciaccess0 libpixman-1-0 libsm6
  libtxc-dxtn-s2tc0 libxaw7 libxcomposite1 libxdamage1 libxfixes3 libxfont1
  libxkbfile1 libxmu6 libxpm4 libxrandr2 libxrender1 libxt6 x11-common
  x11-xkb-utils xfonts-base xfonts-encodings xfonts-utils xserver-common
  xserver-xorg-core
Use 'apt-get autoremove' to remove them.
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
Copy iso file /usr/share/virtualbox/VBoxGuestAdditions.iso into the box /tmp/VBoxGuestAdditions.iso
mount: block device /tmp/VBoxGuestAdditions.iso is write-protected, mounting read-only
Installing Virtualbox Guest Additions 4.3.10 - guest version is 4.2.16
Verifying archive integrity... All good.
Uncompressing VirtualBox 4.3.10 Guest Additions for Linux............
VirtualBox Guest Additions installer
Copying additional installer modules ...
Installing additional modules ...
Removing existing VirtualBox DKMS kernel modules ...done.
Removing existing VirtualBox non-DKMS kernel modules ...done.
Building the VirtualBox Guest Additions kernel modules ...done.
Doing non-kernel setup of the Guest Additions ...done.
Starting the VirtualBox Guest Additions ...done.
Installing the Window System drivers
Could not find the X.Org or XFree86 Window System, skipping.
An error occurred during installation of VirtualBox Guest Additions 4.3.10. Some functionality may not work as intended.
In most cases it is OK that the "Window System drivers" installation failed.
==> default: Checking for guest additions in VM...
==> default: Setting hostname...
==> default: Configuring and enabling network interfaces...
==> default: Exporting NFS shared folders...
==> default: Preparing to edit /etc/exports. Administrator privileges will be required...
nfsd running
sudo: /usr/bin/exportfs: command not found
==> default: Mounting NFS shared folders...
==> default: Mounting shared folders...
    default: /vagrant => /home/me/Documents/Work/project/vagrant
Failed to mount folders in Linux guest. This is usually because
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

My Vagrantfile configuration is :

# -*- mode: ruby -*-
# vi: set ft=ruby :

# Vagrantfile API/syntax version. Don't touch unless you know what you're doing!
VAGRANTFILE_API_VERSION = "2"

personalization = File.expand_path("../Personalization", __FILE__)
load personalization

Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
  config.vm.box = $base_box
  config.vm.box_url = $base_box_url

  config.vm.hostname = $vhost + ".dev"

  config.hostsupdater.aliases = ["api." + $vhost + ".dev", "mysql." + $vhost + ".dev"]
  config.hostsupdater.remove_on_suspend = true

  # set auto_update to ture to check the correct 
  # additions version when booting the machine
  config.vbguest.auto_update = true
  config.vbguest.auto_reboot = true

  config.vm.network :private_network, ip: $ip

  config.vm.synced_folder "../", "/srv/www/vhosts/" + $vhost + ".dev", type: "nfs"

  config.vm.provider :virtualbox do |v|
    v.customize ["modifyvm", :id, "--memory", 2048]
    v.customize ["modifyvm", :id, "--cpus", "1"]
    v.customize ["modifyvm", :id, "--cpuexecutioncap", "100"]
    v.customize ["modifyvm", :id, "--ioapic", "off"]
    v.customize ["modifyvm", :id, "--natdnshostresolver1", "on"]
  end

  config.vm.provision "shell" do |s|
    s.path = "vagrant-bootstrap.sh"
    s.args = $vhost + " " + $mysql_password + " " + $application_database
  end
end

The Personalization file is :

# Name of the vhost to create
$vhost = "project"

# Use the Ubunut 32bit or 64bit
$base_box_url = "http://cloud-images.ubuntu.com/vagrant/saucy/current/saucy-server-cloudimg-i386-vagrant-disk1.box"

# VM IP
$ip = "192.168.7.7"

# Base box name
$base_box = "u131032"

# MySQL
$mysql_password = "admin"
$application_database = "project"

The following plugins are enabled in Vagrant:

$ vagrant plugin list
vagrant-hostsupdater (0.0.11)
vagrant-login (1.0.1, system)
vagrant-share (1.0.1, system)
vagrant-vbguest (0.10.0)
Olivia answered 28/3, 2014 at 15:46 Comment(2)
this issue also happened on me after i update virtual box 5.1.20. This kind make me worry every time i update my VM as this is not the first time :(Sankey
@Sankey you might turn off auto update of the guest additions with config.vbguest.auto_update = false in the VagrantfileNitrification
A
360

The plugin vagrant-vbguest GitHub RubyGems 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

Arianna answered 20/5, 2014 at 6:54 Comment(20)
I am using the vagrant-vbguest plugin, but this did not fix anything for me until I updated to VirtualBox-4.3.12-9.Selfsustaining
This is the only thing that fixed it for me. After I did this then the guests VboxAdditions updated, and matched my host. And all we fine without a hitch. I just have to maintain equal versions on both guest and host. Thanks for the pointer @AriannaPuppis
I started having this issue after installing the plugin. uninstalling it is not fixing the issue.Graffito
@Graffito make sure you are running the latest version of VirtualboxArianna
This solved my problem. I faced it when I've upgraded my Ubuntu 12.04 LTS to 14.04 LTS and reload the VM. After that my shared folders haven't been mounted properly. I use VBox 4.3.16, my guest used 4.2.0 version of GuestAdditions so it got upgraded after installing this plugin. After installing and upgrading GuestAdditions and reloading the VM, shared folders got mounted successfully. Thanks!Knowable
Make sure you have the latest VirtualBox and use vagrand-vbguest is the best advice.Oldline
jee I would have saved some 20 hours of googling , re-configuring etc. by issuing this very one one-liner ... Where is your "just buy me a beer button" ...Actinism
Beware, this plugin can cause an almost identical issue if you let it config.vbguest.auto_update = true (default) github.com/dotless-de/vagrant-vbguest/issues/141Latif
I should have read this answer sooner! I've been googling around for an answer to this issue and have come across this stackoverflow question but only read and tried the chosen answer. I moved on after it failed for me. Hours later and a second run in on this question here I read the next popular answer and sure enough it fixed it for me. Perhaps a year or so ago the current chosen answer was the correct one. However today with newer versions of Virtualbox and vagrant I believe this answer is much more relevant and should be given the green check mark instead.Logomachy
Solved the issue here! VirtualBox 5.0.14 and Vagrant 1.8.1 on 64-bit Arch Linux. Thanks!Owlet
I ran this and even though I got an error message, my problem was solved. While installing the Guest Additions, vagrant gave me the following message: An error occurred during installation of VirtualBox Guest Additions 5.0.14. Some functionality may not work as intended.Amati
Note: Some of the below answers state one has to manually symlink /opt/VBoxGuestAdditions to-<version> to /usr/lib/VBoxGuestAdditions. For me, in VBox v5.0.20 r106931 (June 2016) and Vagrant 1.7.4, Vagrant took care of figuring out that the VBox additions didn't match once I installed the vagrant-vbguest pluginBoyla
This was working for me, until I saw this warning message Installing Virtualbox Guest Additions 5.0.30 - guest version is 5.0.6. After this, vagrant up wasn't even finishing its job. So I had to uninstall the plugin with the command vagrant plugin uninstall vagrant-vbguest.Eleneeleni
Did not work for me in February 2017. Creating new post to request help. This has been a frustrating problem since 2013.Tabard
Worked for me on Valentine's Day 2017 ... :)Ankylosis
I follow this and there is still a problem with me cause I use Virtual Box version 5.1.16 while the host claim the virtual box version 5.0.32 :-ss So in order to use Vagrant right at the time, use virtual box 5.0.32Mcghee
surprise! updating VBox to latest version give me this error and bring me to this pageSankey
Worked for me in May/2017!Lavonna
Worked for me in June 2017.Shoshanashoshanna
Make sure disable or allow your firewall and antivirus software to allow network transaction I spent many hours to get this :)Tottering
F
231

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

Failsafe answered 28/3, 2014 at 21:51 Comment(18)
Thanks! For some reason, this is mentioned in too few places.Lachesis
You may just need to do vagrant reload afterwards to re-mount the shared foldersOddment
@Lachesis The reason it's not mentioned is probably because it should not be necessary, it's a bug, and will hopefully be fixed soon and therefore not need documentation. That said, I'm very disappointed that upgrading Vagrant/VirtualBox breaks things. Doesn't seem they are sticking to SemVer or regression testing is not sufficient.Apomorphine
Anyone know a way to include this as part of the VagrantFile so that it executes prior to mounting the drives?Truckle
@JasonAustin github.com/mitchellh/vagrant/issues/3341 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 .. after that, you have business as usual.Pentad
Just a heads up, this will work on your vbox machine, so vagrant ssh before you use it.Ethanol
Thank you very much @klang! This seems to be the best solution. @Failsafe should update his answer to your comment. Or maybe you should move it to another answer. Thanks again.Philippe
@JasonAustin: yes, install vagrant-vbguest plugin (this makes sure the guest additions and the host vbox versions are in sync), add snippet to Vagrant file to override and extend the default installer. See github.com/dotless-de/vagrant-vbguest and pastebin.com/7t8seM6m for what I did. I'm still experimenting with it, I keep having weird issues :-/Soukup
Using a Win 7 box with Vagrant 1.3.5 and VirtualBox 4.3.10, answer #1 did not work for me. I still got the unable to mount ... errorsRaglan
Under a linux host use sudo cp VBoxGuestAdditions_4.3.11-93070.iso /usr/share/virtualbox/VBoxGuestAdditions.iso. You will also have to set config.vbguest.auto_update = false in your Vagrantfile if you use the vagrant-vbguest plugin to avoid it repeating the update on every vagrant up.Twelve
The recommended fix is option one, as originally posted here. The URL to the ISO file in option two is no longer valid and throws a 404.Localism
This happens every time I start a new box. I have looked at this post hundreds of times. Thank you so much for this!Chou
IMO the vbguest plugin answer below is vastly superior to this approach.Gasoline
This info may be out of date. This worked: vagrant plugin install vagrant-vbguestFilippo
For those on Windows, if prompted for your username, do not include the domain.Kingcup
And when the file /usr/lib/VBoxGuestAddition does not exists??Bifocal
what about Works without Additions (for Mac OS X) in virtualbox.org/wiki/Guest_OSes - it is a bit confusingRickety
This answer is out of date people!Infarct
M
49

I arrived at this page whilst looking for the same error message. For me the cause was different: I had ran a yum update on the system that installed a new kernel. The guest additions where out of date so it couldn't load them.

I rebuilt them with

sudo /etc/init.d/vboxadd setup 

And a vagrant reload later my guest was up and running again.

I'm just adding it here in case someone else gets here the same way I did.

Edit (Per KCD's comment):
It is possible that you get an error saying:

The headers for the current running kernel were not found

This can be resolved by installing kernel-devel (yum install kernel-devel)

Micronesian answered 13/11, 2014 at 6:25 Comment(6)
Thanks. I forgot that I ran a yum update. I'm leaving this comment so that Future Austin will find it when this happens again.Unload
And I ran apt-get update in ubuntu, leaving a comment for future skift when this happens again :-)Catchy
Present and future Loïc just thanks you :) (forgot I ran a yum update too)Tundra
It may fail saying The headers for the current running kernel were not found and ask you to yum install kernel-devel which worksLatif
I faced the same issue by running 'yum update' . Now I fixed it with your command. Thank you.Aforethought
I also had to install gcc to get this to work. To sum up: 1) yum install kernel-devel-$(uname -r) and 2) yum install gcc; and finally, exit VM and do vagrant reload. This was on a Centos 7 Vagrant box (bento/centos-7.1)Boyla
D
29

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
Denaturalize answered 23/2, 2015 at 14:48 Comment(2)
I think that is the best and most transparent solutionKaylyn
This worked, but with Fedora 22 I had to vagrant ssh into the box and do sudo ln -s /etc/dnf/dnf.conf /etc/yum.conf, as Fedora switched from yum to dnf. With that, things ran to completion (I think!). Thanks @dadaso.Lucianaluciano
H
14

Update February 2016

This took me hours to solve independently. Yes, this problem does still exist with latest Vagrant and Virtual Box installs:

△  vagrant -v
Vagrant 1.8.1
△  vboxmanage -v
5.0.14r105127

The symptoms for me were messages something like:

Checking for guest additions in VM... The guest additions on this VM do not match the installed version of VirtualBox!

followed by a failure to mount NFS drives.

1). Install the vagrant-vbguest plugin.

Depending on version of Vagrant you are using, issue one of the following commands:

# For vagrant < 1.1.5
$ vagrant gem install vagrant-vbguest

# For vagrant 1.1.5+
$ vagrant plugin install vagrant-vbguest

Next, do vagrant halt, followed by vagrant up - chances are you still have issues.

2). ssh into your guest and setup a soft link to the correct version of Guest Additions (here, 5.0.14).

$ vagrant ssh

$ sudo ln -s /opt/VBoxGuestAdditions-5.0.14/lib/VBoxGuestAdditions /usr/lib/VBoxGuestAdditions
$ exit

$ vagrant reload

You should be all good. By default, the mounted drive on guest is at /vagrant

Final comment:

IF you still have problems related to mounting NFS drives, then here is a workaround that worked for me. I had a vagrantfile with config something like:

Simply remove the mount type information, and slim down the mount_options settings so they work universally. Vagrant will now automatically choose the best synced folder option for your environment.

Huntington answered 25/2, 2016 at 19:32 Comment(3)
Thanks for this... your vagrantfile config is missing, just before the final paragraph though - any chance you could add it back?Venesection
This still does not work for me. I downloaded a new Vagrant. vboxmanage already showed the version above. The soft link the OP recommends was already there.Leprose
Where is your Vagrantfile config? It's missing from your answer.Lobeline
S
12

Install the vagrant-vbguest plugin by running this command:

vagrant plugin install vagrant-vbguest
Selfpropelled answered 29/4, 2016 at 7:12 Comment(0)
F
6

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
Frogmouth answered 2/3, 2016 at 2:57 Comment(0)
B
5

For me, with VBoxGuestAdditions 5.1.20, the problem was that /sbin/mount.vboxsf pointed to the wrong location.

sudo ln -sf /opt/VBoxGuestAdditions-5.1.20/lib/VBoxGuestAdditions/mount.vboxsf /sbin/mount.vboxsf

fixed it for me

Bearnard answered 24/4, 2017 at 21:33 Comment(2)
I am not a Vagrant user, but I had this same issue on a Fedora Core guest running on a OSX Host. I think the problem is that the location of mount.vboxsf was changed, but the installer is symlinking to the old location.Comprehension
This is a confirmed bug in guest additions 5.1.20: virtualbox.org/ticket/16670Assamese
C
4

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.

Contemporize answered 13/4, 2014 at 12:10 Comment(5)
which is what I'm doing since they've taken down that download linkHornblende
Note that this bug was fixed in VirtualBox 4.3.12.Seymore
I have exactly same bug in VirtualBox 4.3.26Landgraviate
4.3.28 for me, and same problem.Braise
5.0.14r105127 for me and same issueDisenthrone
K
3

I believe this is the most updated answer now and it worked for me ( Guest Additions Version: 5.0.6, VirtualBox Version: 4.3.16, Ubuntu 14.04 LTS)

https://github.com/mitchellh/vagrant/issues/3341#issuecomment-144271026

Basically i says:

Simple and Quick Solution for Failed to mount folders in Linux guest issue.

Add the following line to your Homestead/Vagrantfile:

config.vbguest.auto_update = false
Your Homestead/Vagrantfile should looks like this:

/...

Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|

   # To avoid install and uninstall VBoxGuessAdditions during vagrant provisioning.
    config.vbguest.auto_update = false

.../
Save it and execute

$ vagrant destroy --force
$ vagrant up
Kuhn answered 29/10, 2015 at 18:19 Comment(2)
Might want to note that 'vagrant destroy' blows away your VM, with anything you have configured/installed inside it, unless I'm mistaken.Tungusic
This was the only and quickest solution for me. Was having issues on a "Ubuntu precise 64 VirtualBox" image from here. VirtualBox 5.1.2 and Vagrant 1.8.5 on Windows.Ultramontane
B
3

Just for future reference, this problem happened with me, using Vagrant 1.7.4 and VirtualBox 5.0.10 r104061, when I provisioned a shared folder in / and created a symbolic link to my home folder. Something like this:

/folder
~/folder -> /folder

Apparently, this operation is not allowed by Vagrant due to security purposes and throws the described error.

I solved it by provisioning the desired folder directly to my home directory, such as /home/vagrant/folder.

Bruxelles answered 4/12, 2015 at 17:59 Comment(2)
Thank you so much. This was my issue as well.Mellifluous
Correct, a shared folder in / is not allowed in my version of Vagrant either (1.8.1)Hin
B
2

In my case on a previously working Ubuntu 16.04 image, the error started after installing vagrant-vbguest for a different vagrant image, and then starting the Ubuntu VM. It upgraded the guest additions to 5.1.20, and since then the mounts started failing. Updated the box, apt update + upgrade and the same, vbguest would install the newer 5.1.20 version.

It was solved by manually running:

sudo apt-get update
sudo apt-get install virtualbox-guest-dkms 

And also disabling the: config.vbguest.auto_update = false for this VM (might not be necessary).

Bigoted answered 25/4, 2017 at 21:7 Comment(1)
Did have exactly the same problem. Ignore the warning about not matching versions of guest and host, and turn of auto update.Nitrification
P
1

(from my comment above)

Following the problem to it's roots: , specifically the part in the comments saying this:

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

After doing that, I have business as usual with all my virtual machines (and their current Vagrantfiles, of course)

When you have to do something in a freshly created virtual machine, to make it work, something is wrong.

Pentad answered 10/4, 2014 at 6:5 Comment(1)
In case you are on linux I guess you have to copy the file to /usr/share/virtualbox/VBoxGuestAdditions.iso. However I did not test it!Contemporize
O
1

In configuration where windows is a host, and linux is a guest I found solution of the same problem in other place.

So again, the error message was "Failed to mount folders in Linux guest. This is usually because the "vboxsf" file system is not available." (...)

This was caused because I have made mistake by doing symlink inside the guest system from /vagrant into /home/vagrant/vagrant. The point is, that the directory /vagrant is a normal linux directory that has a symlink (so all ok), but when booting up by "vagrant up", it tries to mount windows directory on that place, and windows directory cannot work as a symlink. Windows host does not support linux symlinks.

So what You can do then, is to ssh into guest, remove the symlink wherever You have it, and reload machine.

In my configuration it was: Vagrant 1.7.2, VBoxGuestAdditions 4.3.28 and VBox 4.3.28.

Omer answered 29/6, 2015 at 5:28 Comment(0)
D
1

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>
Divaricate answered 14/1, 2017 at 13:32 Comment(1)
It is 2017 for me and still having this error. Your fix looks promising. I will try and report back.Tabard
L
1

by now the mounting works on some machines (ubuntu) and some doesn't (centos 7) but installing the plugin solves it

vagrant plugin install vagrant-vbguest

without having to do anything else on top of that, just

vagrant reload
Lambent answered 16/7, 2018 at 17:37 Comment(0)
F
0

Your log complains about not finding exportfs: sudo: /usr/bin/exportfs: command not found

The exportfs makes local directories available for NFS clients to mount.

Failsafe answered 28/3, 2014 at 15:55 Comment(1)
I have fixed the issue concerning sudo: /usr/bin/exportfs: command not found by setting a symlink to real path using the command sudo ln -s /usr/sbin/exportfs /usr/bin/exportfs, however the error about Failed to mount folders in Linux guest persist even after this.Olivia
I
0

This seems to be due to an incompatibility with the vbguest vagrant plugin and the latest version(s) of vagrant. It is trying to update the guest additions and failing to do it completely/properly.

Ingathering answered 10/4, 2014 at 20:46 Comment(1)
From what I have seen, vagrant-vbguest is correctly updating the VM to that the latest (4.3.10) GuestAdditions - unfortunately the latest GuestAdditions has a bug for linux guests.Twelve
E
0

Try like it:

vagrant plugin install vagrant-vbguest

In Vagrantfile add:

config.vbguest.iso_path = "http://download.virtualbox.org/virtualbox/VERSION/VBoxGuestAdditions_VERSION.iso"
config.vbguest.auto_update = false
config.vbguest.installer_arguments = %w{--nox11 -- --force}

Run:

vagrant vbguest --do install -f -b

vagrant reload
Estrange answered 19/5, 2017 at 1:32 Comment(0)
E
0

I was running Vagrant with VirtualBox 5.1.X, and had to downgrade to VirtualBox 5.0.40, and install the vbguest plugin to solve this problem.

My steps were:

  • Uninstall VirtualBox 5.1.X
  • Install Vagrant 5.0.40
  • Reboot my machine
  • Run vagrant up for my vagrant. It'll fail.
  • Run vagrant plugin install vagrant-vbguest while my VM is running, to install the vagrant plugin. This manages syncing VirtualBox Guest versions between host and guest.
  • Run vagrant reload to reload my virtual machine
  • Magic!
Eberto answered 2/10, 2017 at 16:26 Comment(0)
K
0
vagrant plugin install vagrant-vbguest
vagrant destroy #clean rhel/yum repos
vagrant up

And on the config file:

config.vbguest.auto_update = false #important so that any changes to the base image don't affect on reload
Kitkitchen answered 29/1, 2021 at 16:42 Comment(0)
B
-1

One more step I had to complete after following the first suggestion that kenzie made was to run the mount commands listed in the error message with sudo from the Ubuntu command line [14.04 Server]. After that, everything was good to go!

Botts answered 14/5, 2014 at 18:0 Comment(1)
Instead one should run vagrant reload.Whitewing

© 2022 - 2024 — McMap. All rights reserved.