grtjn / mlvagrant

Scripts for bootstrapping a local MarkLogic cluster for development purposes using https://www.vagrantup.com/ and https://www.virtualbox.org/.
Apache License 2.0
19 stars 16 forks source link

Issues mounting folders with VBox 5.1 #101

Closed grtjn closed 7 years ago

grtjn commented 8 years ago

Using VirtualBox 5+, one might observe errors like:

==> ea3-ml1: Machine booted and ready!
==> ea3-ml1: Checking for guest additions in VM...
==> ea3-ml1: Setting hostname...
==> ea3-ml1: Configuring and enabling network interfaces...
==> ea3-ml1: Mounting shared folders...
    ea3-ml1: /vagrant => /Users/xxx/ea3
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
grtjn commented 8 years ago

This is likely caused by guest-addons that are added by Vagrant, are not in synch with VBox. Vagrant comes with addons for VBox 4, not for VBox 5.

Solution is relatively simple:

vagrant plugin install vagrant-vbguest

That will make sure correct addons are loaded. See also: http://stackoverflow.com/questions/22717428/vagrant-error-failed-to-mount-folders-in-linux-guest

grtjn commented 8 years ago

I should add a note to the README about this..

sfc-gh-rpughsley commented 8 years ago

I managed to get the shared folders working by following the instructions here

and then these steps: Create shared folder with host

Host: Mac OS Guest: centOs

  1. Click Settings on VirtualBox, and then click Shared Folders.
  2. Add Machine Folders (the shared folder on the host machine), setup a name as shared_folder and make it permanent.
  3. In your Guest Linux Box, open a terminal and enter the following commands: sudo mkdir /mnt/share sudo mount -t vboxsf shared_folder /mnt/share [shared_folder is the name of your shared folder]
  4. Make the mounted share permanent, you can make the shared folder mount automatically each time you start the CentOS guest, enter the following commands: sudo vim /etc/fstab add a line at the bottom of the file, it looks like this (get the gid/uid from running id): shared_folder /mnt/share vboxsf rw,gid=100,uid=1000,auto 0 0
  5. restart your guest system, and verfy your settings, it should work.
grtjn commented 7 years ago

vagrant-vbguest comes with commands to install the correct guest additions version: https://github.com/dotless-de/vagrant-vbguest#running-as-a-command

Doing that after a vagrant up (--no-provision), and then doing vagrant halt & vagrant up should fix issues too. See also #104..