Reputation: 4772
I'm trying to use a Vagrant box from someone else, and it works fine when I first start it, but after I stop it and restart it with either vagrant halt
and vagrant up
, or vagrant reload
, I get the following error message:
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:
/sbin/mount.vboxsf: mounting failed with the error: No such device
Right now, searching for this error message turns up a lot of people having trouble with a bug Virtual Box 4.3.10, but that's not the problem I'm having.
Upvotes: 13
Views: 13823
Reputation: 351
The bellow issue on MAC is apparently caused by the vagrant plugin version vagrant-vbguest-3.0
.
The following SSH command responded with a non-zero exit status.
Vagrant assumes that this means the command failed!
umount /mnt
Stdout from the command:
umount: /mnt: not mounted
Stderr from the command:
To resolve that reinstall the plugin with version 0.21
# uninstall
vagrant plugin uninstall vagrant-vbguest
# install with version 0.21
vagrant plugin install vagrant-vbguest --plugin-version 0.21
Upvotes: 0
Reputation: 1
VirtualBox 5.18 fixes this problem. It exists in 5.16 and can't be fixed by any usual means. The newest release 5.18 works perfectly.
Upvotes: 0
Reputation: 2571
Just install the Vagrant plugin vagrant-vbguest, it can keep your VirtualBox Guest Additions up to date.
vagrant plugin install vagrant-vbguest
Upvotes: 1
Reputation: 1177
Right after I got the same error I did this:
$ vagrant ssh
$ sudo apt-get update
$ exit
then installed vagrant-vbguest
$ vagrant plugin install vagrant-vbguest
then
$ vagrant halt
$ vagrant up
and it worked!
Looking at the logs it seems that vagrant-vbguest did some cleanup in terms of vbguest additions on the guest (the VM).
[default] GuestAdditions versions on your host (4.3.38) and guest (4.3.10) do not match.
* Stopping VirtualBox Additions
...done.
rmmod: ERROR: Module vboxsf is not currently loaded
rmmod: ERROR: Module vboxguest is not currently loaded
Reading package lists...
Building dependency tree...
Reading state information...
The following packages will be REMOVED:
virtualbox-guest-dkms* virtualbox-guest-utils* virtualbox-guest-x11*
0 upgraded, 0 newly installed, 3 to remove and 12 not upgraded.
After this operation, 12.1 MB disk space will be freed.
(Reading database ... 113238 files and directories currently installed.)
Removing virtualbox-guest-dkms (4.3.10-dfsg-1ubuntu5) ...
Error! Could not locate dkms.conf file.
File: does not exist.
Removing virtualbox-guest-x11 (4.3.10-dfsg-1ubuntu5) ...
Purging configuration files for virtualbox-guest-x11 (4.3.10-dfsg-1ubuntu5) ...
Removing virtualbox-guest-utils (4.3.10-dfsg-1ubuntu5) ...
Purging configuration files for virtualbox-guest-utils (4.3.10-dfsg-1ubuntu5) ...
Processing triggers for man-db (2.6.7.1-1ubuntu1) ...
Processing triggers for libc-bin (2.19-0ubuntu6.9) ...
Reading package lists...
Building dependency tree...
Reading state information...
dkms is already the newest version.
linux-headers-3.13.0-91-generic is already the newest version.
0 upgraded, 0 newly installed, 0 to remove and 12 not upgraded.
Copy iso file /Applications/VirtualBox.app/Contents/MacOS/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.38 - guest version is 4.3.10
Verifying archive integrity... All good.
Uncompressing VirtualBox 4.3.38 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.
P.S. I'm on OS X using the following software versions:
$ vagrant plugin list
solve (0.8.2)
- Version Constraint: 0.8.2
vagrant-berkshelf (4.1.0)
vagrant-hostmanager (1.5.0)
- Version Constraint: 1.5.0
vagrant-hostsupdater (1.0.2)
vagrant-omnibus (1.3.1)
- Version Constraint: 1.3.1
vagrant-proxyconf (1.2.0)
- Version Constraint: 1.2.0
vagrant-share (1.1.5, system)
vagrant-vbguest (0.12.0)
$ VBoxManage --version
4.3.38r106717
$ vagrant --version
Vagrant 1.8.4
Hope this helps.
Upvotes: 2
Reputation: 74
I have experienced the same error using Vagrant 1.8.1, VirtualBox 5.0.18, Chef 12.10.10 host MacOSX El Capitan and guest CentOS7. I tried installing kernel-devel inside the guest, installing the latest GuestAdittions and updating yum, but none of these worked for me, so I changed the mount type for "nfs" in both my custom synced folders and chef temporary folder, and it worked!
In Vagrantfile, my synced folders:
config.vm.synced_folder ".", "/vagrant", type: "nfs"
and my chef_solo config:
chef.cookbooks_path = ["chef/cookbooks/"]
chef.synced_folder_type = "nfs"
Upvotes: 0
Reputation: 294
To fix this issue virtual box addition has to be installed. For example, I use Centos 7. Firstly download centos 7 minimal and then install guest addition, please see all steps below
Download centos 7
vagrant init centos/7
vagrant up
vagrant ssh
Install Guest addition for virtual box
yum update
reboot
vagrant ssh
yum update kernel
reboot
vagrant ssh
yum groupinstall "Development tools"
yum install kernel-devel
yum install wget
wget http://download.virtualbox.org/virtualbox/5.0.2/VBoxGuestAdditions_5.0.2.iso
sudo mkdir /media/VBoxGuestAdditions
sudo mount -o loop,ro VBoxGuestAdditions_5.0.2.iso /media/VBoxGuestAdditions
sudo sh /media/VBoxGuestAdditions/VBoxLinuxAdditions.run rm VBoxGuestAdditions_5.0.2.iso
sudo umount /media/VBoxGuestAdditions
sudo rmdir /media/VBoxGuestAdditions
sudo /etc/init.d/vboxadd setup
sudo chkconfig --add vboxadd
sudo chkconfig vboxadd on
exit
Package new box
vagrant package --base my-virtual-machine
Upvotes: 5
Reputation: 2699
Hit the same issue, but with a different fix: I already had dkms installed (virtualbox-guest-dkms under Debian Jessie).
The thing was that the module «vboxsf» wasn't loaded automatically, and running mount shared_directory
didn't work (No such file or directory
error).
But after running modprobe vboxsf
, the mounting was fine.
So I edited /etc/modules
and appended vboxsf
on a new line: problem solved!
Side note: if running modprobe vboxsf
ends up on a error, you don't have the vboxsf module installed, so you should install DKMS module first.
Upvotes: 2
Reputation: 4772
It turns out, upgrading the Linux kernel will cause the Virtual Box Guest Additions to stop working until they are rebuilt by running the following command in the VM
sudo /etc/init.d/vboxadd setup
I had upgraded the kernel without thinking about it when I ran yum update
(similar to apt-get upgrade
) to get updates to other software.
Alternatively, if you install the dkms
package as described here, then the kernel module should be automatically updated when the kernel is updated.
Upvotes: 18