sandstorm-io / vagrant-spk

Packaging tool for Sandstorm, a self-hosting platform for web apps!
Apache License 2.0
55 stars 29 forks source link

Fix remote-fs.target dependency cycle #326

Closed troyjfarrell closed 2 years ago

troyjfarrell commented 2 years ago

Adding the automount option fixes a dependency cycle that can cause Sandstorm to fail to start on boot for some development VMs.

The host\x2ddot\x2dsandstorm.mount is wanted by the remote-fs.target, however it needs the virtualbox-guest-utils.service to mount successfully. The virtualbox-guest-utils.service can be made to run before remote-fs.target, but I have never managed to make it be ready for mounting Virtualbox Synced Folders at boot time. It complains of shared memory errors. All of this causes the remote-fs.target to fail, which causes sandstorm.service to fail to start at boot time.

This solution enables the automount option. /host-dot-sandstorm is instead no longer required for completion of the remote-fs.target and is mounted on demand for vagrant-spk. Everyone is happy.

troyjfarrell commented 2 years ago

Relevant documentation:

https://www.freedesktop.org/software/systemd/man/systemd.mount.html#x-systemd.automount

https://www.freedesktop.org/software/systemd/man/systemd.automount.html

ocdtrekkie commented 2 years ago

Thanks. This sounds good though I feel out of my depth here. I'll test it as soon as I can. And also cc: @zenhack

Do you know which sorts of flavors of development VMs are and aren't affected by this?

troyjfarrell commented 2 years ago

This bug affects two of three diy VMs that I tested. (I only have diy VMs.) One of the two encounters the problem 50% of the time. The second encounters the problem 90% of the time.

I don't understand why I need it for /host-dot-sandstorm but not for /opt/app. I think the most likely explanation is a race condition, but I have no evidence for that.

I sent the PR because it solved a long-standing problem for me and I hoped that it would help others. But if it's only happening on my system, you can close and ignore it.

ocdtrekkie commented 2 years ago

Are you using a different base box by chance?

zenhack commented 2 years ago

Fwiw, I've sometimes seen mount problems trying to boot up a pre-existing vm, which I've solved by just blowing away the vm, starting from scratch, and making a mental note to investigate someday. This is probably the cause.

I think this could use a comment explaining what all this is about, but otherwise LGTM.

ocdtrekkie commented 2 years ago

Did a bit of testing with a project I am working on from a Windows machine, and this didn't throw any issues my way.