Page 1 of 2

Ubuntu guest cannot write to shared folder

Posted: 8. Jul 2014, 23:03
by Frank Natoli
Windows 7 host system. Oracle VM VirtualBox 4.3.12. Ubuntu guest 14.05. dkms installed. Mounted share drive via VirtualBox. Checked "auto mount" and "make permanent" but did not check "read only". From Ubuntu, can copy files out of shared folder to local Ubuntu folder. Can "touch" or "vi" new files in share folder. But cannot "cp" files to share folder; get "protocol error". Local Ubuntu login is member of vboxsf which is group of /media/sf_xxx that I am attempting to copy files to. Why would Ubuntu allow me to "touch" and "vi" files in /media/sf_xxx but not "cp" files to /media/sf_xxx? Thanks.

Re: Ubuntu guest cannot write to shared folder

Posted: 8. Jul 2014, 23:14
by Perryg
http://www.virtualbox.org/manual/ch04.h ... mount_auto

But it is my experience that auto mount has permission issues even if you are a member of the vboxsf group.

Use manual mount with the option switch to control the permissions in the guest and add the mount statement to the /etc/rc.local to make it permanent.

Re: Ubuntu guest cannot write to shared folder

Posted: 8. Jul 2014, 23:22
by Frank Natoli
@Perryg: your experience is also mine. I can auto mount. I can see the shared folder from the Ubuntu guest. I can read files from the shared folder [i.e., from the Windows folder] on the Ubuntu guest. Most bizarrely, I can "touch" and "vi" new files in the shared folder from the Ubuntu guest and then see and read those files from the Windows system, so it's not strictly speaking a read only / write protection problem. But if I attempt to "cp" or "mv" files from Ubuntu guest to the shared folder, I get "protocol error".

Can you suggest the exact syntax for a "mount" command on the Ubuntu guest, which I presume is what you mean by "manual mount"?

The syntax for the final argument, the mount point, is proving impossible for me to resolve.

The Windows folder is "C:\tmp100".

Should also add that prefixing the "cp" or "mv" with "sudo" doesn't help. Thanks.

Re: Ubuntu guest cannot write to shared folder

Posted: 8. Jul 2014, 23:36
by Perryg

Code: Select all

sudo mount -t vboxsf -o rw,uid=1000,gid=1000 <share name> <mount point>
Add all but the sudo to the /etc/rc.local

the -o is for option so it is an o not zero
Assume your uid and gid =1000, change as needed ( id in terminal will tell you )
replace the <share name> with the name you entered in the shared folder of VBox GUI.
replace <mount point> with the mount point you create to hold the share. I use /mnt/share. Do *not* change the permissions on the mount point. It should be root:root. the mount will take care of the rest if you do it correctly.

Re: Ubuntu guest cannot write to shared folder

Posted: 8. Jul 2014, 23:38
by Perryg
Oh and there will still be an occasional issue because Windows and Linux do not use the same functions when it comes to permissions. I find that if I add a file to the share from the Windows host it sometimes does not have the proper permission on the guest. I don't know anything that can be done for that. It usually does not cause a real issue but can.

Re: Ubuntu guest cannot write to shared folder

Posted: 9. Jul 2014, 00:10
by Frank Natoli
Sorry, no luck. Removed the auto mount declaration in VirtualBox. Then from Ubuntu guest terminal tried:

sudo mount -t vboxsf -o rw,uid=1000,gid=1000 "c:\tmp100" /mnt/tmp100

Got "no such file or directory". Went to /mnt then "sudo mkdir tmp100" then repeat mount and got "protocol error".

Also tried:

sudo mount -t vboxsf -o rw,uid=1000,gid=1000 "c:\tmp100" /media/sf_tmp100

And again got "protocol error". The sf_tmp100 was a relic from the auto mount declaration from VirtualBox.

"id" did indicate that both uid and gid are 1000.

You wrote that "share name" should be same as "shared folder" in VirtualBox GUI. In fact, there are two edit boxes in that dialog, "folder Path" and "folder Name". I was using "c:\tmp100" and "tmp100" respectively.

Thanks for your time.

Re: Ubuntu guest cannot write to shared folder

Posted: 9. Jul 2014, 00:22
by Perryg
What did you actually use for the share name when you setup the share in the GUI? Tell me you didn't use c:\.....

If you did then change that to a simple single word. No special characters or spaces.
Also did you create the folder /mnt/tmp100? This is mandatory, you have to create the mount point.

Re: Ubuntu guest cannot write to shared folder

Posted: 9. Jul 2014, 00:39
by Frank Natoli
Yes, in the VirtualBox GUI, for "folder Path" I specified "c:\tmp100" and the GUI automatically filled "folder Name" with "tmp100".

You write "share name" but no such edit box appears in the VirtualBox GUI. There are two edit boxes, labeled "folder Path" and "folder Name". Plus two checkboxes.

I wish I could attach a screenshot but there doesn't seem to be a way to do so on this forum.

Yes, I created /mnt/tmp100. Before doing so, I got "no such file or directory". After doing so, I got "protocol error".

Thanks for your time.

Re: Ubuntu guest cannot write to shared folder

Posted: 9. Jul 2014, 01:05
by Perryg
Then you would use the following

Code: Select all

sudo mount -t vboxsf -o rw,uid=1000,gid=1000 tmp100 /mnt/tmp100

Re: Ubuntu guest cannot write to shared folder

Posted: 9. Jul 2014, 02:06
by Frank Natoli
That also returns "no such file or directory".

Clarification: when using "mount" from terminal session, I presume you do NOT want a shared folder declared from the VirtualBox Manager, correct?

I am assuming one or the other but not both. Either VirtualBox manager shared folder declaration OR terminal session "mount" but not both. Correct?

Let me suggest considering for a moment how I can succeed at "touch" and "vi", creating new files in the shared folder from the Ubuntu guest session, but failing at "cp" and "mv". It's NOT a simple matter of write protection / read only. There's something different about what "cp" and "mv" do versus "touch" and "vi". I know it doesn't make sense but it's true.

One more strange fact: "cp" to the share folder fails. "cp -l" fails. Very curiously, "ln -s" fails with "read-only file system". Yet "touch" and "vi" allow me to write files in the share folder which Windows can then see.

I suppose I should also ask: any chance Norton on the Windows system is interfering?

Thanks for your time.

Re: Ubuntu guest cannot write to shared folder

Posted: 9. Jul 2014, 02:23
by Perryg
Post the guests log file ( as an attachment ) Compress if too big.
As well as the results of the following:

Code: Select all

VBoxManage showvminfo <name | UUID>
Note: You need to be in the folder that has VBoxManage.exe for the command to work.

Re: Ubuntu guest cannot write to shared folder

Posted: 9. Jul 2014, 02:56
by Frank Natoli
See attached. Thanks for your time.

Re: Ubuntu guest cannot write to shared folder

Posted: 9. Jul 2014, 03:18
by Perryg
Name: 'tmp100', Host path: 'C:\tmp100' (machine mapping), writable

So if you created the mount point of /mnt/tmp100 the mount would be as follows:

Code: Select all

sudo mount -t vboxsf -o rw,uid=1000,gid=1000 tmp100 /mnt/tmp100
If this does not work I need to know the exact error message.

Re: Ubuntu guest cannot write to shared folder

Posted: 9. Jul 2014, 04:53
by Frank Natoli
I am assuming you wish to have the share folder declared by the VirtualBox GUI and then have the mount command executed in the Ubuntu terminal session.

That being the case, the mount command succeeds, but any attempt to copy files into the share folder "/mnt/tmp100" fails as follows:

cd /mnt/tmp100
sudo cp /home/frankn/Pictures/S* .
cp: cannot create regular file './Screenshot from 2014-07-07 20:37:06.png': Protocol error
cp: cannot create regular file './Screenshot from 2014-07-08 12:33:53.png': Protocol error

I should also note that "ls -l" after the above "sudo cp" shows several files including "foo" which I created and edited with "vi".

So again, I can "touch" or "vi" files in the share folder but cannot "cp" or "mv" into the share folder.

Thanks for your time. Calling it a night [22:53 EDT].

Re: Ubuntu guest cannot write to shared folder

Posted: 9. Jul 2014, 04:55
by Frank Natoli
Update: /mnt/tmp100 shows protection r-xr-x-r-x and "sudo chmod 777 /mnt/tmp100" does not fail but also does not change the protection.