Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I've got Ubuntu 13.10 installed in Virtualbox 4.3. The host machine is Windows.

I have a couple of Virtualbox shared folders being mounted by /etc/fstab. Until recently this setup worked just fine, but after upgrading from Ubuntu 13.04 and Virtualbox 4.2 (at essentially the same time) the fstab mounting stopped working. I get the following error during boot:

An error occurred while mounting /home/benme/Documents.
keys:Press S to skip mounting or M for manual recovery

Pressing M for manual recovery and then trying to mount manually also fails:

root@benme-vb:~# cd /home/benme
root@benme-vb:/home/benme# mount Documents
/sbin/mount.vboxsf: mounting failed with the error: No such device

But if I instead skip mounting during boot, wait for Unity to start and then mount manually in a shell, everything works fine:

benme-vb ~ % ls Documents
benme-vb ~ % sudo mount Documents
[sudo] password for benme: 
benme-vb ~ % ls Documents
    # actual file list omitted

Note that when I mount manually I'm letting mount take all the options from /etc/fstab, and it works. This suggests to me that it's some sort of timing issue, where Virtualbox isn't "ready" to provide the shared file mounts at the point /etc/fstab mounts are run during bootup.

Here's the fstab line, just for completeness:

Documents       /home/benme/Documents   vboxsf  uid=benme,gid=benme,dmode=774,fmode=664     0   0

Is there something I can do about this from the Ubuntu side? Or does anyone happen to know more about this from the Virtualbox angle?

I've found an old report on the Virtualbox bug-tracker with identical symptoms, but in that case the user had updated Virtualbox without updating their guest additions and resolving that fixed the problem; this isn't happening here, I've definitely got the 4.3 guest additions installed.

share|improve this question

5 Answers 5

up vote 14 down vote accepted

I ran afoul of this problem too. I mount /var/www using VBox shared folders functionality, so this was quite annoying.

The solution I found was to force the vboxsf module to be loaded early, before the mounting of file systems. Just add vboxsf on a line of its own in /etc/modules.

Another solution is to set noauto in /etc/fstab and manually mount drives in /etc/rc.local, but this wasn't such a good solution for me because by that time Apache has already started and been unable to find anything in /var/www.

share|improve this answer
    
awesome! adding to /etc/modules worked perfectly. thanks Richard! –  ThePosey Feb 11 at 15:53
    
@ThePosey Glad to have helped! –  Richard Turner Feb 12 at 8:46
    
This was issue for me on Ubuntu Server 14.04 guest. And this answer (the /etc/modules solution) solved it for me. Thanks! P.S Btw, if you by chance, trying to figure out / fix things, enabled Auto-mount in Virtualbox settings, disable it again ;) –  Reinis Jul 15 at 7:59

In addition to Richard Turner's suggestion of adding , I suggest adding the _netdev mount option. I tested on Ubuntu 12.04 LTS and this seems to add just the right amount of delay for the mount to succeed.

My /etc/fstab entry:

dev /media/dev vboxsf defaults,_netdev 0 0

share|improve this answer

Richard's fix stopped working for me after the last update (VirtualBox 4.3.18, Ubuntu 14.04). Luckily I was able to fix it, by loading vboxsf right with the kernel:

# echo "vboxsf" >> /etc/initramfs-tools/modules
# update-initramfs -u

The first command adds a parameter to load the module to the kernel and the second updates the init file system. After a reboot I was able to use my fstab-mounts again :)

Warning: Loading the module that early might freeze the boot process, if a shared folder cannot be opened. So test your configuration, before including the module.

share|improve this answer
    
I tried this solution to load the vboxsf module earlier ... It just froze my boot sequence so I had to remove it. –  Rerito Nov 27 at 9:05
    
Yeah, including the module that early might freeze the boot process, if your shared folder configuration is broken. However, I never experienced any boot freezes with a correct configuration... –  Torben Nov 27 at 12:46
    
I've added a warning to the answer to make things clearer. –  Torben Nov 27 at 12:51

I just wanted to say that forcing the vboxsf module to load early helped me (as in Richard Turner's answer), but the fstab line still didn't work for me.

What I ended up doing was putting the mount command (which did work) into /etc/rc.local. A bit of a hack but it worked.

share|improve this answer

I believe I've found the right way to deal with this in Arch Wiki. Use comment=systemd.automount option.

The above option goes in the /etc/fstab file with the other options. For example:

Fedora /var/ftp/pub/Fedora vboxsf uid=1001,gid=1001,comment=systemd.automount 0 0
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.