Starting virtual machines during system boot with ver 4.2

Discussions related to using VirtualBox on Linux hosts.

Starting virtual machines during system boot with ver 4.2

Postby mrnico » 27. Sep 2012, 22:31

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
mrnico
 
Posts: 2
Joined: 27. Sep 2012, 22:27

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

Postby Y E T I » 27. Sep 2012, 22:32

you create the files yourself. see user manual advanced topics
Y E T I
 
Posts: 161
Joined: 9. Aug 2010, 01:47
Location: H i m a l a y a s
Primary OS: Other
VBox Version: OSE self-compiled
Guest OSses: ?

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

Postby mrnico » 28. Sep 2012, 13:40

Thanks, but the help in manual advanced topics is not very good, could give some examples of how you make those files??
mrnico
 
Posts: 2
Joined: 27. Sep 2012, 22:27

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

Postby newlife007 » 2. Oct 2012, 21:00

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
newlife007
 
Posts: 2
Joined: 2. Oct 2012, 20:56
Primary OS: Fedora other
VBox Version: OSE Fedora
Guest OSses: Windows, Fedora, CentOS, FreeNAS

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

Postby skywalkeronline » 8. Oct 2012, 11:06

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.
skywalkeronline
 
Posts: 1
Joined: 8. Oct 2012, 11:02

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

Postby av001 » 12. Oct 2012, 10:20

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.
av001
 
Posts: 1
Joined: 12. Oct 2012, 10:17

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

Postby Hète » 23. Dec 2012, 04:22

Thanks a lot newlife007 for you exemple...

on MacOS X (10.8) i got this error after executing
Code: Select all   Expand viewCollapse view
VBoxManage setproperty autostartdbpath /etc/vbox



Code: Select all   Expand viewCollapse view
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 ?
Hète
 
Posts: 2
Joined: 23. Dec 2012, 04:13

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

Postby WTGPhoben » 29. Dec 2012, 20:35

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   Expand viewCollapse view
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   Expand viewCollapse view
    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
WTGPhoben
 
Posts: 1
Joined: 29. Dec 2012, 20:22

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

Postby kiwi » 5. Jun 2013, 19:16

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.
kiwi
 
Posts: 6
Joined: 30. May 2013, 15:55

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

Postby sradman » 10. Mar 2014, 12:05

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

on MacOS X (10.8) i got this error after executing
Code: Select all   Expand viewCollapse view
VBoxManage setproperty autostartdbpath /etc/vbox



Code: Select all   Expand viewCollapse view
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
sradman
 
Posts: 1
Joined: 10. Mar 2014, 11:50

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

Postby danrollo » 12. Mar 2014, 08:33

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   Expand viewCollapse view
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   Expand viewCollapse view
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?
danrollo
 
Posts: 5
Joined: 12. Mar 2014, 08:26

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

Postby FabricioFC » 7. Nov 2015, 00:07

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

Code: Select all   Expand viewCollapse view
# 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
FabricioFC
 
Posts: 1
Joined: 7. Nov 2015, 00:02


Return to VirtualBox on Linux Hosts

Who is online

Users browsing this forum: No registered users and 19 guests