Setup VBox AutoStart - Breaks VBox and doesn't work

Discussions related to using VirtualBox on Linux hosts.
Post Reply
Little Mitch
Posts: 2
Joined: 14. Dec 2018, 10:33

Setup VBox AutoStart - Breaks VBox and doesn't work

Post by Little Mitch »

I followed this carefully which was on AskUbuntu: lifeofageekadmin dot com how-to-set-your-virtualbox-vm-to-automatically-startup

Now VirutalBox is broken. I can't even start VMs manually. I'll remove the autostart stuff and that will likely allow manual start, but here is what I get:

Created the file /etc/default/virtualbox

Code: Select all

# virtualbox defaults file
VBOXAUTOSTART_DB=/etc/vbox
VBOXAUTOSTART_CONFIG=/etc/vbox/vbox.cfg
This is /etc/vbox/vbox.cfg:

Code: Select all

# 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
USERNAME = {
allow = true
}
Then:

Code: Select all

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

sudo usermod -a -G vboxusers USERNAME
It seems it is having a problem reading /etc/vbox/vbox.cfg

Code: Select all

:~$ ls -l /etc/vbox
total 8
-rw------- 1 USERNAME USERNAME   1 Dec 14 01:37 USERNAME.start
-rw-r--r-- 1 root     root     179 Dec 14 01:31 vbox.cfg

Code: Select all

VBoxManage setproperty autostartdbpath /etc/vbox
VBoxManage modifyvm <uuid|vmname> --autostart-enabled on

This created USERNAME.start file in /etc/vbox directory

Code: Select all

● vboxautostart-service.service
  Loaded: loaded (/usr/lib/virtualbox/vboxautostart-service.sh; enabled; vendor preset: enabled)
  Active: failed (Result: exit-code) since Fri 2018-12-14 01:41:57 CST; 27s ago
  Process: 4002 ExecStart=/usr/lib/virtualbox/vboxautostart-service.sh start (code=exited, status=2)

Dec 14 01:41:57 HOST systemd[1]: Starting vboxautostart-service.service...
Dec 14 01:41:57 HOST vboxautostart-service.sh[4002]: /usr/lib/virtualbox/vboxautostart-service.sh: 2: /etc/vbox/vbox.cfg: default_policy: not found
Dec 14 01:41:57 HOST vboxautostart-service.sh[4002]: /usr/lib/virtualbox/vboxautostart-service.sh: 4: /etc/vbox/vbox.cfg: USERNAME: not found
Dec 14 01:41:57 HOST vboxautostart-service.sh[4002]: /usr/lib/virtualbox/vboxautostart-service.sh: 5: /etc/vbox/vbox.cfg: allow: not found
Dec 14 01:41:57 HOST vboxautostart-service.sh[4002]: /usr/lib/virtualbox/vboxautostart-service.sh: 6: /etc/vbox/vbox.cfg: Syntax error: "}" unexpected
Dec 14 01:41:57 HOST systemd[1]: vboxautostart-service.service: Control process exited, code=exited status=2
Dec 14 01:41:57 HOST systemd[1]: vboxautostart-service.service: Failed with result 'exit-code'.
Dec 14 01:41:57 HOST systemd[1]: Failed to start vboxautostart-service.service.
Last edited by Little Mitch on 14. Dec 2018, 11:04, edited 2 times in total.
Little Mitch
Posts: 2
Joined: 14. Dec 2018, 10:33

Re: Setup VBox AutoStart - Breaks VBox and doesn't work

Post by Little Mitch »

It's got something to do with reading the vbox.cfg file because I deleted all the files but that one and it still insisted on trying to read it.

I also had to run: sudo /sbin/vboxconfig to get VirtualBox working again.
Post Reply