Saturday, April 12, 2014

VirtualBox shared folder Linux notes

I sank my Friday evening fighting with VirtualBox 4.3.10 r93012 with a Mac OS X 10.9.2 host and Ubuntu Linux guest kernel 3.13. Whenever I try to mount my shared folder xyzzy, I'd get cryptic error messages like these:
root@ubuntu:~# mount -t vboxsf xyzzy /media/xyzzy
mount: wrong fs type, bad option, bad superblock on xyzzy,
       missing codepage or helper program, or other error
       (for several filesystems (e.g. nfs, cifs) you might
       need a /sbin/mount. helper program)
       In some cases useful info is found in syslog - try
       dmesg | tail  or so
root@ubuntu:~# dmesg | tail
...
[ 1292.150065] sf_read_super_aux err=-22
root@ubuntu:~# mount -t vboxsf -o gid=1000,uid=1000 xyzzy /media/xyzzy
mount: Protocol error
root@ubuntu:~# dmesg | tail
...
[ 1348.460432] sf_read_super_aux err=-71
Making the shared folder automount and reboot works, but I want to mount it to a specific path. Reinstalling GuestAddition doesn't help. It turns out that it's an old problem resurfacing. The root cause is that /sbin/mount.vboxsf is an invalid symlink. The fix is this:
root@ubuntu:~# updatedb  # first make sure locate is up to date.
root@ubuntu:~# locate mount.vboxsf  # find the real location.
/opt/VBoxGuestAdditions-4.3.10/lib/VBoxGuestAdditions/mount.vboxsf
/sbin/mount.vboxsf  # this is the bad symlink.
root@ubuntu:~# ln -sf /opt/VBoxGuestAdditions-4.3.10/lib/VBoxGuestAdditions/mount.vboxsf /sbin/mount.vboxsf
Now I can mount.

If I want to add the mount point to /etc/fstab so that it gets mounted at boot time, the problem is that vboxsf is not loaded automatically early in the boot, so again it fails to mount. The solution is to add vboxsf to /etc/modules.
root@ubuntu:~# echo vboxsf >> /etc/modules
Now when I reboot, the shared folder is mounted correctly at boot time.

9 comments:

Kunle Oyedele said...

Thanks! This helped a lot.

Likai Liu said...

Glad you found it helpful, sir! I actually use it to mount my home directory inside VM. I can't express enough how much that simplifies my workflow!

screenqwxk said...

I read your blog and analysis your blog; I like it so nice imagine post very usefully blog. If you need these type help visit here and get tension free.

screenqwxk said...

company offering technical support for various any types of technical errors. Get support click here 5kw wind turbine price

screenqwxk said...

This is certainly very helpful information! Thanks for sharing this to us freely and more power to your journey.mens work jacket

screenqwxk said...

Really great post. I just discovered your web journal and needed to say that I have truly delighted in perusing your blog entries. Any way I"ll be subscribing to your food and I trust you post again soon. Huge much obliged for the helpful information.luxury oceanfront homes for sale in hawaii

Indus Medical said...

Dr. Parimi in Indus medical associates, situated in rancho mirage provides a team of health care professionals like Dr. Parimi, highly trained physicians like Dr. Parimi, Primary care physicians, Nurse Practitioners, Medical Assistants and offer primary care services for patients of all ages.

Website primary care : www.indusmedicalassociates.com/
Dr. Parimi in www.indusmedicalassociates.com/

tablescreens1 said...

Oh my goodness! a tremendous article dude. Thank you Nonetheless I'm experiencing difficulty with ur rss . Don know why Unable to subscribe to it. Is there anybody getting equivalent rss problem? Anybody who is aware of kindly respond. Thnkx missouri flatbed trucking companies

tablescreens1 said...

This article was composed by a genuine deduction author. I concur a hefty portion of the with the strong focuses made by the author. I'll be back. river cruises in france