Recently I began getting errors from a VM running systemd due to fstab being mounted before vboxsf is probed (and thus mounts of shared folders will fail).
Looking at the unit file I see nothing to guarantee that it runs before local mounts are performed, so only happenstance allowed this to work previously.
I'm not sure what the most appropriate solution is, but virtualbox-guest-additions should run before local-fs-pre.target. Or, perhaps, systemd-fstab-generator should ensure that it runs before individual mounts that require the guest additions are processed (which could itself happen in various ways).
Maybe there is some way to get the generator to treat them as "remote" filesystems, which are processed later in the boot process.
It looks like adding _netdev to the mount options will get it to run as a network mount. Alternatively shared/util.c needs to be modified to add vboxsf as a network filesystem type.
That might not actually be a bad upstream patch, though I'm not sure if virtualbox has a different plan for addressing this.
Regardless the systemd.mount man page could use improvement. It mentions that the generator looks at fstab options, but doesn't mention _netdev at all. I didn't fully peruse the source but I'm sure there are other undocumented behaviors.
This blog post is interesting:
I wonder how we can get the kernel to issue that /bin/modprobe call to load the vboxsf module on-demand?
It looks like the kernel calls /sbin/modprobe fs-%fstype% when you try to mount a filesystem with a type it doesn't know about.
Could you try adding a module alias in /etc/modprobe.d?
alias fs-vboxsf vboxsf
(In reply to Mike Gilbert from comment #4)
> It looks like the kernel calls /sbin/modprobe fs-%fstype% when you try to
> mount a filesystem with a type it doesn't know about.
> Could you try adding a module alias in /etc/modprobe.d?
> alias fs-vboxsf vboxsf
Indeed that works. Seems like a good rc-independent solution to have virtualbox-guest-additions to add an appropriate file to /etc/modprobe.d containing this line.
Agreed. Re-assigning to package maintainer.
Also, I think there is probably a way to define that alias in the module sources; depmod seems to generate "fs-" aliases in /lib/modules/version/modules.alias for other filesystems. I'm just having trouble figuring out exactly how that works.
Has this been resolved?