Yep, some of the new 4.2.0 features - as nice as they are - seem to be thinly documented thus far. I assume you've looked at the relevant section of the VirtualBox 4.2.0 manual? This is what I did to get autostart working on a Solaris 11 host - all of the commands were entered from a terminal running as my Virtualbox user, any regular user account that you want to run Virtualbox VMs under will do:
Code: Select all
sudo mkdir /etc/vbox
sudo chown <myvboxuser>:<myvboxusersgroup> /etc/vbox #I'm not sure if this is strictly necessary but I did it anyway. You might be fine editing this file as root and leaving the permissions as is - do any experts know what unix best practice is in this regard?
nano -w /etc/vbox/autostart.cfg #Add the contents of autostart.cfg here, see below for the contents of the file.
svccfg -s svc:/application/virtualbox/autostart:default setprop config/config=/etc/vbox/autostart.cfg
It's worth noting that you do not have to place your autostart.cfg at /etc/vbox/autostart.cfg. This is just the default location used in the /opt/VirtualBox/smf-vboxautostart.sh script. If you want to place the configuration file somewhere else then make sure you tell the autostart service about it using the svccfg command (see above).
Now to configure which VMs are started by which users at boot, use the VBoxManage modifyvm utility working from the terminal as the user you want to run the VM under at boot:
Code: Select all
VBoxManage modifyvm <yourvirtualmachinename> --autostart-enabled on
#You can also set a delayed start for the vm using the command: VBoxManage modifyvm <yourvirtualmachinename> --autostart-delay <delayinseconds>
Remember to enable the Virtualbox autostart service:
Code: Select all
svcadm enable svc:/application/virtualbox/autostart:default
I found that had my VirtualBox VMs starting automatically at boot. I don't have everything working properly so far though. For some reason, the autostart service transitions into maintenance mode after starting all the VMs. The log file shows:
VirtualBox Autostart 4.2.0 r80737 solaris.amd64 (Sep 13 2012 07:10:25) release log
00:00:00.000585 main Log opened 2012-09-19T16:07:20.626689000Z
00:00:00.000592 main OS Product: SunOS
00:00:00.000594 main OS Release: 5.11
00:00:00.000596 main OS Version: 11.0
00:00:00.000678 main Executable: /opt/VirtualBox/amd64/VBoxAutostart
00:00:00.000679 main Process ID: 4738
00:00:00.000681 main Package type: SOLARIS_64BITS_GENERIC
[ Sep 20 02:07:20 Method "start" exited with status 0. ]
[ Sep 20 02:07:30 Stopping because all processes in service exited. ]
[ Sep 20 02:07:30 Executing stop method (:kill). ]
[ Sep 20 02:07:30 Restarting too quickly, changing state to maintenance. ]
I'll be investigating this further today and will post when I find a solution.
Another thing I'm curious about is the --autostop-type property which is listed an a setting for the VBoxManage modifyvm command. The options are:
Code: Select all
[--autostop-type disabled|savestate|poweroff|acpishutdown]
It would make sense for us to be able to set this so we can determine how our virtual machines are brought down upon shutdown, and also when we disable the autostart service. When attempting to set this option however, this is what I get:
Code: Select all
<myvboxuser>@<mydomain>:~$ VBoxManage modifyvm pfsense --autostop-type savestate
VBoxManage: error: The VM autostop feature is not supported on this platform
VBoxManage: error: Details: code VBOX_E_NOT_SUPPORTED (0x80bb0009), component SessionMachine, interface IMachine, callee nsISupports
VBoxManage: error: Context: "COMSETTER(AutostopType)(enmAutostopType)" at line 2447 of file VBoxManageModifyVM.cpp
Can anyone with VirtualBox expertise comment as to whether we are intended to use this autostop option under Solaris 11?