Virtualization: VirtualBox

Headless scripts

by ross at 09:17:36 on February 12, 2013

Start headless VM on boot

Have a look at /usr/local/etc/rc.d/vboxheadless:

# vboxheadless_enable (bool):         Set to "NO" by default.
#                                     Set it to "YES" to enable vboxheadless.
# vboxheadless_machines (str):        Space separated list of machines 
# vboxheadless_user (str):            Default user account to run with.
#                                     (default: vboxusers)
# vboxheadless_stop (str):            Default stop cmd for VBoxManage controlvm.
#                                     (default: savestate)
# vboxheadless_delay (int):           Default startup/shutdown delay in seconds.
#                                     (default: 0)
# vboxheadless_<machine>_name (str):  Virtualbox machine name or UUID.
# vboxheadless_<machine>_user (str):  User account to run with.
# vboxheadless_<machine>_flags (str): Additional flags for VBoxHeadless.
# vboxheadless_<machine>_stop (str):  Stop command for VBoxManage controlvm.
# vboxheadless_<machine>_delay (int): Startup and shutdown delay in seconds.

To start our example on boot add to /etc/rc.conf:

vboxheadless_enable="YES"
vboxheadless_machines="vm0"
vboxheadless_vm0_name="win7"
vboxheadless_vm0_user="vbox"

Prepare:

# sudo -u vbox VBoxManage modifyvm win7 --vrdeport 5000
# sudo -u vbox VBoxManage modifyvm win7 --vrdeproperty VNCPassword=secret

Run:

# service vboxheadless start

 

Comments
Userful!

Do you know whether or not this works inside a jail?
-- Kamil Choudhury
Tuesday, December 6, 2011, 23:33:53