Vagrant: Vagrant error when mount synced folder

Created on 30 Dec 2015  ยท  21Comments  ยท  Source: hashicorp/vagrant

Hi when i write vagrant up i got this error:

==> default: Mounting shared folders...
    default: /var/www => /home/user/vagrant/www

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` var_www /var/www
mount -t vboxsf -o uid=`id -u vagrant`,gid=`id -g vagrant` var_www /var/www

The error output from the last command was:

mount: unknown filesystem type 'vboxsf'

Here it is my Vagrantfile:

VAGRANTFILE_API_VERSION = "2"

Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|

  config.vm.box = "centos/7"

  config.vm.provider "virtualbox" do |v|
    v.name = "lisi4ok"
  end

  config.vm.network "private_network", ip: "192.168.33.22"

  config.vm.synced_folder "./www", "/var/www"

  config.vm.provision "shell", name: "provision", path: "provision.sh"

end

Here it is the screen:

http://i.imgur.com/Zt5zrGt.png

P.s. the machine is running but my provision scripts are not applied.

waiting-reply

Most helpful comment

You can also install the vagrant-vbguest plugin so it adds the VirtualBox Guest Additions for you.

vagrant plugin install vagrant-vbguest
vagrant destroy && vagrant up

And that works for me.

All 21 comments

I get the same error, here is my environment.
Host: OSX 10.11.2
Guest: ubuntu/trusty64
VirtualBox and extension pack: v5.0.12 r104815
vagrant: 1.8.1

@lisi4ok, @sevengo8378 How did you solve the problem?

We didin`t :)

@sethvargo Same error here with vagrant-1.8.1-1.fc23.noarch. Version vagrant-1.7.4-2.fc23.noarch was working fine.

@Revisor, @lisi4ok as a workaround I would suggest to add nfs: true. For example: config.vm.synced_folder '/home', '/home/vagrant', nfs: true

I'm getting the same issue. Setting "nfs: true" didn't work either.

Edit: I should have read the following:

==> default: Checking for guest additions in VM...
default: No guest additions were detected on the base box for this VM! Guest
default: additions are required for forwarded ports, shared folders, host only
default: networking, and more. If SSH fails on this machine, please install
default: the guest additions and repackage the box to continue.

To repeat: Guest Additions are needed for shared folders

At the very least, I think https://www.vagrantup.com/docs/synced-folders/virtualbox.html should be updated to note that it's not going to work out of the box.

Hi @alfiedotwtf

The Vagrant documentation for building boxes requires the base box install the virtualbox guest additions, so it _should_ work just fine out of the box. Perhaps you are using a third-party box that did not properly install the guest additions? What version of Virtualbox are you using?

I'm on 1.6.5, from Debian Jessie non-free. The box I'm using is Hashicorp's debian/jessie64. Should I be using a different guest?

btw: thanks for helping out!

Hi @alfiedotwtf

The latest version of Vagrant is 1.8.1 and is available from https://www.vagrantup.com/downloads.html. We do not recommend using the os packages because they are typically very out and contain and outdated version of Vagrant. Can you please try upgrading to Vagrant 1.8 and see if the issue persists?

Thanks @sethvargo. Will try it out on the weekend and get back to you.

Getting same here with debian/jessie64
vagrant --version
Vagrant 1.8.1

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` var_application /var/application
mount -t vboxsf -o uid=`id -u vagrant`,gid=`id -g vagrant` var_application /var/application

The error output from the last command was:

stdin: is not a tty
mount: unknown filesystem type 'vboxsf'

[FIXED]

@sethvargo pulling from upstream didn't fix the issue.

It looks like the issue was actually the guest and not the host. I was using "debian/jessie64" which didn't work with shared folders as the image did not include vboxsf. Switching to "debian/contrib-jessie64" fixed the issue (it seems obvious now):

debian/contrib-jessie64 - Vanilla Debian 8 "Jessie" build with contrib vboxsf kernel module

This issue happen because vagrant box does not have VirtualBox Guest Additions installed. Just follow documentation here https://www.vagrantup.com/docs/virtualbox/boxes.html works for me.

I'm using vagrant box debian/jessie64.

sudo su -
apt-get install linux-headers-$(uname -r) build-essential dkms
wget http://download.virtualbox.org/virtualbox/4.3.8/VBoxGuestAdditions_4.3.8.iso
mkdir /media/VBoxGuestAdditions
mount -o loop,ro VBoxGuestAdditions_4.3.8.iso /media/VBoxGuestAdditions
sh /media/VBoxGuestAdditions/VBoxLinuxAdditions.run
rm VBoxGuestAdditions_4.3.8.iso
sudo umount /media/VBoxGuestAdditions
sudo rmdir /media/VBoxGuestAdditions

The documentation uses VBoxGuestAdditions_4.3.8 but the version depends on the version of your VirtualBox, mine is 4.3.36, so I changed it into VBoxGuestAdditions_4.3.36. Hope this help.

You can also install the vagrant-vbguest plugin so it adds the VirtualBox Guest Additions for you.

vagrant plugin install vagrant-vbguest
vagrant destroy && vagrant up

And that works for me.

@luvejo Thank you!!

I had the same problem when updated virtual machine to 5.1.20 and installed new VBoxGuestAdditions_5.1.20
The /sbin/mount.vboxsf became unavailable because
mount.vboxsf -> /opt/VBoxGuestAdditions-5.1.20/other/mount.vboxsf
/opt/VBoxGuestAdditions-5.1.20/other/mount.vboxsf -- Does not exist

I fix it:
ln -sf /usr/lib/VBoxGuestAdditions/mount.vboxsf /sbin/mount.vboxsf

I think it would be fixed in new releases https://www.virtualbox.org/ticket/16670

For me two things fix the problem - One of them is @luvejo's comment above, and the other one is to use NFS:

Instead of
config.vm.synced_folder ".", "/var/www", :mount_options => ["dmode=777", "fmode=777"]
Use the following:
config.vm.synced_folder ".", "/var/www", :nfs => { :mount_options => ["dmode=777","fmode=666"] }

The first solution is cleaner though, it doesn't cause any warnings later on, but the second one is faster because in the first you'd have to back up your database, and other files you might have that are not shared on your computer.

Thanks. But the command like
$ vagrant plugin install vagrant-vbguest
does the same, doesn't it?

I'm going to lock this issue because it has been closed for _30 days_ โณ. This helps our maintainers find and focus on the active issues.

If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

hesco picture hesco  ยท  3Comments

jsirex picture jsirex  ยท  3Comments

barkingfoodog picture barkingfoodog  ยท  3Comments

dorinlazar picture dorinlazar  ยท  3Comments

OtezVikentiy picture OtezVikentiy  ยท  3Comments