Request correct sequence to bidirectionally share folders between Win10 Host & Ubuntu16.04 Guest

Discussions about using Linux guests in VirtualBox.
Locked
woodrock
Posts: 26
Joined: 9. Jun 2017, 08:17

Request correct sequence to bidirectionally share folders between Win10 Host & Ubuntu16.04 Guest

Post by woodrock »

This is a Linux Guest question for VirtualBox file and folder sharing between a Windows 10 host and a Ubuntu 16.04 guest.

I finally got bidirectional file sharing working, so, this is just a request to clarify the minimum steps required on both the Windows 10 host and the Ubuntu 16.04 guest in order to effect simple bidirectional file and folder sharing.

Since this is designed to benefit others so that they can just cut and paste the commands, actual folder names are used below (which the user may change before cutting and pasting, as desired). However, the steps below are intended to be guaranteed to work, which is the goal of a well-written tutorial.

STEP 1: Determine the names and location of the desired bidirectional folder sharing:
WINDOWS: C:\tmp\shared\vmsharew (which stands for vm share windows)
LINUX: /home/usr1/vmsharel/ (which stands for vm share linux)

STEP 2: Before you can enable folder sharing, insert & install the Guest CD image:
Look to see if you have the Guest Additions CD image:
C:\Program Files\Oracle\VirtualBox\VBoxGuestAdditions.iso
GuestOS: Devices > Insert Guest Additions CD Image...
Allow it to "run" which will unpack and install Linux software.

STEP 3: Create the Windows host directory to be shared:
C:\> mkdir c:\tmp\shared\vmsharew\

STEP 4: Enable the file & folder sharing on the Ubuntu 16.04 Guest OS:
GuestVM: Devices > Shared Folders > Shared Folders Settings...
(Click the "Plus" sign to add a new shared folder setting.)
For a Unbutu guest OS, that opens a Windows Explorer on the host
Select the existing folder, e.g., C:\tmp\shared\vmsharew\
Folder Path: C:\tmp\shared\vmsharew
Folder Name: ubuntu1604x64 (name it whatever you want)
[_] Read-only
[x] Auto-mount (mounts the folder immediately, won't survive reboot)
Default mount point is: /media/sf_ShareName
Default permissions are: 770
Default owner is root & the default group is vboxsf
[x] Make permanent (makes the folder persistent, sticks upon reboot)
Note: Despite documentation to the contrary, using fstab to auto-mount VirtualBox shared folders during boot does not work in recent versions of Ubuntu as VirtualBox services start after the filesystem is mounted.

I think you have to reboot the Ubuntu 16.04 Guest OS for it to actually work but the instructions leave this up in the air.

STEP 5: Change the permissions and group for the user on the Ubuntu 16.04 Guest OS:
$ sudo ls -l /media
drwxrwx--- 1 root vboxsf 0 Jul 21 12:42 sf_ubuntu1604x64

Add the user to the vboxsf group (assume your username is "usr1")
$ sudo usermod -a -G vboxsf usr1
Well, that did nothing useful because you still get permission denied.
So let's try this instead.
$ sudo adduser usr1 vboxsf
Well, that just says you're already there, so, there's something else wrong.
$ id usr1
That shows you're a member of the group.
Maybe you have to reboot again to make VirtualBox accept these commands?
OK. So a Ubuntu Guest OS reboot solved that permission problem (why don't they just say so?).

STEP 6: Link to the desired location on the Ubuntu 16.04 Guest OS:
$ sudo ln -s /media/sf_ubuntu1604x64 /home/usr1/vmsharel
You still get permission denied so let's open it up (but why isn't this described in the documentation?)
$ sudo chown -R x vmsharel

Let's try to manually mount the shared folder:
$ sudo mount -t vboxsf -o uid=$UID,gid=$(id -g) sf_ubuntu1604x64 sf_ubuntu1604x64

Reboot.
Well, whatever I did above, finally worked.

I can now bidirectionally access a file that is in the location:
WINDOWS: C:\tmp\shared\vmsharew
LINUX: /home/usr1/vmsharel/

In the end, this worked to share a file between Windows host and Ubuntu guest, but...
1. Can we simplify the sequence of events (and omit the trial and error?)
2. When do you have to reboot so that the command you ran actually do something?
3. Did I really have to set the permissions wide open just to get it to work?
4. Did I really have to change the ownership just to get it to work?
Last edited by woodrock on 26. Jul 2017, 15:50, edited 4 times in total.
socratis
Site Moderator
Posts: 27329
Joined: 22. Oct 2010, 11:03
Primary OS: Mac OS X other
VBox Version: PUEL
Guest OSses: Win(*>98), Linux*, OSX>10.5
Location: Greece

Re: Request correct sequence to bidirectionally share folders between Win10 Host & Ubuntu16.04 Guest

Post by socratis »

woodrock wrote:1. Can we simplify the sequence of events (and omit the trial and error?)
Yes. You should stop writing instructions. That would definitely simplify a really simple process. Just like it is written in the manual, and thousands upon thousands of users had zero problems understanding and implementing.

I'm going to quickly point some mistakes that you did:
  1. Guest Additions CD
    woodrock wrote:D. Download Virtualbox Guest Additions
    You do NOT need to download the Guest Additions, they come bundled with your VirtualBox installation. In order to install them you follow the instructions in the User Manual, ch. 4. You read it right? Of course you didn't otherwise you wouldn't have made this noob mistake:
    User Manual, Section [url=https://www.virtualbox.org/manual/ch04.html#mountingadditionsiso]4.2.1.1, Installation[/url] wrote:In the "Devices" menu in the virtual machine's menu bar, VirtualBox has a handy menu item named "Insert Guest Additions CD image", which mounts the Guest Additions ISO file inside your virtual machine. A Windows guest should then automatically start the Guest Additions installer, which installs the Guest Additions into your Windows guest. Other guest operating systems (or if automatic start of software on CD is disabled) need manual start of the installer.
  2. Location
    woodrock wrote:Where are you? Los Angeles [Continue]
    Seriously? This will fail for 99% of the users. Bad, bad instructions.
  3. Uncertainty
    woodrock wrote:Sometimes that's required. Sometimes it's not required.
    I have no idea why the mouse is so flaky but that's the least of your problems
  4. Useless/confusing steps/instructions
    woodrock wrote:J. Enable the mouse to flow from Guest to Host & vice versa
    woodrock wrote:K. Enable clipboard sharing
    woodrock wrote:L. Enable drag and drop
    None of the above are needed to make shared folders work.
You've repeated time and time again that you are a technical writer. I expect the user manuals you've written to be the size of "Cyrus the Great". Sometimes you do NOT need to get to every single detail, otherwise you're going to lose your audience. TL;DR was invented for cases like these. In fact you were driving the whole forum crazy with the length of your posts, so much so that you had one of your topics locked to prevent the madness from spreading.


Plus, you forgot several really important steps at the beginning of your tutorial:
  1. Get dressed.
  2. Drive to the computer store.
  3. Buy a computer. Cash or credit card is up to you.
  4. Return home with the acquired computer.
  5. Unpack the computer.
  6. Connect all the peripherals. Note: you may have a wireless keyboard/mouse, in which case you do NOT need to connect anything.
  7. Boot the computer.
  8. ...
Do NOT send me Personal Messages (PMs) for troubleshooting, they are simply deleted.
Do NOT reply with the "QUOTE" button, please use the "POST REPLY", at the bottom of the form.
If you obfuscate any information requested, I will obfuscate my response. These are virtual UUIDs, not real ones.
woodrock
Posts: 26
Joined: 9. Jun 2017, 08:17

Re: Request correct sequence to bidirectionally share folders between Win10 Host & Ubuntu16.04 Guest

Post by woodrock »

socratis wrote:That would definitely simplify a really simple process.
If the process were as simple as you intimate, then why isn't there a step by step tutorial for file and folder sharing between a Windows 10 host and a Ubuntu 16.04 guest that actually works, both of which are the current dominant operating systems today?
socratis wrote:Just like it is written in the manual, and thousands upon thousands of users had zero problems understanding and implementing.
As I recall, the manual says to use the fstab, which stands almost zero chance of working on Ubuntu 16.04, which is the current version of Ubuntu today.
socratis wrote: [*]Guest Additions CD
In my experience, the Guest Additions CD isn't always found, especially when the actual installation of VirtualBox isn't in C:\Program Files hierarchy. That implies there is a bug in VirtualBox which doesn't seem to recognize when VirtualBox is installed outside the default location. This is not a big deal though, as you can search for the Guest Additions CD, which is why I mentioned the default location in the writeup.
socratis wrote: Sometimes you do NOT need to get to every single detail, otherwise you're going to lose your audience.
Thanks for that advice. It was my running log, which got confusing, even for me, since the instructions in the documentation didn't come close to effecting the desired results.

I think most of the issues are in the key questions of:
Q1: When exactly do you have to reboot the Guest Ubuntu 16.04 OS to make the commands stick?
Q2: What exact minimum sequence of commands is required on the Windows 10 host to bidirectionally share a folder?
Q3: What exact minimum sequence of commands is required on the Ubuntu 16.04 guest to bidirectionally share a folder?
mpack
Site Moderator
Posts: 39134
Joined: 4. Sep 2008, 17:09
Primary OS: MS Windows 10
VBox Version: PUEL
Guest OSses: Mostly XP

Re: Request correct sequence to bidirectionally share folders between Win10 Host & Ubuntu16.04 Guest

Post by mpack »

Frankly, I see no point in waiting. Woodrock seems to be of the opinion that good technical writing involves summarising the whole history of human technology (stream of consciousness style) before we can get to the important point. This is not an opinion I share. In the meantime we get a confusing mess of misinformation and verbosity.

Good technical writing uses jargon for good reason, because without it the writer would have to invent and then explain every term used, and the important facts would be lost in a sea of gibberish. IMHO the authors of the user manual need take no lessons from the OP on how to write clearly, so I advise any readers wishing to know how to enable GA Shared Folders in a Linux guest should read what the user manual has to say on the subject. Also read how to install the Linux GAs.

Locking this.
Perryg
Site Moderator
Posts: 34369
Joined: 6. Sep 2008, 22:55
Primary OS: Linux other
VBox Version: OSE self-compiled
Guest OSses: *NIX

Re: Request correct sequence to bidirectionally share folders between Win10 Host & Ubuntu16.04 Guest

Post by Perryg »

Also the howto here that was created in 2009 but is still relevant.

viewtopic.php?f=29&t=15868
Locked