Page 1 of 1

vbox share: What am I doing wrong?

Posted: 7. Dec 2010, 02:51
by ToddAndMargo
Hi All,

Host: CentoS 5.5
Guest: Fedora Core 14
vbox: 3.2.12

What am I doing wrong with my mount of shared folders from my host (which do share on my Windows Guests)?

Code: Select all

# from my rc.local
VBShares="/mnt/Virtual.Box.Shared.Folders"
if [ ! -d "$VBShares" ]; then mkdir "$VBShares"; fi
chmod 2777 "$VBShares"
mount -t vboxsf share "$VBShares" -o rw,suid,umask=0

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

Code: Select all

# /sbin/mount.vboxsf -w -o rw,suid share /mnt/Virtual.Box.Shared.Folders
/sbin/mount.vboxsf: mounting failed with the error: Protocol error

# /sbin/mount.vboxsf  share /mnt/Virtual.Box.Shared.Folders
/sbin/mount.vboxsf: mounting failed with the error: Protocol error
I am stumped. :'(

Many thanks,
-T

Re: vbox share: What am I doing wrong?

Posted: 7. Dec 2010, 03:26
by Perryg
As su or sudo

Code: Select all

mount -t vboxsf -o uid=1000,gid=1000 <share name> <mount point>
So if you share name = share and you mount point = /mnt/share

Code: Select all

mount -t vboxsf -o rw,uid=1000,gid=1000 share /mnt/share
Also remember that the share name can not contain spaces or characters.
Question, why the sbin? Also guest additions must be installed for shared folders to work.
Next thing to look at is all the garbage in the rc.local file. Is it really needed? If so can you tell my why?

Re: vbox share: What am I doing wrong?

Posted: 7. Dec 2010, 04:13
by ToddAndMargo
Perryg wrote:As su or sudo
So if you share name = share and you mount point = /mnt/share
Booboo #1: I thought the "share" name was something you just made up. It is the share name from the VB Console shared folders dialog. Got that fixed.

Code: Select all

mount -t vboxsf -o rw,uid=1000,gid=1000 share /mnt/share
Is there a way to set the gid and uid so everyone can read it? (My gid is 100 (users) and my uid is 500)
Also remember that the share name can not contain spaces or characters.
I will change the name to /mnt/VBoxTemp

Question, why the sbin?
"mount" passes the information on to /sbin/mount.vboxsf. I was looking for extra info.
Also guest additions must be installed for shared folders to work.
they are
Next thing to look at is all the garbage in the rc.local file. Is it really needed? If so can you tell my why?
My new rc.local portion dealing with this:

Code: Select all

# Note: the "Usage: /sbin/mount.vboxsf [OPTIONS] NAME MOUNTPOINT"
#       "NAME" is the name given to it in the Virtual Box Console's
#       Shared Folders dialog
Explains what is going on

Code: Select all

HostShareName="Temp"
GuestMountPoint="/mnt/VBoxTemp"
I am in full programing mode. I always put names that are repeated in variables, they way I only have to change the name in one spot. It saves you a ton of headaches

Code: Select all

if [ ! -d "$GuestMountPoint" ]; then mkdir "$GuestMountPoint"; fi
If the mount point does not exist, then create it. This is a butt saver.

Code: Select all

chmod 2777 "$GuestMountPoint"
sets the sticky bit so whoever is trying to use it can take ownership of it. Also lets me know what the ownership needs to be after whoever has taken ownership. It is also a butt saver

Code: Select all

echo "mount -t vboxsf "$HostShareName" "$GuestMountPoint" -o rw,suid,umask=0"
helps with hand troubleshooting

Code: Select all

mount -t vboxsf "$HostShareName" "$GuestMountPoint" -o rw,suid,umask=0
the actual mount call.
Code is cheap.


And, it still does not work! Rats!

<SharedFolders>
<SharedFolder name="Temp" hostPath="/home/OurStuff/Temp" writable="true"/>
</SharedFolders>

# ls -al /mnt
drwxrwsrwx. 2 root root 4096 Dec 6 15:51 VBoxTemp

# mount -t vboxsf Temp /mnt/VBoxTemp
/sbin/mount.vboxsf: mounting failed with the error: No such file or directory

What no directory?!?!?! :'( What crappy error messages!

Poop!
-T

Re: vbox share: What am I doing wrong?

Posted: 7. Dec 2010, 04:28
by Perryg
OK first forget the rc.local until you get a mounted share. Once you have achieved that you SHOULD create a script outside the rc.local and call the script. Not too hip on putting garbage in the rc.local myself.

The best way to make these things available if there are multiple users is to move everything out to a local folder that is accessible by everyone and then set the user variables accordingly. You don't actually need the uid, gid if this is linux to linux. Usually this is given rw but you can always change the permission on the mount folder manually if you need to.

Re: vbox share: What am I doing wrong?

Posted: 7. Dec 2010, 04:34
by ToddAndMargo
Sounds good. I tend to put everything I need in my rc.local, unless I need to call the code twice from somewhere else. Then I make a script all of its own that everyone can call. Same idea as using variables for repeated names.

Any idea what "No such file or directory" actually means?

Code: Select all

# mount -t vboxsf Temp /mnt/VBoxTemp
/sbin/mount.vboxsf: mounting failed with the error: No such file or directory
-T

Re: vbox share: What am I doing wrong?

Posted: 7. Dec 2010, 04:47
by Perryg
Does /mnt/VBoxTemp exist?
Does the share name Temp really exist in the shared folder section?
Have you rebooted the guest after you installed the guest additions?

Re: vbox share: What am I doing wrong?

Posted: 7. Dec 2010, 05:01
by ToddAndMargo
Perryg wrote:Does /mnt/VBoxTemp exist?
Yup: As evidence:

# ls -al /mnt
drwxrwsrwx. 2 root root 4096 Dec 6 15:51 VBoxTemp
Does the share name Temp really exist in the shared folder section?
Yup. As evidence from "VB-FC14.xml":

<SharedFolders>
<SharedFolder name="Temp" hostPath="/home/OurStuff/Temp" writable="true"/>
</SharedFolders>
Have you rebooted the guest after you installed the guest additions?
About eight times (testing other things). Shared clipboard and shared mouse work fine.

I am stumped. :'(
-T

Re: vbox share: What am I doing wrong?

Posted: 7. Dec 2010, 20:25
by Sasquatch
It could be the name of the SF. Try lower case only. I guess you've read my howto already. If you haven't, take a look at it, it might get you somewhere, even though you show that you already know what needs to be done.