VirtualBox 4.3 autostart on Debian wheezy


Since VirtualBox 4.2 there is autostart script which helps you start your virtual machines during boot. Here is a howto for VirtualBox 4.3 autostart on Debian wheezy.

Before this autostart script the virtual machines ware started usually from rc.local, now you can do it with VirtualBox autostart config. Do the following to enable the autostart service:

As root:

vi /etc/default/virtualbox

add this lines:

VBOXAUTOSTART_DB=/etc/vbox
VBOXAUTOSTART_CONFIG=/etc/vbox/autostart.conf

Now change the permissions to the folder for vboxusers

chgrp vboxusers /etc/vbox
chmod 1775 /etc/vbox

Create the /etc/vbox/autostart.conf and add this users that you want autostart to be enabled, my users for running the virtual machines is vbox

vi /etc/vbox/autostart.conf
# Default policy is to deny starting a VM, the other option is "allow".
default_policy = deny
# user vbox is allowed to start virtual machines but starting them
# will be delayed for 10 seconds
vbox = {
 allow = true
 startup_delay = 10
}

Now login as vbox and enable autostart on the machines you want to start automatically, i will do  it for two machines called VirtualMachine1 and VirtualMachine2

VBoxManage setproperty autostartdbpath /etc/vbox
VBoxManage modifyvm VirtualMachine1 --autostart-enabled on
VBoxManage modifyvm VirtualMachine2 --autostart-enabled on

Now, as root run this command, or reboot your server:

/etc/init.d/vboxautostart-service start

Note: vboxautostart-service uses only start and stop

More:
Starting virtual machines during system boot



11
Leave a Reply

avatar
5 Comment threads
6 Thread replies
0 Followers
 
Most reacted comment
Hottest comment thread
5 Comment authors
Syed Salman AliSlongxxxislandnstojanoskiDan Recent comment authors
  Subscribe  
newest oldest most voted
Notify of
Dan
Guest
Dan

I’m not seeing the *.start or *.stop scripts getting created under /etc/vbox. Made sure permissions are set (and the vboxusers group is the group of /etc/vbox and the user is a member of vboxusers). Any ideas?

Running ubuntu server 12.04-4 (64bit) and VirtualBox 4.3.8.

nstojanoski
Guest
nstojanoski

Just installed VirtualBox 4.3.8 on Debian 7 and enabled autostart using this tutorial. Check the tutorial once again maybe you have missed some of the steps.

S
Guest
S

I don`t not why the files .stop and .start are not created but: I created manually the file “/etc/vbox/vbox.start” with the content “1” (without quotes), and “/etc/vbox/vbox.stop” with the same content (“1”). After many, many hours now I can start and stop the machine: “/etc/init.d/vboxautostart-service start” and “/etc/init.d/vboxautostart-service stop”… and is auto-started after reboot.

longxxxisland
Guest
longxxxisland

vbox user doesn’t exist

nstojanoski
Guest
nstojanoski

as the tutorial explains vbox is the user i run my virtual machines. you need to adjust it with the user you run your machines.

longxxxisland
Guest
longxxxisland

Thanks, got it working now.

longxxxisland
Guest
longxxxisland

VBoxManage: error: The machine is not mutable (state is Saved)
VBoxManage: error: Details: code VBOX_E_INVALID_VM_STATE (0x80bb0002), component SessionMachine, interface IMachine, callee nsISupports
VBoxManage: error: Context: “COMSETTER(AutostartEnabled)(ValueUnion.f)” at line 2616 of file VBoxManageModifyVM.cpp

nstojanoski
Guest
nstojanoski

your virtual machines need to be shut down not running or in saved state.

S
Guest
S

Do you know what means this error? The .start file is not created
Starting VirtualBox VMs configured for autostartls: cannot access /etc/vbox/*.start: No such file or directory
thanks

Syed Salman Ali
Guest

Alright, VM will start on boot, but how I can shutdown the VM gracefully while shutting down my host?

nstojanoski
Guest
nstojanoski

Depends what you wanna do.

Usually when i shutdown my server i shutdown machines one by one.

You can create a script if you want using VBoxManage controlvm

Here is a link: http://askubuntu.com/questions/42482/how-to-safely-shutdown-guest-os-in-virtualbox-using-command-line

Regards,
Nikola

Advertisement