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

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

6 Answers 6

up vote 29 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 '14 at 15:53
    
@ThePosey Glad to have helped! –  Richard Turner Feb 12 '14 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 '14 at 7:59
    
What is actual line of code/text that is used with this solution? @Reinis –  qodeninja Mar 10 at 1:40
1  
@qodeninja As I said in my second paragraph: "Just add vboxsf on a line of its own in /etc/modules. –  Richard Turner Mar 10 at 8:53

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: The boot process might freeze, if a shared folder cannot be mounted. So test your configuration, before you add the module to initramfs. If your system hangs anyway, you can boot in recovery mode to fix the problem.

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 '14 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 '14 at 12:46
    
I've added a warning to the answer to make things clearer. –  Torben Nov 27 '14 at 12:51

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

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 had the same problem, and was working through the suggested solutions, but without success. Torben's solution froze the boot, so had to undo it. Then I thought I should troubleshoot /etc/fstab using sudo mount -a. The syntax of my entry looked perfect, but it still failed. I was also able to manually mount the filesysten using the mount command in the terminal window.

What I found is that I had spaces between the first two parameters (device and mount point). I replaced them with a tab and it works. Really?!!!!

share|improve this answer
    
Are you sure it was two space characters (ASCII code 32)? Because one or more of those should be just as fine as a tab character. Sometimes I accidentally type non-breaking space characters when I press my shift key to early or release it too late while pressing the space bar. They look the same but confuse many applications. –  David Foerster Feb 3 at 1:10
    
All I know is that I backspaced over all of the white space and inserted a single tab and it then it worked. –  svenyonson Feb 4 at 3:52

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.