OSX: Howto start VirtualBox VM on startup?

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: , 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.

1

2 Answers

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.

Another idea is to do this:

While you have Virtualbox in your dock right click on it, go to Options, and then click on "Open at Startup". Of course, this won't start the actual Virtual Machine automatically, but it will start Virtualbox.

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

You Might Also Like