start vm on boot in lion

Discussions related to using VirtualBox on Mac OS X hosts.
Post Reply
nateswitch
Posts: 1
Joined: 19. Nov 2011, 00:54
Primary OS: Mac OS X other
VBox Version: OSE other
Guest OSses: Ubuntu

start vm on boot in lion

Post by nateswitch »

I'm running a VM on a Lion server machine.

I added a launchd plist as follows:

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>Label</key>
  <string>com.test.ResourceSpaceVirtualbox</string>
  <key>ProgramArguments</key>
  <array>
    <string>/usr/bin/VBoxHeadless</string>
    <string>-s</string>
    <string>ResourceSpace</string>
  </array>
  <key>UserName</key>
  <string>admin</string>
  <key>WorkingDirectory</key>
  <string>/Users/admin</string>
  <key>RunAtLoad</key>
  <true/>
</dict>
</plist>
Ran:

Code: Select all

sudo launchctl load -w /Library/LaunchDaemons/com.test.ResourceSpaceVirtualbox.plist
The VM started just fine.

I then rebooted the server to test to make sure it would come up after a reboot, and it didn't

When running

Code: Select all

sudo launchctl load -w /Library/LaunchDaemons/com.test.ResourceSpaceVirtualbox.plist
it stated "com.test.ResourceSpaceVirtualbox: Already loaded"

Checking activity monitor I didn't see VBoxHeadless, VBoxSVC or VBoxXPCOMIPCD

I ran

Code: Select all

sudo launchctl unload -w /Library/LaunchDaemons/com.test.ResourceSpaceVirtualbox.plist
followed by

Code: Select all

sudo launchctl load -w /Library/LaunchDaemons/com.test.ResourceSpaceVirtualbox.plist
and it started fine, I saw the three processes mentioned earlier.

Does anyone have any suggestions on how to get this to work properly on a reboot? Where am I falling down with this script?

Thanks!
jbrooks
Posts: 1
Joined: 4. Jan 2011, 19:13
Primary OS: Mac OS X Leopard
VBox Version: OSE other
Guest OSses: Windows 7

Re: start vm on boot in lion

Post by jbrooks »

Nateswitch, did you get this resolved? I need to do something similar and want to follow your lead.
Post Reply