vagrant guest additions and kernel - vagrant

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.

Related

Vagrant unable to mount shared folders

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.

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.

What does this Vagrantfile configuration do? What does the "vagrant up" statement do in this specific Apache Storm example?

I am new in Vagrant and in Apache Storm.
I am following an online course where show the following situation.
There is an Ubuntu virtual machine installed on Virtual Box
On the host machine (the same where is installed Virtual Box and that run the guest Ubuntu VM) it is installed Vagrant.
In the tutorial first download from GitHub a directory that contains some project by this command:
git clone https://github.com/Udacity/ud381
that create this directory on my host Windows machine:
C:\Users\Andrea\Documents\workspaces\Real-Time\ud381
As you can see entering in the previous github repository this directory contain a Vagrantfile that contain:
# -*- mode: ruby -*-
# vi: set ft=ruby :
# Vagrantfile API/syntax version. Don't touch unless you know what you're doing!
VAGRANTFILE_API_VERSION = "2"
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
config.vm.box = "udacity/ud381"
config.vm.network :forwarded_port, guest: 5000, host: 5000
end
From what I have understand the Vagrantfile represent the Vagrant configuration and I think that it represent the link with the Ubuntu guest VM that I have previously installed on VirtualBox (I have installed it by myself but I don't know if it is correct).
What exactly represent the previous configurations into my Vagrantfile?
I think that udacity/ud381 is the VM name on VirtualBox but I am not sure about it.
Then in the tutorial show that, using the shell, I have to enter into the directory that contain the Vagrantfile (this: C:\Users\Andrea\Documents\workspaces\Real-Time\ud381) and perform this statement:
vagrant up
it seems that begin to download something (it is very slow). What is it doing? What is it downloading?
udacity/ud381 is a reference to a vagrant box located on atlas.hashicorp : https://atlas.hashicorp.com/udacity/boxes/ud381
when you do vagrant up with this Vagrantfile it does create a new VM using the box you specified, if the box is not already in your system, it will try to download, hence it appears to be slow. Further vagrant up with this same box will be much faster as it will create the VM from a local box.
If you plan to use vagrant, you should let it manage the VM and do not create the VM in VirtualBox yourself (there are some ways to make this link but thats not trivial and not sure if its supported). Ideally try not to start VirtualBox once when you do a full cycle with vagrant (init, up, ssh ...) and you will see how smooth it is

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