Skip to content
This repository has been archived by the owner on Dec 17, 2023. It is now read-only.

Failed to mount folders in Linux guest. #117

Closed
felixrabe opened this issue Mar 30, 2014 · 19 comments
Closed

Failed to mount folders in Linux guest. #117

felixrabe opened this issue Mar 30, 2014 · 19 comments
Labels

Comments

@felixrabe
Copy link

I've just run vagrant plugin install vagrant-vbguest and now /vagrant does not get mounted anymore. Error message: Failed to mount folders in Linux guest.

See https://gist.github.com/felixrabe/fcedbd02c1570252cc14 for the full reproduction with a fresh setup.

Versions:

  • OS X 10.9.2
  • Vagrant 1.5.1
  • VirtualBox 4.3.10
  • Box: hashicorp/precise64
@felixrabe
Copy link
Author

Seems to be a VirtualBox 4.3.10 issue. Workaround:

vagrant ssh
# then, inside the VM:
sudo ln -s /opt/VBoxGuestAdditions-4.3.10/lib/VBoxGuestAdditions /usr/lib/VBoxGuestAdditions
logout
# then, outside the VM:
vagrant reload

Tested: https://gist.github.com/felixrabe/1c8a43c87aeb229bf635

Origin of workaround:

@abercrave
Copy link

Thanks. This worked for me with the same setup on OS X 10.8.5.

@tbal
Copy link

tbal commented Apr 3, 2014

According to https://www.virtualbox.org/ticket/12879 this will be fixed in VBoxGuestAdditions 4.3.11.

I suggest to close this issue, because it is not a vagrant bug, there is a workaround for guest additions 4.3.10 and it will most likely be fixed in next guest additions release (4.3.11).

@marcosgdf
Copy link

@felixrabe That worked for me too in OS X 10.9.2. Thanks!

@jasperdcbe
Copy link

@felixrabe this worked for me too on OS X and Virtualbox 4.3.10, thx!

@lox
Copy link

lox commented Apr 14, 2014

Might it be worth adding a special case into vbguest to download the guest additions for 4.3.11-93070 rather than 4.3.10 to prevent confusion until the new virtualbox version is released?

@t3hpr1m3
Copy link

t3hpr1m3 commented May 1, 2014

A little late to the party, but I'm getting around this issue (since 4.3.11 is taking its sweet time), by using a custom installer (part of vbguest already):

class HackyGuestAdditionsInstaller < VagrantVbguest::Installers::Ubuntu
  def install(opts=nil, &block)
    super
    super_garbage_hack = <<-EOF
if [ ! -e /usr/lib/VBoxGuestAdditions ]; then
  sudo ln -s /opt/VBoxGuestAdditions-4.3.10/lib/VBoxGuestAdditions \
    /usr/lib/VBoxGuestAdditions || true
fi
EOF
    communicate.sudo(super_garbage_hack)
  end
end

Vagrant.configure("2") do |config|
  # ...
  config.vbguest.installer = HackyGuestAdditionsInstaller
  # ...
end

Obviously, if your guest is something other than Ubuntu, you'd need to derive from the correct base class for your OS. HTH!

@ldenman
Copy link

ldenman commented May 1, 2014

@t3hpr1m3 for some reason it's not working for me :/. I'm trying to provision an ubuntu 14.04 box. I have the vbguest plugin installed as well.

@felixrabe
Copy link
Author

@ldenman It would help us to know what is not working for you exactly, and how?

As for me, before applying @t3hpr1m3 's hack, I had the following appear in red at the end of running vagrant up:

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

After applying the hack, the difference after I vagrant destroy and vagrant up again is that this red message is gone, which to me means "it works".

@ldenman
Copy link

ldenman commented May 2, 2014

@felixrabe Howdy. So, the failure case is the "failed to mount folders in Linux guest message" in red, exactly what you were seeing.

Versions:

ArchLinux
Vagrant 1.5.3
VirtualBox 4.3.10
Box: opscode/bento/ubuntu-14.04

When I run this code on the command line via vagrant ssh, the problem goes away:

if [ ! -e /usr/lib/VBoxGuestAdditions ]; then sudo ln -s /opt/VBoxGuestAdditions-4.3.10/lib/VBoxGuestAdditions /usr/lib/VBoxGuestAdditions || true fi

My bash session looks like this:

/home/me/src/new-vagrant> vagrant up     
Bringing machine 'default' up with 'virtualbox' provider...
==> default: Importing base box '~/src/bento/builds/virtualbox/opscode_ubuntu-14.04_chef-provisionerless.box'...
==> default: Matching MAC address for NAT networking...
==> default: Setting the name of the VM: new-vagrant_default_1399037634874_28362
==> default: Clearing any previously set network interfaces...
==> default: Preparing network interfaces based on configuration...
    default: Adapter 1: nat
==> default: Forwarding ports...
    default: 80 => 8000 (adapter 1)
    default: 22 => 2222 (adapter 1)
==> default: Running 'pre-boot' VM customizations...
==> default: Booting VM...
==> default: Waiting for machine to boot. This may take a few minutes...
    default: SSH address: 127.0.0.1:2222
    default: SSH username: vagrant
    default: SSH auth method: private key
    default: Warning: Connection timeout. Retrying...
==> default: Machine booted and ready!
GuestAdditions 4.3.10 running --- OK.
==> default: Checking for guest additions in VM...
==> default: Mounting shared folders...
    default: /vagrant => /home/me/src/new-vagrant
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

And my Vagrant file is this:

# -*- mode: ruby -*-
# vi: set ft=ruby :

class HackyGuestAdditionsInstaller < VagrantVbguest::Installers::Ubuntu
  def install(opts=nil, &block)
    super
    super_garbage_hack = <<-EOF
if [ ! -e /usr/lib/VBoxGuestAdditions ]; then
  sudo ln -s /opt/VBoxGuestAdditions-4.3.10/lib/VBoxGuestAdditions \
    /usr/lib/VBoxGuestAdditions || true
fi
EOF
    communicate.sudo(super_garbage_hack)
  end
end

# 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.vbguest.installer = HackyGuestAdditionsInstaller
  config.omnibus.chef_version = :latest
  config.vm.box = "~/src/bento/builds/virtualbox/opscode_ubuntu-14.04_chef-provisionerless.box"
  config.vm.network "forwarded_port", guest: 80, host: 8000
  config.ssh.private_key_path = [ '~/.vagrant.d/insecure_private_key' ]
  config.vm.provider "virtualbox" do |vb|
    #   # Use VBoxManage to customize the VM. For example to change memory:
    vb.customize ["modifyvm", :id, "--memory", "2048"]
  end
end

@bishless
Copy link

bishless commented May 3, 2014

Thanks @felixrabe! Your workaround rescued my VVV setup on my Windows machine.

@aphofstede
Copy link

I also have this issue with the latest Vagrant, VB and GuestAdditions as well as with Vagrant 1.6.2, VB 4.2.10 and GuestAdditions 4.2.10. Creating the symlink didn't work for me; neither did installing the vagrant-vbguest plugin. Any ideas why this is happening?
I'm using the http://puppet-vagrant-boxes.puppetlabs.com/centos-64-x64-vbox4210.box box.

@felixrabe
Copy link
Author

Sorry, I’ve only tested this with Ubuntu guests.

On 22 May 2014, at 11:25, Alexander Hofstede notifications@github.com wrote:

I also have this issue with the latest Vagrant, VB and GuestAdditions as well as with Vagrant 1.6.2, VB 4.2.10 and GuestAdditions 4.2.10. Creating the symlink didn't work for me; neither did installing the vagrant-vbguest plugin. Any ideas why this is happening?
I'm using the http://puppet-vagrant-boxes.puppetlabs.com/centos-64-x64-vbox4210.box box.


Reply to this email directly or view it on GitHub.

@aphofstede
Copy link

hashicorp/vagrant#3341 (comment) solved it for me.

@hamiltont
Copy link

I'm still seeing this with VirtualBox 4.3.18, Vagrant 1.6.3, OS X 10.9.5, Guest OS Ubuntu 14.04.
I already use vbguest, so my guest additions are also 4.3.18.

The link solution doesn't seem to work for me, and manually trying to mount inside the VM sometimes works and sometimes results in a Protocol error

@zloster
Copy link

zloster commented Oct 25, 2014

@hamiltont I also have the same issues with VirtualBox 4.3.18/4.3.16 (the other stuff is Vagrant 1.6.5, Ubuntu 12.04).
I already use vbguest also, the guest additions are updated and install without error.
The link solution doesn't work for me also.

So I've checked my dmesg I have found the following error:

[  456.147485] sf_read_super_aux err=-71
[  456.147893] sf_read_super_aux err=-71

Quick search in the Web and I've found this: https://www.virtualbox.org/ticket/928#comment:20 - VirtualBox fails to mount shared folders if their name is not in lowercase. I've renamed the shared folder name in VirtualBox settings and the mounting is working. At least when I execute the commands manually.
TL&DR - Try to change the shared folder name to lowercase name and check if it is working.

@hamiltont
Copy link

@zloster it works! Thanks a lot :-)

As an aside, I did not change the folder on my host system. It's called "FooBar", and running

sudo mount -t vboxsf -o uid=`id -u vagrant`,gid=`getent group vagrant | cut -d: -f3` FooBar /FooBar

fails, while this works

sudo mount -t vboxsf -o uid=`id -u vagrant`,gid=`getent group vagrant | cut -d: -f3` fooBar /FooBar

If other people have this issue, I'd propose that Vagrant attempts the mount in this manner after trying the current two approaches

@rbyelyy
Copy link

rbyelyy commented Dec 10, 2014

I have this issue also but only for suse...for ubuntu and debian everything is good.

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

Building the shared folder support module failed
(Look at /var/log/vboxadd-install.log to find out what went wrong)

@stale
Copy link

stale bot commented Jan 11, 2019

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the wontfix label Jan 11, 2019
@stale stale bot closed this as completed Jan 18, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests