On MacOs with latest version 6 of vbox.
After struggling a bit i definitively resolved this running
sudo chown root Applications
sudo chown root /Applications
It seems that was some owning problems.
You may find Kinto to be useful. It's a project I recently created, after a few years of tackling this problem a few different ways and I just now feel like it's solid enough to share.
The Kinto installer simply uses python to do the initial install, after that it's just a systemd service, bash, xprop, setxkbmap and xkbcomp. As far as I am concerned it is ...