"Protocol error" mounting VirtualBox shared folders in an Ubuntu guest

I have Ubuntu 10 as the guest OS on a Windows 7 machine. I have been trying to setup shares through VirtualBox, but nothing is working. First, I create the share in VirtualBox and point it to a Windows folder. Then I try to mount the drive in Linux, but I keep getting

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

I made a share called "Test" in VBox Shared folders. Then I made a directory in ubuntu named "test2". Then I tried to execute this command:

sudo mount -t vboxsf Test /mnt/test2 

Any other ideas?

71.2k 59 59 gold badges 222 222 silver badges 330 330 bronze badges asked Mar 14, 2011 at 23:18 1,353 2 2 gold badges 13 13 silver badges 17 17 bronze badges

i tried all the answers and after installing dkms error persisted. But the solution to me was to just restart ubuntu and mount again. It worked.

Commented Apr 13, 2020 at 13:34

11 Answers 11

In order to use shared folder functionality few prerequisites need to be met:

Depending on host or guest OS the following may also be needed:

Testing shared folders functionality can be done by creating a shared directory on the host (e.g. C:\myshare ), define this as a shared folder for your guest system in Virtual Box settings (e.g. share ), create a mount point in your guest os (e.g. mkdir /home/username/host ) and mount this in the guest OS with the command:

sudo mount -t vboxsf -o uid=1000,gid=1000 share /home/username/host 

where the option -o makes sure that you will have access to the mount (that will otherwise be owned by root).

For further information on shared folders see also the Virtual Box User Manual.

Files or directories can also be shared over the network by using Samba on the host and the guest.

answered Mar 15, 2011 at 8:13 143k 55 55 gold badges 314 314 silver badges 431 431 bronze badges

I believe I have met all of these requirements but am still getting the error. Is there a way that I can diagnose what the problem is?

Commented Mar 15, 2011 at 12:24

Not to the string literal level, but my share is C:\test instead of C:\myshare, it is defined in VBox 4.0.4. I have made a folder in /home/[myusername]/test2 and a folder in /mnt/test2 and run the command exactly on these two folders and both return the same error.

Commented Mar 15, 2011 at 13:56

Thanks for your help! I didn't realize that the words "test" and "Test2" would be considered as using the same name. This solved the problem!

Commented Mar 15, 2011 at 15:46

For 'share' I'd foolishly used sf_[sharename], since I could see it was being mounted under /media/ with that name and assumed it would need the ubuntu-local name and not VBox's own name. However, I removed the 'sf_' prefix and this solved the problem.

Commented Dec 29, 2015 at 18:13 @MichaelScheper these are recommendations only - if it works for you, all is fine. Commented Aug 8, 2018 at 7:09

I also met this trouble. I found that the shared folder were already mounted at /media/sf_share .

I tried to delete /media/sf_share , but I couldn't.

So I deleted shared folder "share" in my home directory.

$ rm -r ~/share 

And then switch to root user with the following way:

$ sudo -i 

Create softlink/shortcut to the /media/sf_share folder that owns by root user modify the ownership of softlink with chown command. Exit from root user to normal user

# ln -s /media/sf_share /home/username/share # chown username.username /home/username/share # exit logout $ chmod 777 ~/share 

You can see the files in Windows through the shared folder. And username must be a member of group vboxsf.

answered Sep 18, 2011 at 7:03 Old Urologist Old Urologist 171 1 1 silver badge 3 3 bronze badges Thanks ! you were right. already mounted in /media/sf_sharename Commented Oct 21, 2017 at 13:46

Using CentOS 7, and I also found that my directory is mounted at media/sf_sharename . Creating a symlink to that directory would seem to be a possible option, but this is quite different from the advertised/documented procedure on the VirtualBox site. There must be a proper resolution to this.

Commented Sep 15, 2018 at 17:57

Here is what worked for me without any problem

I figured it out that, actually my user name was not in vboxsf group. Following two commands will help to get the group info:

grep "vboxsf" /etc/group grep "saurav" /etc/group 

So I added saurav (me) to the vboxsf group using following command:

sudo usermod -a -G vboxsf saurav 

Then restarted the virtualbox and then.. Jumped from my placed.. :D :D Everything worked fine without any problem.

Please comment if any one still having any problem..

answered Apr 7, 2016 at 7:00 Saurav Kumar Saurav Kumar 14.9k 16 16 gold badges 64 64 silver badges 76 76 bronze badges

This worked for me, thank you. There is only a type: should be sudo usermod -a -G vboxsf saurav (first group then user).

Commented Apr 9, 2016 at 11:04 Yes.. Typed incorrect.. :) Thanks for pointing out. Edited now.. Commented Apr 9, 2016 at 13:53 You don't need to restart VB to acquire your newly assigned group. $ su - saurav will do the trick. Commented Nov 28, 2017 at 12:11

I also struggled a lot with the mounting, and tried everything I come up with in the interwebz but I finally found a very weird workaround to solve it! My guest is Ubuntu 13 and my host is Windows 7.

Change to the media folder and from there type user@os:/media$ sudo mount -t vboxsf share /home/username/folder

Yeah, that's it. But I don't understand how come it only works if it's done from the media folder. If someone knows please kindly explain us below. Thanks.

P.s. Editing my /etc/rc.local to do the automounting at startup doesn't work for me.

answered Jan 3, 2014 at 14:18 BringBackCommodore64 BringBackCommodore64 141 3 3 bronze badges /etc/rc.local will never work, since it's done before the network is up. Commented Jan 3, 2014 at 18:01

Hi Braiam! Nice to know. Unfortunately I have read in countless of sites people recommend editing the /etc/rc.local for the automounting. Do you know what is the correct way to automount it on startup? Thanks.

Commented Jan 4, 2014 at 19:30

I am also finding it only works from /media. Very strange. I just added this to my .profile: pushd media && sudo mount /media/ && popd .

Commented Apr 9, 2018 at 16:21

Tried all the aforesaid and nothing worked for me. Lastly I created a new transient folder "Shared" with "Make Permanent" and "Auto Mount" enabled. And then I run the command

sudo mount -t vboxsf -o uid=1000,gid=1000 Shared /mnt/sharedvm 

It worked for me. No error this time.

103 5 5 bronze badges answered Jul 6, 2016 at 14:23 21 1 1 bronze badge

With VirtualBox 5.1.20 running on Windows 10, and Ubuntu 16.04 as the guest OS with GuestAdditions 5.1.20 installed, I couldn't mount the shared folders from the command line. The mount commands failed, with mentions of Protocol Error and sf_read_super_aux err=-22.

Eventually I found https://www.virtualbox.org/ticket/16670 "mount.vboxsf symlink broken". I followed one of the workarounds there, to correct the symlink for mount.vboxsf, and it all worked. My approach was to do:

mv /sbin/mount.vboxsf /sbin/mount.vboxsf-orig ln -s /opt/VBoxGuestAdditions-5.1.20/lib/VBoxGuestAdditions/mount.vboxsf /sbin/mount.vboxsf

The commands need to be done by root. So, because it was Ubuntu, I added "sudo " at the beginning of each line to do the command as root. Other flavors of Linux have other ways of doing that.

As an aside, there was a similar symlink problem reported in virtualbox's Ticket #12879 "Can't mount shared folders with guest additions 4.3.10" in 2014, that was fixed the following month.