Autostart failing on Ubuntu

Discussions related to using VirtualBox on Linux hosts.
Post Reply
wiz561
Posts: 1
Joined: 28. Feb 2014, 16:17

Autostart failing on Ubuntu

Post by wiz561 »

I'm running Virtualbox 4.3.8 on Ubuntu 13.10, amd64. I'm attempting to get the autostart running for a virtual machine but I can't seem to get it working. I've created /etc/default/virtualbox file with the following in it:

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

In my autostart file, I have the following:

default_policy = deny
<virtualbox user> = {
allow = true
}

I changed the permissions of my /etc/vbox directory so that the user starting the virtual machine has permissions to that directory and I can touch files in there to create and modify them. After running...

VBoxManage modifyvm OpenVPN --autostart-enabled on

no files get created in that /etc/vbox directory. When running the following, I get the error:

/etc/init.d/vboxautostart-service start
Starting VirtualBox VMs configured for autostartls: cannot access /etc/vbox/*.start: No such file or directory
$

I'm guessing that VBoxManage autostart should create some .start files in that directory, but it's not happening. Is there something I'm doing wrong? Does anybody have any tips on how I can get this working?

Thanks in advanced.
danrollo
Posts: 5
Joined: 12. Mar 2014, 08:26

Re: Autostart failing on Ubuntu

Post by danrollo »

I'm seeing the exact same problem: no *.start or *.stop files are being created in the /etc/vbox directory, AND no error occurs when executing:

Code: Select all

$ VBoxManage modifyvm myvm --autostart-enabled on
Maybe this helps diagnose: There is an error when trying to turn off autostart for the 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
dvestezar
Posts: 3
Joined: 9. Mar 2014, 12:04

Re: Autostart failing on Ubuntu

Post by dvestezar »

I had same problem after experimenting with some how to guides for vbox user.

My decision was back to root user.

after command
VBoxManage modifyvm NameOfVM --autostart-enabled on

I just create file in /etc/vbox/root.start with content one letter "1"

of course filename root for root user ;)

Tested with reboot
GhostKU
Posts: 1
Joined: 6. Jun 2015, 16:10

Re: Autostart failing on Ubuntu

Post by GhostKU »

Hi I have the same problem. Does anyone found the solution? How to run it with 'vbox' user?
Smackey's dad
Posts: 128
Joined: 2. Apr 2014, 04:11
Primary OS: Ubuntu 12.04
VBox Version: OSE Debian
Guest OSses: Ubuntu Trusty
Location: Austin, TX
Contact:

Re: Autostart failing on Ubuntu

Post by Smackey's dad »

There are a few nuances to getting autostop/autostart to work correctly:

Setting directory and permissions

Code: Select all

chgrp vboxusers /etc/vbox
chmod 1775 /etc/vbox
User permissions

Code: Select all

VB_USER=specifiedvbuser
usermod -aG vboxusers $VB_USER
VirtualBox Global Config

Code: Select all

VBoxManage setproperty autostartdbpath /etc/vbox
VM autostart settings

Code: Select all

VBoxManage modifyvm "${VB_VM_NAME}" --autostart-enabled on --autostop-type savestate --autostart-delay 10
Change run-levels

Code: Select all

update-rc.d -f vboxdrv remove
update-rc.d -f virtualbox remove
update-rc.d -f vboxautostart-service remove
update-rc.d -f vboxweb-service remove
update-rc.d -f vboxballoonctrl-service remove

update-rc.d -f vboxdrv defaults 21 79
update-rc.d -f virtualbox defaults 22 78
update-rc.d -f vboxautostart-service defaults 91 09
update-rc.d -f vboxweb-service defaults 23 77
update-rc.d -f vboxballoonctrl-service defaults 23 77
/etc/default/virtualbox config

Code: Select all

VBOXAUTOSTART_DB=/etc/vbox
VBOXAUTOSTART_CONFIG=/etc/vbox/autostart.cfg
SHUTDOWN_USERS=<enter your VB user here>
SHUTDOWN=savestate
Testing manually

Code: Select all

service vboxautostart-service stop
service vboxautostart-service start
Use this script: http://source.virtualbox.guru/scripts/810-cfg-autostart to put it all together
slacka
Posts: 3
Joined: 13. Apr 2015, 06:06

Re: Autostart failing on Ubuntu

Post by slacka »

I found a solution for: no [userid].start or [userid].stop files are being created in the /etc/vbox directory, AND no error occurs when executing.

In my case, I was trying to start a group of VMs that I imported VMWare Server. I found the solution, when I created a new VM and tried:

Code: Select all

VBoxManage modifyvm "${VB_VM_NAME}" --autostart-enabled on
It worked! So I removed all my VMs (keeping the data) and created new VMs for each one. I copied the VMDKs from the old VM folder to the new ones and attached them one by one. Now everything is automatically starting :D

If any virtualbox developers read this, PLEASE improve the "VBoxManage modifyvm autostart/autostop" error reporting. Silently failing is incredibly frustrating. I ended up reinstalling my OS twice before stumbling upon a solution.
Post Reply