Custom mounts in 6.1.2x

Discussions about using Linux guests in VirtualBox.
Post Reply
arQon
Posts: 228
Joined: 1. Jan 2017, 09:16
Primary OS: MS Windows 7
VBox Version: PUEL
Guest OSses: Ubuntu 16.04 x64, W7

Custom mounts in 6.1.2x

Post by arQon »

(Note: For those wondering why the GUI isn't good enough: the point here is "custom", i.e. things that require more complex mount options than the GUI offers. The new mountpoint option in the GUI is a big step forwards, but still not quite enough for what I need).

Every couple of years, some piece of shared folder mounting breaks, and apparently it's that time again...

Historically, most of the problems have come from race conditions where the guest tries to mount a shared folder before VBox has reached a state where it's capable of doing so. This was originally only a problem for fstab mounts, but later also broke rc.local-style mounts if systemd was involved and you were unlucky. Adding vboxsf to /etc/modules to force it to load "early" resolved at least the second case for several years.

As of 6.1.26 though, I can no longer find ANY way to get a custom mount to actually work at boot time. :(
edit> I've just discovered that the bug goes at least as far back as 6.1.23. Since that was a test build to stop the audio crashes I never bothered updating the GAs in that install, so THAT piece was still using 6.1.18.

Mounting via fstab, covered here: viewtopic.php?f=3&t=101168 no longer works; and mounting via rc.local (the method I prefer and have been using for the last decade or so) is also broken.

The rc.local approach fails with

Code: Select all

/sbin/mount.vboxsf: shared folder '/cold' was not found (check VM settings / spelling)
Aug 18 14:24:42 brandi systemd[1]: Failed to start rc.local.
Aug 18 14:24:42 brandi kernel: [  885.064384] vboxsf: SHFL_FN_MAP_FOLDER failed for '/cold': share not found
although the pieces (GUI definition of the share on the host, mount command in the guest, etc) are all set correctly. This particular bug also made an appearance here: viewtopic.php?f=3&t=96372#p498995 several months ago. The user there apparently found a rather bizarre (if simple) workaround, but I didn't find that thread until after I'd had to revert to 6.1.23, so I can't confirm or deny it.

No amount of delays, retries, or other hackery seems to be able to get past this. I also went as far as to create a unit file for systemd forcing rc.local to depend on vbox, but I want to emphasize that I may well have gotten that wrong, as I think I had it trying to require vboxsf rather than vboxadd.service. (In my defense, it shouldn't need this level of duct tape in the first place).

In my particular case, the host is W10 and the guest is Ubuntu 18.04 (4.15 kernel, i.e. not HWE), though the bug is clearly not related to the guest version, and was clearly introduced somewhere between 6.1.18 and 6.1.24 (to use official versions only).

Anyway, my question is, does anyone have a working method for custom automatic/boot-time mounts in 6.1.26? Thanks.
Last edited by arQon on 21. Sep 2021, 00:49, edited 1 time in total.
arQon
Posts: 228
Joined: 1. Jan 2017, 09:16
Primary OS: MS Windows 7
VBox Version: PUEL
Guest OSses: Ubuntu 16.04 x64, W7

Re: Custom mounts in 6.1.2x

Post by arQon »

It's a good thing I'm stupid enough to just keep hammering at bugs far longer than they deserve...

I seem to have uncovered the root of the problem, and it's absolutely ridiculous.
If you give the shared folder a custom name, the mount falls over at boot time, but works a minute later once you have a desktop running.
If you leave the folder set to the default name, it works at boot time.

Specifically, if the shared folder name and the mountpoint name are too similar, e.g. "foo", to be mounted at "/foo", the mount will fail - but again, ONLY if the mount tries to run "too quickly".

So, wow, that's creative. :) Apparently there's some weird sort of renaming lookup table going on in there, but someone decided to defer actually populating it "until later" or something, without realising what that would do to boot-time mounts?

Since the bug is in vboxsf.mount, new releases by themselves will NOT fix it: only updated GAs will. Conversely, this also means that if you haven't updated the GAs in a while and you need this to actually work, don't update them!

If you're on a Windows host, the overlap between "versions of VBox that don't constantly hang", "versions that don't run correctly in fullscreen", and "versions that don't have this bug" is literally non-existent: you can only have all three by installing <= 6.1.18 and then installing the GAs from that, and then upgrading the EXE (but NOT the GAs) to 6.1.23. I had no idea my accidental arrangement had been so lucky! :)
For any reasonable deployment, the best you can manage is 6.1.23 for both and just working around this bug.

I would absolutely LOVE to know what sort of bizarre coding error caused this bug, but since it's in the GAs I doubt we ever will. Hopefully it'll at least get fixed someday though.
scottgus1
Site Moderator
Posts: 20965
Joined: 30. Dec 2009, 20:14
Primary OS: MS Windows 10
VBox Version: PUEL
Guest OSses: Windows, Linux

Re: Custom mounts in 6.1.2x

Post by scottgus1 »

Hammer away, arQon! Good detective work!

I have not been one to read the source code, but to the best of my knowledge the only closed-source part of Virtualbox is the Extension Pack. So the GAs should have source code available, unless I misunderstood the situation.
fth0
Volunteer
Posts: 5668
Joined: 14. Feb 2019, 03:06
Primary OS: Mac OS X other
VBox Version: PUEL
Guest OSses: Linux, Windows 10, ...
Location: Germany

Re: Custom mounts in 6.1.2x

Post by fth0 »

arQon wrote:Anyway, my question is, does anyone have a working method for custom automatic/boot-time mounts in 6.1.26?
I've just answered your other post on this topic in Re: Discuss the 6.1.26 release. I'm curious what you'll find out when trying what I suggested there. This could add another (different) piece to the puzzle ...
arQon
Posts: 228
Joined: 1. Jan 2017, 09:16
Primary OS: MS Windows 7
VBox Version: PUEL
Guest OSses: Ubuntu 16.04 x64, W7

Re: Custom mounts in 6.1.2x

Post by arQon »

scottgus1 wrote:Hammer away, arQon! Good detective work!

I have not been one to read the source code, but to the best of my knowledge the only closed-source part of Virtualbox is the Extension Pack. So the GAs should have source code available, unless I misunderstood the situation.
You're probably right - I may well have lost track of the details over the years. ty. :)

In that case, I'll give the code a quick skim once I'm caught up again after the fire: should "only" be 2-3 weeks from now.
Post Reply