Starting virtual machines during system boot with ver 4.2

Discussions related to using VirtualBox on Linux hosts.
Post Reply
mrnico
Posts: 2
Joined: 27. Sep 2012, 22:27

Starting virtual machines during system boot with ver 4.2

Post by mrnico »

Hi, I recently installed the latest version of VirtualBox 4.2, but I have a problem, I dont see the configuration files to make my virtual machines start up when I start the server.

Could anyone tell me where are these files?

look in / etc / default / and nothing, also in / etc / vbox /

or someone write here a example file?

thanks
Y E T I
Posts: 161
Joined: 9. Aug 2010, 01:47
Primary OS: Other
VBox Version: OSE self-compiled
Guest OSses: ?
Location: H i m a l a y a s
Contact:

Re: Starting virtual machines during system boot with ver 4.

Post by Y E T I »

you create the files yourself. see user manual advanced topics
mrnico
Posts: 2
Joined: 27. Sep 2012, 22:27

Re: Starting virtual machines during system boot with ver 4.

Post by mrnico »

Thanks, but the help in manual advanced topics is not very good, could give some examples of how you make those files??
newlife007
Posts: 2
Joined: 2. Oct 2012, 20:56
Primary OS: Fedora other
VBox Version: OSE Fedora
Guest OSses: Windows, Fedora, CentOS, FreeNAS
Contact:

Re: Starting virtual machines during system boot with ver 4.

Post by newlife007 »

See if this helps, I just did this on my Fedora 17 system

Create the file /etc/default/virtualbox and add a few variables.

VBOXAUTOSTART_DB which contains an absolute path to the autostart database directory and VBOXAUTOSTART_CONFIG which contains the location of the autostart config settings. The file should look similar to this:

# vi /etc/default/virtualbox
# virtualbox defaults file
VBOXAUTOSTART_DB=/etc/vbox
VBOXAUTOSTART_CONFIG=/etc/vbox/vbox.cfg

Now we need to create /etc/vbox/vbox.cfg file and add

# Default policy is to deny starting a VM, the other option is "allow".
default_policy = deny
# Create an entry for each user allowed to run autostart
myuserid = {
allow = true
}

If you are the only user you can just add the line default_policy = allow to the vbox.cfg file.

Set permissions on directory to the vboxuser group and make sure users can write to the directory as well as sticky bit.
# chgrp vboxusers /etc/vbox
# chmod 1775 /etc/vbox

Add each of the users to the vboxusers group. Make sure to check their group memberships so they do not loose any groups they currently have assigned to their id.

# groups myuserid
myuserid

# usermod -G vboxusers myuserid

Every user who wants to enable autostart for individual machines has to set the path to the autostart database directory with

$ VBoxManage setproperty autostartdbpath /etc/vbox

Now we are ready to set the VM's we choose to start.

$ VBoxManage modifyvm --autostart-enabled on

This will create a myuserid.start file in /etc/vbox directory

Now restart the vboxautostart-service to read in the changes.
# service vboxautostart-service restart
skywalkeronline
Posts: 1
Joined: 8. Oct 2012, 11:02

Re: Starting virtual machines during system boot with ver 4.

Post by skywalkeronline »

Dear friends, I did all instructions stated above, but still not able to use autostart
My /etc/vbox/vbox.cfg

# Default policy is to deny starting a VM, the other option is "allow".
default_policy = deny
# Create an entry for each user allowed to run autostart
skywalker = {
allow = true
}

And I receive following error in command line:

skywalker@sky-top:~$ service vboxautostart-service start
/etc/init.d/vboxautostart-service: 2: /etc/vbox/vbox.cfg: default_policy: not found
/etc/init.d/vboxautostart-service: 4: /etc/vbox/vbox.cfg: skywalker: not found
/etc/init.d/vboxautostart-service: 5: /etc/vbox/vbox.cfg: allow: not found
/etc/init.d/vboxautostart-service: 6: /etc/vbox/vbox.cfg: Syntax error: "}" unexpected

Maybe somebody meets the same problem and have some workaround.
Thanks in advance.
av001
Posts: 1
Joined: 12. Oct 2012, 10:17

Re: Starting virtual machines during system boot with ver 4.

Post by av001 »

There is an error in the tutorial. The file name vbox.cfg seems to be reserved. It appears in vboxdrv script as a file containing commands. So just rename vbox.cfg to anything else and it will work. But remember to make the change also in /etc/default/virtualbox, to have the correct reference.
Hète
Posts: 2
Joined: 23. Dec 2012, 04:13

Re: Starting virtual machines during system boot with ver 4.

Post by Hète »

Thanks a lot newlife007 for you exemple...

on MacOS X (10.8) i got this error after executing

Code: Select all

VBoxManage setproperty autostartdbpath /etc/vbox

Code: Select all

VBoxManage: error: Cannot set the autostart database path (VERR_NOT_SUPPORTED)
VBoxManage: error: Details: code NS_ERROR_FAILURE (0x80004005), component SystemProperties, interface ISystemProperties, callee nsISupports
VBoxManage: error: Context: "COMSETTER(AutostartDatabasePath)(Bstr(a->argv[1]).raw())" at line 871 of file VBoxManageMisc.cpp
any ideas ?
WTGPhoben
Posts: 1
Joined: 29. Dec 2012, 20:22

Re: Starting virtual machines during system boot with ver 4.

Post by WTGPhoben »

Jumping in here with an update that may be helpful to others:

I followed the tutorial (with corrections), and successfully got a machine to boot by running the

Code: Select all

service vboxautostart-service start
command. However, when I boot the host, my guest machine does not boot. I added a log message to the 'start' section of the init.d script for vboxautostart-service and confirmed that it is running.

UPDATE: A more thorough insertion of logging identified that "vboxdrvrunning" was returning false in /etc/init.d/vboxautostart-service:

Code: Select all

    begin_msg "Starting VirtualBox VMs configured for autostart";
    vboxdrvrunning || {
        fail_msg "VirtualBox kernel module not loaded!"
        exit 0
    }
Commenting out the exit (effectively ignoring the error) fixed the issue.

System: Ubuntu 12.04
kiwi
Posts: 6
Joined: 30. May 2013, 15:55

Re: Starting virtual machines during system boot with ver 4.

Post by kiwi »

Thank WTGPhoben. I am running Ubuntu 12.04 and having the same problem. I followed your suggestion (i.e. comment out that 'exit 0' line in /etc/init.d/vboxautostart-service) and now it works like a charm.
sradman
Posts: 1
Joined: 10. Mar 2014, 11:50

Re: Starting virtual machines during system boot with ver 4.

Post by sradman »

Hète wrote:Thanks a lot newlife007 for you exemple...

on MacOS X (10.8) i got this error after executing

Code: Select all

VBoxManage setproperty autostartdbpath /etc/vbox

Code: Select all

VBoxManage: error: Cannot set the autostart database path (VERR_NOT_SUPPORTED)
VBoxManage: error: Details: code NS_ERROR_FAILURE (0x80004005), component SystemProperties, interface ISystemProperties, callee nsISupports
VBoxManage: error: Context: "COMSETTER(AutostartDatabasePath)(Bstr(a->argv[1]).raw())" at line 871 of file VBoxManageMisc.cpp
any ideas ?
It seems that (setting the) autostartdbpath is not supported (VERR_NOT_SUPPORTED ) or required on OS X.

The VirtualBox manual only mentions it for Linux and /etc/vbox would not be a good candidate:
9.23.1. Linux: starting the autostart service via init wrote: The first one is VBOXAUTOSTART_DB which contains an absolute path to the autostart database directory. The directory should have write access for every user who should be able to start virtual machines automatically. Furthermore the directory should have the sticky bit set.
Stefan
danrollo
Posts: 5
Joined: 12. Mar 2014, 08:26

Re: Starting virtual machines during system boot with ver 4.

Post by danrollo »

With VirtualBox 4.8.3, I'm seeing a problem where the *.start and *.stop files are not being created (and no error occurs) after executing the command:

Code: Select all

VBoxManage modifyvm myvm --autostart-enabled on
Anybody else seeing this? (Host is Ubuntu Server 12.04-4 amd64). In case it helps, I do see and error when trying to disable autostart for this VM:

Code: Select all

VBoxManage modifyvm myvm --autostart-enabled off
VBoxManage: error: Removing machine 'myvm' to the autostart database failed with VERR_FILE_NOT_FOUND
VBoxManage: error: Details: code NS_ERROR_UNEXPECTED (0x8000ffff), component SessionMachine, interface IMachine, callee nsISupports
VBoxManage: error: Context: "COMSETTER(AutostartEnabled)(ValueUnion.f)" at line 2616 of file VBoxManageModifyVM.cpp
Any ideas?
FabricioFC
Posts: 1
Joined: 7. Nov 2015, 00:02

Re: Starting virtual machines during system boot with ver 4.

Post by FabricioFC »

In the file vbox.cfg, remove the white spaces:

Code: Select all

# Default policy is to deny starting a VM, the other option is "allow".
#Changed "default_policy = allow" to "default_policy=allow"
default_policy=allow
The error "default_policy: not found" error disapeared
Post Reply