New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Intermittent problems mounting VirtualBox shared folder #6169

Closed
IzakMarais opened this Issue Aug 20, 2015 · 1 comment

Comments

Projects
None yet
2 participants
@IzakMarais
Copy link

IzakMarais commented Aug 20, 2015

Hi all.

My shared folder works fine upon first boot (I did install guest additions via the VirtualBox iso and it works). However after using the VM for a while, I sometimes after calling vagrant halt and vagrant up get the 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` shares /shares
mount -t vboxsf -o uid=`id -u vagrant`,gid=`id -g vagrant` shares /shares

The error output from the last command was:

/sbin/mount.vboxsf: mounting failed with the error: Protocol error

To get this working again I did vagrant ssh into the machine and removed and recreated the mount target directory:

[vagrant@localhost ~]$ ll /                                            
total 66                                                               
...
drwxr-xr-x.   2 root    root     4096 Aug 17 09:17 shares              
...   
[vagrant@localhost ~]$ sudo rm -rf /shares
[vagrant@localhost ~]$ sudo mount -t vboxsf -o uid=`id -u vagrant`,gid=`id -g vagrant` shares /shares
/sbin/mount.vboxsf: mounting failed with the error: No such file or directory
[vagrant@localhost ~]$ mkdir /shares
mkdir: cannot create directory ‘/shares’: Permission denied
[vagrant@localhost ~]$ sudo mkdir /shares

Now it works:

[vagrant@localhost ~]$ sudo mount -t vboxsf -o uid=`id -u vagrant`,gid=`id -g vagrant` shares /shares
[vagrant@localhost ~]$ cd /shares
[vagrant@localhost shares]$ ls
ca.crt  repos  test.txt
[vagrant@localhost shares]$ ll /
total 62
...
drwxrwxrwx.   1 vagrant vagrant     0 Aug 18 08:55 shares
...

Any ideas what could be causing this or how to sort it out permanently?

VirutalBox version 3.2.28 r100309
Vagrant version 1.7.2
Host OS: Windows 8
Guest OS: https://vagrantcloud.com/chef/boxes/fedora-20

@IzakMarais

This comment has been minimized.

Copy link

IzakMarais commented Sep 1, 2015

Turns out this is known Linux problem actually:

There is a known issue with Linux mount: If there exists are directory or file of the same name as your host share then mount expands the full path of that file/directory and passed this expanded name as network share to the mount.vboxsf command which obviously will fail since that guest path is not known to the host. Try to use mount.vboxsf directly (this will work) for such corner cases.

I had made a shares symlink in /home/vagrant that linked to /shares and the shared folder name is also shares. After deleting this symlink, the mount operation succeeded.

Don't know if there is anything vagrant can do to help others avoid this situation? If you feel not, you can close the issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment