Page 1 of 1
[SOLVED] Shared folder disappears after guest boot
Posted: 3. Jun 2016, 18:44
by kalevala
Dear all,
I am not new to the use of VB or shared folders at all; I have been using a couple of virtual machines sharing folders with the host for some time but the trouble comes when I try to set them up on a new machine.
My specifications are:
VM: 5.0.20 r106931
Host: Linux Mint 17.3 Rosa
Guest: Ubuntu 14.04.03, freshly installed
Incidentally one of my old machines is also Ubuntu 14.04.03 and it didn't cause any trouble at the beginning or now.
I had to go through a nightmarish process in order to install Guest Additions. Basically, I had to install dkms and build-essential through the terminal, find the right folder for Linux headers and install those as well. After that, the GA CD wouldn't run automatically and I had to find the right text to type as well, which wasn't easy. This is unprecedented, since I remember the process always went smoothly in the past. (Sorry about the rant!)
I finally could access the shared folder from the guest and work with it as usual, but it's not there after I reboot, so I have to mount it every time.
Any help would be appreciated.
PS: I know a few similar queries have been asked before but they don't apply to my OS.
Re: Shared folder disappears after guest boot
Posted: 3. Jun 2016, 19:22
by Perryg
Linux guest shared folders
See the section on /etc/rc.local
Re: Shared folder disappears after guest boot
Posted: 6. Jun 2016, 12:57
by kalevala
Thanks very much, Perryg!
I have seen the post you mentioned but am not an advanced Linux user and have some questions:
- When it says "put the mount command in /etc/rc.local", does it mean "write the mount command in the terminal in that folder"? Or maybe I need to create a file with the command in it?
- I don't have such a folder in my system. Instead I've got rc0d, rc1d, through to rc6d. Would these work?
I have written the command "mount -t vboxsf -o rw,uid=1000,gid=1000 [folder to share] [path to mounting point]" in the terminal in both the rc0d and rc6 files, as well as fstab.d. The folder is mounted alright, but it's still not there after I reboot.
(For the record, I have ticked the right boxes in the shared folder settings in VB interface. Should this not be enough?).
Thanks again.
Re: Shared folder disappears after guest boot
Posted: 6. Jun 2016, 13:41
by Perryg
That's odd. I just checked and even Ubuntu 16.10 has /etc/rc.local. The mount goes in the guest as you know and it should go at the end of the file but before the exit 0
Code: Select all
ubuntu@ubuntu-16:~$ cat /etc/rc.local
#!/bin/sh -e
#
# rc.local
#
# This script is executed at the end of each multiuser runlevel.
# Make sure that the script will "exit 0" on success or any other
# value on error.
#
# In order to enable or disable this script just change the execution
# bits.
#
# By default this script does nothing.
exit 0
ubuntu@ubuntu-16:~$
Easiest way to add the command is to type the following
You can replace gedit with vi, vim, or any editor you prefer.
Edit: I just realized that you thought /etc/rc.local was a folder. It is a file.
Re: Shared folder disappears after guest boot
Posted: 6. Jun 2016, 16:31
by kalevala
Thanks again, Perryg!
It worked. Your advice was great.
Now my question is why my shared folder is mounted ok on booting older virtual machine every time (same Ubuntu release as the new one) even though its corresponding rc.local file is empty. It is no rhetorical question? Is this some kind of bug that would need reporting?
Re: [SOLVED] Shared folder disappears after guest boot
Posted: 6. Jun 2016, 16:37
by Perryg
Depends on whether or not you select to auto-mount the shared folder in the guest settings. This creates a special media and is mounted as removable media with the user having their name on the vboxsf group on the guest. But this is an inferior way IMHO since most users will have permission issues. My preference is to use the manual mount and specify the permission level in the mount statement then you do not have permission issues. I'm an old dog with *nix and have the old habits which are hard to break. That said it is always up to the end user to use what they prefer.
By the way a long time ago ( in computer years ) it was acceptable practice to mount these in /etc/fstab, but this caused its own issues with not booting properly or even not allowed in newer releases.
Re: [SOLVED] Shared folder disappears after guest boot
Posted: 6. Jun 2016, 16:41
by kalevala
Perryg wrote:Depends on whether or not you select to auto-mount the shared folder in the guest settings.
Actually, the box had been ticked all the time, so it must be something else.
Re: [SOLVED] Shared folder disappears after guest boot
Posted: 6. Jun 2016, 16:45
by Perryg
Auto-mount requires that you have your user in the vboxsf group and a following reboot. Then the share will show in the /media folder and will have the name <share>_sf
Remember that I do not use this type of mount for the reasons stated above.