Vagrant unable to mount shared folders - vagrant

I have a fresh installation of scotchbox. I have been trying to install this, on a mac it normally works without problems, now im using windows and im starting to get all sorts of problems with it.
Solved most of them, however I cannot solve this one for some reason.
==> default: Mounting shared folders...
default: /var/www => C:/Users/kevin/Desktop/programeren/scotch-box-master
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 dmode=777,fmode=666,uid=1000,gid=1000 var_www /var/www
The error output from the command was:
: No such file or directory
C:\Users\kevin\Desktop\programeren\scotch-box-master>
My vagrantfile:
# -*- mode: ruby -*-
# vi: set ft=ruby :
Vagrant.configure("2") do |config|
config.vm.box = "scotch/box"
config.vm.network "private_network", ip: "192.168.33.10"
config.vm.hostname = "scotchbox"
config.vm.synced_folder ".", "/var/www", :mount_options => ["dmode=777", "fmode=666"]
# Optional NFS. Make sure to remove other synced_folder line too
#config.vm.synced_folder ".", "/var/www", :nfs => { :mount_options => ["dmode=777","fmode=666"] }
end
I have tried installing a vagrant plugin called vagrant-vbguest, this didn't work. Any ideas how to solve this.
Thanks a lot in advance.
Greetings,
Kevin

If you are using VirtualBox 5.1.16, there have been similar issues reported. It looks like downgrading to 5.1.14 has solved this for most of them. You could give it a try.

Related

vagrant guest additions and kernel

Getting a 'vboxsf' error whenever I try to up the centos7 box.
I run vagrant init in the directory.Then I go in directory and edit the file.And run the vagrant up.This is what I put in vagrant file:-
# -*- mode: ruby -*-
# vi: set ft=ruby :
Vagrant.configure("2") do |config|
config.vm.define "Centos7" do |master|
master.vm.provider "virtualbox"
master.vm.box = "centos/7"
master.vm.hostname = "web.mylab.local"
master.vm.network :private_network, ip: "198.168.56.7"
config.vm.synced_folder ".", "/vagrant", type: "virtualbox"
master.vm.provision "shell", inline: <<-SHELL
sudo sed -1 "s/PasswordAuthentication.*/PasswordAuthentication
yes/g" /etc/ssh/sshd_config
sudo systemct1 restart sshd
SHELL
end
end
**This is the error message i get:-**
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:
mount: unknown filesystem type 'vboxsf'
You are defining a synced_folder (i.e. shared folder) for your VirtualBox vm.
This functionality requires the vm to have the VirtualBox Guest Additions installed
You are using a base box that does not have VirtualBox Guest Additions installed
From there you basically have 3 options
Modify your vagrant provisioning script to install Guest Additions when creating the vm (e.g. Insert the virtual CDROM into vm, mount it and lauch the install script). I still have a doubt this can break in case the shared folder mount happens before provisionning is finished...
Create a base box yourself that will have Guest Additions installed and use it. If you need to share this box with other devs, you will have to host it somewhere.
Use an other base box with Guest Additions already installed.
I did not dig into the latest point for quite a while since I tend to craft my own boxes for my own use. But if I remember well, the public generic/centos7 box comes with Guest Additions pre-installed for the VirtualBox provider.

Vagrant unable to mount shared folders - No such file or directory

I have this Vagrantfile
Vagrant.configure(2) do |config|
config.vm.box = "ubuntu/trusty32"
config.vm.hostname = "app.local"
config.vm.network :private_network, ip: "192.168.20.20"
config.vm.synced_folder ".", "/vagrant", :mount_options => ['dmode=774','fmode=775']
config.vm.provider :virtualbox do |vb|
vb.name = "MyBox"
vb.memory = 512
vb.cpus = 2
end
config.vm.provision :shell, path: "install.sh"
end
that I used so far without problems (on Ubuntu and Windows). On Windows 10, I have upgraded both Oracle VM Virtual Box (5.1.16) and Vagrant (1.9.2) and now I get this error when trying to install the box:
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 dmode=774,fmode=775,uid=1000,gid=1000 vagrant /vagrant
The error output from the command was:
: No such file or directory
I also see this:
GuestAdditions versions on your host (5.1.16) and guest (4.3.36) do not match.
* Stopping VirtualBox Additions
and then it looks like the GuestAdditions is removed and the 5.1.16 version is installed, steps that ends with:
vboxadd.sh: Building Guest Additions kernel modules. vboxadd.sh:
Starting the VirtualBox Guest Additions.
Could not find the X.Org or XFree86 Window System, skipping.
After this, I still get:
Got different reports about installed GuestAdditions version:
Virtualbox on your host claims: 4.3.36 VBoxService inside the vm
claims: 5.1.16 Going on, assuming VBoxService is correct... Got
different reports about installed GuestAdditions version: Virtualbox
on your host claims: 4.3.36 VBoxService inside the vm claims:
5.1.16 Going on, assuming VBoxService is correct...
Is this a bug or am I doing something wrong?
It looks like this was fixed in 5.1.18. Updating to the latest version fixed the problem for me.
Change Log (Version 5.1.18):
Shared Folders: fixed case insensitive filename access (5.1.16 regression; Windows guests only; bug #16549)
Shared Folders: fixed access to long pathes (5.1.16 regression; Windows guests only; bugs #14651, #16564)

Vagrantfile ordering provisioner issue

I have the following vagrant file:
# -*- mode: ruby -*-
# vi: set ft=ruby :
Vagrant.configure(2) do |config|
config.vm.box = "centos/7"
config.vm.provider "virtualbox" do |vb|
vb.memory = "4096"
vb.cpus = 4
#storage
end
config.vm.provision "shell",
path: "vagrant_files/setup_script.sh"
config.vm.provision :reload
config.vm.provision "shell",
path: "vagrant_files/setup_script_2.sh"
config.vm.provision :reload
config.vm.provision "shell",
path: "vagrant_files/setup_script_3.sh"
config.vm.synced_folder ".", "/vagrant"
end
In my setup setup_script I have vagrant install Virtual Box Guest Additions which is a requirement to get the synced folder feature to work for vagrant.
Unfortunately, even if I put the line to sync the folders at the very end of the Vagrantfile, it still attempts to do that task first resulting in an error:
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
The error output from the last command was:
mount: unknown filesystem type 'vboxsf'
I understand I need to first install the Virtual Box Guest Additions. Anyone else run into this issue? how did you all solve this problem?
This is an interesting issue. I spun up a CentOS 7 VM with the same base box like so...
vagrant init centos/7
vagrant up
...and the Guest Additions installation failed. Here's the relevant output from Vagrant...
Copy iso file /Applications/VirtualBox.app/Contents/MacOS/VBoxGuestAdditions.iso into the box /tmp/VBoxGuestAdditions.iso
mount: /dev/loop0 is write-protected, mounting read-only
Installing Virtualbox Guest Additions 5.0.10 - guest version is
Verifying archive integrity... All good.
Uncompressing VirtualBox 5.0.10 Guest Additions for Linux............
VirtualBox Guest Additions installer
Copying additional installer modules ...
./install.sh: line 345: bzip2: command not found
tar: This does not look like a tar archive
tar: Exiting with failure status due to previous errors
./install.sh: line 358: bzip2: command not found
tar: This does not look like a tar archive
tar: Exiting with failure status due to previous errors
So this base box does not have the bzip2 package installed and that causes the failure. Out of curiosity I created a new Ubuntu VM from the ubuntu/trusty64 base box and Guest Additions installed without any problem. As you might guess, the bzip2 package was already installed in Ubuntu.
I would classify this as an issue with the base box itself. The CentOS project should be baking bzip2 into all of their Vagrant base boxes that are used with VirtualBox.
Of course, this doesn't help you right now, but fortunately you have many more options for CentOS base boxes and I would expect that most of them are not affected by this issue.
To fix my issue, I just loaded the Centos box.
Then I proceeded to install Virtual Box Guest Additions
Then I proceeded to repackage the box
That solved my issue.
I used luvejo tip on https://github.com/mitchellh/vagrant/issues/6769 and it worked for me as well:
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.

Vagrant with VirtualBox on Windows10: "Rsync" could not be found on your PATH

I've used Vagrant for a while on a windows 7 system. Now I've a new PC with windows 10. I installed Oracle Virtual Box and Vagrant and I try to start a machine with the command vagrant up.
The Vagrantfile is the same file that I used on my windows 7 system.
This is the content of the Vagrantfile:
Vagrant.configure(2) do |config|
config.vm.box = "debian/jessie64"
config.vm.provider "virtualbox" do |v|
v.customize ["modifyvm", :id, "--memory", "768"]
end
config.vm.provision :shell, path: "bootstrap.sh"
config.vm.network :private_network, ip: "172.27.146.17"
config.vm.hostname = "www.delevensstijl.hst1.nl"
config.hostsupdater.aliases = ["www.thelifestylemethod.hst1.nl"]
end
The error I get: "rsync" could not be found on your PATH. Make sure that rsync is properly installed on your system and available on the PATH.
Why is Vagrant looking for rsync since I use Virtualbox?
How can I workaround this error?
I found in another forum that the local Vagrant directory is mounted as "/vagrant" via rsync. This is set in the box itself, you can check by opening
C:\Users\{your_username}\.vagrant.d\boxes\debian-VAGRANTSLASH-jessie64\8.2.2\virtualbox\Vagrantfile
and see the setting
config.vm.synced_folder \
".",
"/vagrant",
type: "rsync"
to get around this I added the following line in my local Vagrantfile
config.vm.synced_folder ".", "/vagrant", type: "virtualbox"
and the error was resolved
I have solved this issue as below when use cent/7 at Windows 7.
Check the box synced_folder at C:\Users[username]\.vagrant.d\boxes\centos-VAGRANTSLASH-7\1602.02\virtualbox\Vagrantfile
config.vm.synced_folder ".", "/home/vagrant/sync", type: "rsync"
Override the defition at project Vagrantfile for directory mapping.
config.vm.synced_folder ".", "/home/vagrant/sync", type: "virtualbox"
I imagine the box might be prepared at non Windows system, this case can be happened on many boxes, such as fedora/23-cloud-base.
Seems like a bug. You can report it here. But it seems that your bug has been already reported as the issue 6631.
Nevertheless you can try to add rsync to your PATH and check the result. You can do it in 2 ways:
Install Cygwin and then launch vagrant up from its Cygwin Terminal
Download & unpack cwRsync
First of all this is not a bug it is expected behavior on Windows because the rsync is absent on Windows.
If you faced with this problem and want to use the rsync as a mechanism to sync folders you should:
Download the Cygwin from https://mingw-w64.org/doku.php/download/cygwin
Install the Cygwin with rsync + openssh modules. It's important bacause they is basent on a Window (you may select packages to install during installation on the Select packages phase)
Add x:\cygwin\bin, where 'x' is the drive on which you have installed the cygwin distribution, to the SYSTEM PATH.
Reboot your PC (not need on Windows 10)
That's all.
Thank you for your attention and have a nice day :-)
Using Vagrant/VirtualBox (5.06) on Windows7 with centos/7 box from Atlas: could not find rsync on the path. So, I installed via cygwin as suggested (had other stuff to install as well, including openssh). No joy. Tried changing the shared folder config to "virtualbox" rather than "rsync". No joy. Oh, forgot to check if the VirtualBox guest additions were in the box: they were not. Rsync worked bettter, but still chocked at the end (could not chdir to the source directory of the shared folder). However, the "type: virtualbox" config did work!
So the datapoint is: centos/7 with guest additions added and shared folder type set to "virtualbox" (overriding the box setting) on windows 7 works.
Worked out of the box (no changes, no guest additions) on MacOS.
I was facing same issue on Windows 10. Removing the below line helped me to fix the issue
Directory: C:\Users\xxxxxxxxxxxxx.vagrant.d\boxes\manageiq-VAGRANTSLASH-euwe\5.1.0\virtualbox
File: VagrantFile
Line to remove: config.vm.synced_folder ".", "/home/vagrant/sync", type: "rsync"
Next Steps:
Save the file
Open cygwin terminal
Go to vagrant directory
Run "vagrant up"
I was able to fix this problen using another bos from
C:\Users{your_username}.vagrant.d\boxes\box\subfolder\virtualbox\Vagrantfile
And adding
# Load include vagrant file if it exists after the auto-generated
# so it can override any of the settings
include_vagrantfile = File.expand_path("../include/_Vagrantfile", __FILE__)
load include_vagrantfile if File.exist?(include_vagrantfile)
I've tried the advises above but it didn't help. I use Windows 7, vagrant 1.9.1
As vm box I use centos 7 without guest addition installed.
vm.box = "centos/7"
To resolve this issue change clean 'vm.box' to box with preinstalled guest addition, for example
vm.box = "geerlingguy/centos7"
And also make sure there is no vbguest plugin installed because another error appears
vagrant plugin list
vagrant plugin uninstall vagrant-vbguest

VirtualBox 5.0 cannot access any network with Ubuntu Mate 15.04 host

It's my first question I've asked here, but I've been a long time reader of Stack Overflow.
I use Vagrant with VirtualBox to handle the server configurations of the several projects I'm working on. I've used VirtualBox and Ubuntu Mate for the last few months without any problems. But I've changed my hard drive yesterday and I had to reinstall Ubuntu Mate 15.04.
I've installed the build-essential package, VirtualBox 5.0 from the x64 package found on VirtualBox's website and Vagrant from Vagrant's website. I've pulled my old VagrantFile from GIT and relaunched the machine. Vagrant pull the correct image, as expected, but once the VM is running in VirtualBox, Vagrant can't ssh into it.
I used VirtualBox's interface to get into the guest's shell, and found that I could not access any network. Even VirtualBox auto-update tool cannot connect to the internet. I get the message :
The network operation failed with the following error: Unknown reason
I've formated my computer several times using different versions/flavors of Ubuntu to no avail. I've also rolled back to previous versions of VirtualBox, but no luck either. I've manually installed a guest with VirtualBox and the network is not working either.
I've did several searches on Google and Stack Overflow for similar problems, but the closest matches were for Windows 10 issues. But neither the host or the guest is running Windows.
My computer/os configuration is the same as before yesterday, except for the drive change. I don't understand why it isn't working as before.
Here's my VagrantFile if it can help you :
# -*- mode: ruby -*-
# vi: set ft=ruby :
VAGRANTFILE_API_VERSION = "2"
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
config.vm.box = "ubuntu/trusty32"
config.vm.network "private_network", ip: "192.168.33.15"
config.vm.network "public_network", ip: "10.1.1.207", bridge: "p4p1"
config.ssh.forward_agent = true
config.vm.synced_folder "src/", "/var/www/project",
owner: "www-data", group: "www-data"
config.vm.provider :virtualbox do |vb|
vb.customize ["modifyvm", :id, "--memory", "512"]
end
config.vm.provision "shell", path: "bin/shellprovider.sh"
end
Any help or any hint would be greatly appreciated.
Regards,
Eric Lacasse

Resources