You are not logged in.
I have a Virtualbox VM running Arch Linux (the host is also Arch, incidentally).
I'm trying to automatically mount some shared folders in some specific locations using /etc/fstab. I do not want them mounted in Virtualbox's default /media/sf_whatever paths.
I have the following entries in /etc/fstab:
srv /srv vboxsf gid=109,suid,fmode=664,nofail 0 0
share2 /share2 vboxsf gid=109,suid,fmode=664,nofail 0 0
p_daddy /home/p_daddy/host vboxsf uid=1000,gid=1000,noauto,x-systemd.automount 0 0Group 109 is vboxsf.
The mount in my user directory isn't necessary unless I try to use it, so it's set to noauto, and x-systemd.automount causes it to get mounted the first time I access it. That works beautifully.
The other two mounts don't work so well. For the record, I've tried replacing nofail with the same noauto,x-systemd.automount options I've used on the p_daddy share, but if I do that, when I try to access the mount points, I get "no such device" every time.
With /etc/fstab as above, the srv and share2 mounts simply fail:
$ journalctl -u srv.mount
...
-- Reboot --
Jul 08 16:04:39 Joker systemd[1]: Mounting /srv...
Jul 08 16:04:39 Joker mount[260]: mount: /srv: mount(2) system call failed: No such file or directory.
Jul 08 16:04:39 Joker systemd[1]: srv.mount: Mount process exited, code=exited, status=32/n/a
Jul 08 16:04:39 Joker systemd[1]: srv.mount: Failed with result 'exit-code'.
Jul 08 16:04:39 Joker systemd[1]: Failed to mount /srv.But what's weird is that after I log in, I can execute sudo mount -a and /srv and /share2 are mounted successfully.
So I figured maybe the right kernel modules just aren't loaded yet when the mount units run. I figured I'd hack around that by adding a service that retried the mounts once most things are up and running:
$ cat /etc/systemd/system/retry-missed-mounts.service
[Unit]
Description=Retry mounts that failed during boot
Wants=network-online.target
After=network-online.target
[Service]
Type=oneshot
ExecStart=/bin/mount -a
[Install]
WantedBy=multi-user.targetBut that fails:
$ journalctl -u retry-missed-mounts.service
...
Jul 08 16:04:40 Joker mount[336]: mount: /srv: mount(2) system call failed: No such file or directory.
Jul 08 16:04:40 Joker mount[336]: mount: /share2: mount(2) system call failed: No such file or directory.Even if I try restarting the service after I've logged in:
$ sudo systemctl restart retry-missed-mounts.service
Job for retry-missed-mounts.service failed because the control process exited with error code.
See "systemctl status retry-missed-mounts.service" and "journalctl -xe" for details.
$ journalctl -u retry-missed-mounts.service
...
Jul 08 16:08:12 Joker mount[424]: mount: /srv: mount(2) system call failed: No such file or directory.
Jul 08 16:08:12 Joker mount[424]: mount: /share2: mount(2) system call failed: No such file or directory.But again, running the same mount -a command manually works fine.
$ sudo mount -a
$ ls /srv
some stuff in there
$ ls /share2
some more stuff in thereAny idea why the mounts would fail when run by systemctl but not with sudo? Any idea on a workaround?
Offline
Please see https://bugs.archlinux.org/task/61307#comment179937
Edit:
Oh and welcome to the arch linux forums P_Daddy.
Last edited by loqs (2019-07-08 20:32:42)
Offline
A patch to a patch. That's fun to read. :-)
Do you know, does this fix mounting with fstab in addition to Virtualbox's /media/sf_whatever automounter?
Also, this bug report is several months old and low priority. Is my best bet to apply this patch manually? Because I'm not sure how.
Offline
I believe it fixes fstab mounting as well. Download the src.tar.gz then
bsdtar -xf virtualbox-6.0.8-2.src.tar.gz
pacman -S devtools # needed to build in a clean chroot
cd virtualbox
multilib-build #builds the package in a clean chroot needs to be multilib for dev86
pacman -U virtualbox-guest-utils-6.0.8-2-x86_64.pkg.tar.xzOffline
Thanks for the reply, loqs, and sorry it took me a while to try it out. Unfortunately, it didn't seem to make a difference. ![]()
Offline