Shared folder rc.local mout not working

Discussions about using Linux guests in VirtualBox.
Post Reply
adzam
Posts: 9
Joined: 22. Aug 2016, 21:06

Shared folder rc.local mout not working

Post by adzam »

I am trying to automatically mount my shared folder at boot. Host is Windows 10, guest is Debian 8.5. I can mount it no problem manually, but if I add the mount string to rc.local as advised in the how to thread (viewtopic.php?f=29&t=15868) it does not work.

#systemctl status rc-local.service
rc-local.service - /etc/rc.local Compatibility
Loaded: loaded (/lib/systemd/system/rc-local.service; static)
Active: failed (Result: exit-code) since Tue 2016-08-30 23:43:33 EDT; 7min ago
Process: 436 ExecStart=/etc/rc.local start (code=exited, status=1/FAILURE)

Aug 30 23:43:33 kingdra rc.local[436]: /sbin/mount.vboxsf: mounting failed with the error: No such device
Aug 30 23:43:33 kingdra systemd[1]: rc-local.service: control process exited, code=exited status=1
Aug 30 23:43:33 kingdra systemd[1]: Failed to start /etc/rc.local Compatibility.
Aug 30 23:43:33 kingdra systemd[1]: Unit rc-local.service entered failed state.


#sudo /etc/init.d/rc.local start
Runs without error and mounts the folder.

The how to thread mentioned above states
The Shared Folders service should mount them automatically, but that doesn't always happen.
What causes it to not always work? Is there any way around this?

Thanks in advance for any input!
Perryg
Site Moderator
Posts: 34369
Joined: 6. Sep 2008, 22:55
Primary OS: Linux other
VBox Version: OSE self-compiled
Guest OSses: *NIX

Re: Shared folder rc.local mout not working

Post by Perryg »

The problem is the OS running rc.local too fast, before the service is actually loaded. Add a sleep 10 in the script line.

Example

Code: Select all

sleep 10 && mount -t vboxsf -o rw,uid=1000,gid=1000 Public /mnt/Public &
adzam
Posts: 9
Joined: 22. Aug 2016, 21:06

Re: Shared folder rc.local mout not working

Post by adzam »

Worked perfect. Thank you!
Post Reply