The VM I'm trying to start does run when manually launched, and does have autostart entabled:
Code: Select all
vbox@hostname:~$ VBoxManage list -l vms|grep -i auto
Autostart Enabled: on
Autostart Delay: 0
Code: Select all
[ Apr 8 20:59:59 Stopping because service restarting. ]
[ Apr 8 20:59:59 Invalid use of ":kill" as stop method for transient service. ]
[ Apr 8 21:01:58 Executing start method ("/opt/VirtualBox/smf-vboxautostart.sh start"). ]
Oracle Corporation SunOS 5.11 11.1 January 2013
Oracle VM VirtualBox Autostart 4.2.10
(C) 2013 Oracle Corporation
All rights reserved.
[ Apr 8 21:01:58 Method "start" exited with status 0. ]
First, it loops through all users in the staff group (which I'm not using).
Code: Select all
for VW_USER in `logins -g staff`
Wouldn't it make a lot more sense to parse the vboxuser group, since that's the group users have to belong to for some of the functionality anyways?
Code: Select all
vbox@hostname:~$ diff /opt/VirtualBox/smf-vboxautostart.sh.orig /opt/VirtualBox/smf-vboxautostart.sh
54c54
< for VW_USER in `logins -g staff`
---
> for VW_USER in `logins -g vboxuser`
So, digging further into /opt/VirtualBox/smf-vboxautostart.sh, I find the command line being called is:
Code: Select all
exec su - "$VW_USER" -c "/opt/VirtualBox/VBoxAutostart --background --start --config \"$VW_CONFIG\" --logrotate \"$VW_ROTATE\" --logsize \"$VW_LOGSIZE\" --loginterval \"$VW_LOGINTERVAL\""
Code: Select all
vbox@hostname:~$ /opt/VirtualBox/VBoxAutostart --background --start --config /etc/vbox/autostart.cfg --logrotate "" --logsize "" --loginterval ""
VBoxAutostart: error: vbox@hostname:~$ echo $?
2
It also doesn't make sense that the method log shows exit 0.
I decided to try it without passing options with null arguments:
Code: Select all
vbox@hostname:~$ /opt/VirtualBox/VBoxAutostart --background --start --config /etc/vbox/autostart.cfg
Oracle VM VirtualBox Autostart 4.2.10
(C) 2013 Oracle Corporation
All rights reserved.
VirtualBox Autostart 4.2.10 r84104 solaris.amd64 (Mar 5 2013 12:03:58) release log
00:00:00.000570 main Log opened 2013-04-08T19:52:49.841748000Z
00:00:00.000578 main OS Product: SunOS
00:00:00.000579 main OS Release: 5.11
00:00:00.000580 main OS Version: 11.1
00:00:00.000784 main DMI Product Name: SUN FIRE X4170 M3
00:00:00.000840 main DMI Product Version:
00:00:00.000845 main Executable: /opt/VirtualBox/amd64/VBoxAutostart
00:00:00.000846 main Process ID: 10249
00:00:00.000847 main Package type: SOLARIS_64BITS_GENERIC
vbox@hostname:~$ ps -ef | grep VB
vbox 10255 1 0 21:52:50 ? 0:00 /opt/VirtualBox/amd64/VBoxSVC --auto-shutdown
vbox 10258 10176 0 21:53:01 pts/2 0:00 grep VB
root 786 1 0 21:01:59 ? 0:00 /opt/VirtualBox/VBoxZoneAccess
vbox 10253 1 0 21:52:50 ? 0:00 /opt/VirtualBox/amd64/VBoxXPCOMIPCD
vbox 10251 1 0 21:52:50 ? 0:00 /opt/VirtualBox/VBoxAutostart --background --start --config /etc/vbox/autostart
After searching for information on the missing options, I came up completely dry. Here's the code that sets them (also in /opt/VirtualBox/smf-vboxautostart.sh):
Code: Select all
# Get svc configuration
VW_CONFIG=`/usr/bin/svcprop -p config/config $SMF_FMRI 2>/dev/null`
[ $? != 0 ] && VW_CONFIG=
VW_ROTATE=`/usr/bin/svcprop -p config/logrotate $SMF_FMRI 2>/dev/null`
[ $? != 0 ] && VW_ROTATE=
VW_LOGSIZE=`/usr/bin/svcprop -p config/logsize $SMF_FMRI 2>/dev/null`
[ $? != 0 ] && VW_LOGSIZE=
VW_LOGINTERVAL=`/usr/bin/svcprop -p config/loginterval $SMF_FMRI 2>/dev/null`
[ $? != 0 ] && VW_LOGINTERVAL=
Code: Select all
vbox@hostname:~$ svcprop -p config virtualbox/autostart
config/config astring /etc/vbox/autostart.cfg
vbox@hostname:~$
Code: Select all
# Default policy is to deny starting a VM, the other option is "allow".
default_policy = deny
#
vbox = {
allow = true
startup_delay = 10
}
kburtch = {
allow = true
startup_delay = 10
}
Surely /opt/VirtualBox/VBoxAutostart should be able to handle being passed null arguments to options (since the calling script is coded to pass them).