OSX: Howto start VirtualBox VM on startup?
5,606
I think VMs are created under your normal user and not under root.
Try to set lunchd
to start the command with your normal user privileges.
Related videos on Youtube
Author by
snies
Updated on September 18, 2022Comments
-
snies over 1 year
The Question
How do i start this Wiki VM at the startup of the OSX Server?
I am running OSX Server 10.6.8 and VirtualBox 4.1.8 r75467 and a Debian Linux VM (called "wiki").
.
What I tried so far
Following this article: http://mikkel.hoegh.org/blog/2010/12/23/run-virtualbox-boot-mac-os-x/, i have wrote this plist and placed it in /Library/LaunchDaemons/bar.foo.WikiVirtualBox.plist:
<plist version="1.0"> <dict> <key>Label</key> <string>bar.foo.WikiVirtualBox</string> <key>ProgramArguments</key> <array> <string>/usr/bin/VBoxHeadless</string> <string>-s</string> <string>wiki</string> </array> <key>RunAtLoad</key> <true></true> <key>UserName</key> <string>root</string> <key>WorkingDirectory</key> <string>/var/root</string> <key>StandardErrorPath</key> <string>/var/log/bar.foo.WikiVirtualBox.stderr.log</string> <key>StandardOutPath</key> <string>/var/log/bar.foo.WikiVirtualBox.stdout.log</string> </dict> </plist>
and told launchd to start it:
sudo launchctl load -w /Library/LaunchDaemons/bar.foo.WikiVirtualBox.plist
.
The Logfile
But the VM doesn't start. A Look at
tail -f /var/log/system.log
shows:
sudo[1909]: administrator : TTY=ttys000 ; PWD=/Users/administrator ; USER=root ; COMMAND=/bin/launchctl load -w /Library/LaunchDaemons/bar.foo.WikiVirtualBox.plist VBoxSVC[1914]: 3891612: (connectAndCheck) Untrusted apps are not allowed to connect to or launch Window Server before login. VBoxSVC[1914]: kCGErrorFailure: Set a breakpoint @ CGErrorBreakpoint() to catch errors as they are logged. com.apple.launchd[1] (bar.foo.WikiVirtualBox[1910]): Exited with exit code: 1
When i log into the server via ssh (so no login window opened) i can run:
/usr/bin/VBoxHeadless -s wiki
and it works. So i don't understand the error above.