Page 1 of 1

Shared folders problem - fstab doesn't work

Posted: 22. Jan 2009, 09:46
by klippe
Hi!

My setup: host - windows xp, guest - kubuntu.

I've configured a shared folder called shared_folder in my virtualbox (2.1). Now I can mount it using:

Code: Select all

mount -t vboxsf shared_folder /media/share
It works. The problem is when I try to use fstab to automount the above shared folder. I use the following entry in fstab:

Code: Select all

shared_folder /media/share vboxsf rw,uid=myuser,gid=mygroup 0 0
then after I call:

Code: Select all

sudo mount -a
I get an error:

Code: Select all

[mntent]: line 10 in /etc/fstab is bad
What is strange the same fstab entry works perfectly on my other machine. The only difference is that there I have a linux host and linux guest.

Posted: 22. Jan 2009, 18:38
by TerryE
This has been discussed a number of times. The issue is that fstab is processed very early in the boot sequence and before the vboxsf device driver has been initialised. So your mount will fail. Put the mount in your rc.local (or equivalent for your distro). This is executed late in the boot sequence after the device drivers have been started.

Posted: 22. Jan 2009, 20:24
by klippe
TerryE wrote:This has been discussed a number of times. The issue is that fstab is processed very early in the boot sequence and before the vboxsf device driver has been initialised. So your mount will fail.
So why it doesn't work even after the system is started (so the vbxsf has already been loaded) when I call mount -a?

What's more, as I said earlier, it works on my other system.
Put the mount in your rc.local (or equivalent for your distro). This is executed late in the boot sequence after the device drivers have been started.
Thanks for the hint.

Posted: 22. Jan 2009, 20:46
by TerryE
klippe wrote:So why it doesn't work even after the system is started (so the vbxsf has already been loaded) when I call mount -a?
What is core to Linux is the kernel and a system API that enable programs / applications / utilities to be build to deployed on the OS platform. Details like how the bootstrap sequences is orchestrated varies for Debian derivatives, SuSE, Fedora, Redhat derivatives, etc.

If the vboxsf driver is loaded before the fstab is processed then putting it in the fstab will work, if not then it won't. In the case of Debian systems the fstab is processed before the relevant /etc/rcN.d is used to sequence the start from /etc/init.d. rc.local is processed last.

Posted: 22. Jan 2009, 22:13
by klippe
TerryE wrote:
klippe wrote:So why it doesn't work even after the system is started (so the vbxsf has already been loaded) when I call mount -a?
What is core to Linux is the kernel and a system API that enable programs / applications / utilities to be build to deployed on the OS platform. Details like how the bootstrap sequences is orchestrated varies for Debian derivatives, SuSE, Fedora, Redhat derivatives, etc.

If the vboxsf driver is loaded before the fstab is processed then putting it in the fstab will work, if not then it won't. In the case of Debian systems the fstab is processed before the relevant /etc/rcN.d is used to sequence the start from /etc/init.d. rc.local is processed last.
Thanks for details but...
1. It is still strange - my second system, the working one that uses fstab to mount shared folders, is also Kubuntu (Kubuntu guest on Kubuntu host).

2. My question was about calling

Code: Select all

mount -a
which executes fstab. I call this command after my system __is fully loaded__ . At this time mount -a doesn't work whereas normal manual mount command works perfectly. IMHO boot sequence is not relevant here.

Re: Shared folders problem - fstab doesn't work

Posted: 22. Jan 2009, 22:28
by stephanecharette
klippe wrote:The problem is when I try to use fstab to automount the above shared folder. I use the following entry in fstab:

Code: Select all

shared_folder /media/share vboxsf rw,uid=myuser,gid=mygroup 0 0
I don't know why it doesn't work, but I do have the following to offer: When I look at my own fstab file, I see two differences:

Code: Select all

shared_folder   /home/stephanec/Desktop/shared_folder vboxsf rw,uid=1000,gid=1000
1) first difference is that I've used the numerics instead of the names for user & group

2) second difference is I don't have the trailing "0 0" at the end of the line for dump/check...though man fstab tells me that if not specified it defaults to zero.

On my Ubuntu 8.10 host & Debian Etch guest, this line in my guest fstab ensures the share is mounted every time I reboot. Like what you are trying to do, if I manually unmount it, then "sudo mount -a" will remount it as expected.

Stéphane

Re: Shared folders problem - fstab doesn't work

Posted: 15. Mar 2013, 07:55
by GeneRickyShaw
I had the same problem - not only would fstab not work, but mount -a wouldn't do the trick, either.

But since I put the command in /etc/rc.local, it works fine. That suits me just fine since putting it in /etc/fstab works on normal systems.

Odd flaw, but one that's livable.