Firstly a general overview on how one does auto starting of VMs on a Mac.
- Write a launchdaemon plist file
Write a config file to list which user accounts are allowed to run VMs
Enable the desired VMs in those account(s)
Enable the launchdaemon
Reboot
Test
This is easily fixed by changing the line
Code: Select all
|| "${USERSHELL}" == "/usr/bin/false" || "${USERSHELL}" == "/dev/null" || "${USERSHELL}" == "/usr/sbin/uucico" ]]
Code: Select all
|| "${USERSHELL}" == "/bin/false" || "${USERSHELL}" == "/usr/bin/false" || "${USERSHELL}" == "/dev/null" || "${USERSHELL}" == "/usr/sbin/uucico" ]]
If you look at the bottom of the /Applications/Virtualbox.app/Contents/MacOS/VBoxAutostartDarwin.sh script, then you will see the following lines
Code: Select all
CONFIG=${1}
vboxStartStopAllUserVms "start"
trap vboxStopAllUserVms HUP KILL TERMscript start /file/path/configfile.cfg
With these example launchdaemons having the start command as the first parameter it means the script is not getting a valid file path (because the file path is then in the second parameter) and this means it fails, launchd then keeps trying to run it again and you will get respawn messages in your system.log
So the solution to this is not to pass start as a parameter in your launchdaemon file, this will mean the command just becomes
script /file/path/configfile.cfg
A corrected launchdaemon file is listed below
Code: Select all
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Disabled</key>
<false/>
<key>KeepAlive</key>
<true/>
<key>Label</key>
<string>org.virtualbox.vboxautostart</string>
<key>ProgramArguments</key>
<array>
<string>/Applications/VirtualBox.app/Contents/MacOS/VBoxAutostartDarwin.sh</string>
<string>/etc/vbox/autostart.cfg</string>
</array>
</dict>
</plist>