Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Vagrant error when mount synced folder #6769

Closed
lisi4ok opened this issue Dec 30, 2015 · 21 comments
Closed

Vagrant error when mount synced folder #6769

lisi4ok opened this issue Dec 30, 2015 · 21 comments

Comments

@lisi4ok
Copy link

lisi4ok commented Dec 30, 2015

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:

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

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

@sevengo8378
Copy link

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

@sethvargo
Copy link
Contributor

Hi there,

I have been unable to reproduce this issue, but it looks like there are a few articles on the internet for workarounds:

Do any of those help?

@Revisor
Copy link

Revisor commented Feb 12, 2016

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

@lisi4ok
Copy link
Author

lisi4ok commented Feb 13, 2016

We didin`t :)

@aanm
Copy link

aanm commented Feb 23, 2016

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

@aanm
Copy link

aanm commented Feb 23, 2016

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

@alfiedotwtf
Copy link

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

@alfiedotwtf
Copy link

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.

@sethvargo
Copy link
Contributor

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?

@alfiedotwtf
Copy link

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!

@sethvargo
Copy link
Contributor

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?

@alfiedotwtf
Copy link

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

@gadelkareem
Copy link

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'

@alfiedotwtf
Copy link

[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

@syaifulsz
Copy link

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 https://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.

Superbil added a commit to lowiki-org/localwiki-backend-server that referenced this issue Jul 24, 2016
Superbil added a commit to lowiki-org/localwiki-backend-server that referenced this issue Jul 24, 2016
Superbil added a commit to lowiki-org/localwiki-backend-server that referenced this issue Jul 24, 2016
Superbil added a commit to lowiki-org/localwiki-backend-server that referenced this issue Jul 24, 2016
from hashicorp/vagrant#6769

Install virtualbox guest additons and ignore error, because
X.Org isn't installed.
Superbil added a commit to lowiki-org/localwiki-backend-server that referenced this issue Jul 24, 2016
from hashicorp/vagrant#6769

Install virtualbox guest additons and ignore error, because
X.Org isn't installed.
@luveqz
Copy link

luveqz commented Oct 7, 2016

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.

@maxiaoxiong
Copy link

@luvejo Thank you!!

@selukov
Copy link

selukov commented Apr 22, 2017

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

@rudeshko-treefrog
Copy link

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.

@jukuan
Copy link

jukuan commented Aug 16, 2018

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

@ghost
Copy link

ghost commented Apr 1, 2020

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.

@ghost ghost locked and limited conversation to collaborators Apr 1, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests