vbox share: What am I doing wrong?

Discussions about using Linux guests in VirtualBox.
Post Reply
ToddAndMargo
Posts: 306
Joined: 6. Aug 2007, 02:24

vbox share: What am I doing wrong?

Post 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
Perryg
Site Moderator
Posts: 34369
Joined: 6. Sep 2008, 22:55
Primary OS: Linux other
VBox Version: OSE self-compiled
Guest OSses: *NIX

Re: vbox share: What am I doing wrong?

Post 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?
ToddAndMargo
Posts: 306
Joined: 6. Aug 2007, 02:24

Re: vbox share: What am I doing wrong?

Post 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
Perryg
Site Moderator
Posts: 34369
Joined: 6. Sep 2008, 22:55
Primary OS: Linux other
VBox Version: OSE self-compiled
Guest OSses: *NIX

Re: vbox share: What am I doing wrong?

Post 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.
ToddAndMargo
Posts: 306
Joined: 6. Aug 2007, 02:24

Re: vbox share: What am I doing wrong?

Post 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
Perryg
Site Moderator
Posts: 34369
Joined: 6. Sep 2008, 22:55
Primary OS: Linux other
VBox Version: OSE self-compiled
Guest OSses: *NIX

Re: vbox share: What am I doing wrong?

Post 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?
ToddAndMargo
Posts: 306
Joined: 6. Aug 2007, 02:24

Re: vbox share: What am I doing wrong?

Post 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
Sasquatch
Volunteer
Posts: 17798
Joined: 17. Mar 2008, 13:41
Primary OS: Debian other
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: Windows XP, Windows 7, Linux
Location: /dev/random

Re: vbox share: What am I doing wrong?

Post 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.
Read the Forum Posting Guide before opening a topic.
VirtualBox FAQ: Check this before asking questions.
Online User Manual: A must read if you want to know what we're talking about.
Howto: Install Linux Guest Additions
Howto: Use Shared Folders on Linux Guest
See the Tutorials and FAQ section at the top of the Forum for more guides.
Try searching the forums first with Google and add the site filter for this forum.
E.g. install guest additions site:forums.virtualbox.org

Retired from this Forum since OSSO introduction.
Post Reply