Virtual machine not starting after autostart setup

Discussions related to using VirtualBox on Linux hosts.
Post Reply
Jamal
Posts: 2
Joined: 29. May 2020, 07:49

Virtual machine not starting after autostart setup

Post by Jamal »

I have done the autostart set up but on restarting the machine or the austostart-service after shutting doen my virtual machine it doesn't start up. Please assis.

Code: Select all

[314eportal@eportal ~]$ cat  /etc/default/virtualbox
AUTOSTART_DB=/etc/vbox
VBOXAUTOSTART_CONFIG=/etc/vbox/autostart.cfg
[314eportal@eportal ~]$ cat /etc/vbox/autostart.cfg
default_policy = deny
# Create an entry for each user allowed to use autostart
314eportal = {
allow = true
}
[314eportal@eportal ~]$ ls -la /etc/vbox
total 24
drwxrwxr-t.   2 root       vboxusers  109 May 29 09:20 .
drwxr-xr-x. 147 root       root      8192 May 29 08:18 ..
-rw-------.   1 314eportal vboxusers    1 Jan 23 14:59 314eportal.start
-rw-------.   1 314eportal vboxusers    1 Jan 24 16:40 314eportal.stop
-rw-r--r--.   1 root       root       109 Sep 12  2019 autostart.cfg
-rw-r--r--.   1 314eportal vboxusers    0 May 29 09:20 vbox.start
-rw-r--r--.   1 314eportal vboxusers    0 May 29 09:20 vbox.stop
Below are some virtual details. I have highlighted the autostart details:

Code: Select all

VM "Reports" has been successfully started.
Name:                        Reports
Groups:                      /
Guest OS:                    Debian (64-bit)
UUID:                        081be1e6-c6b0-4712-be33-780c2dad566f
Config file:                 /home/314eportal/VirtualBox VMs/Reports/Reports.vbox
Snapshot folder:             /home/314eportal/VirtualBox VMs/Reports/Snapshots
Log folder:                  /home/314eportal/VirtualBox VMs/Reports/Logs
Hardware UUID:               081be1e6-c6b0-4712-be33-780c2dad566f
Memory size                  4188MB
Page Fusion:                 disabled
VRAM size:                   16MB
CPU exec cap:                100%
HPET:                        disabled
CPUProfile:                  host
Chipset:                     piix3
Firmware:                    BIOS
Number of CPUs:              1
PAE:                         disabled
Long Mode:                   enabled
Triple Fault Reset:          disabled
APIC:                        enabled
X2APIC:                      enabled
Nested VT-x/AMD-V:           disabled
CPUID Portability Level:     0
CPUID overrides:             None
Boot menu mode:              message and menu
Boot Device 1:               Floppy
Boot Device 2:               DVD
Boot Device 3:               HardDisk
Boot Device 4:               Not Assigned
ACPI:                        enabled
IOAPIC:                      enabled
BIOS APIC mode:              APIC
Time offset:                 0ms
RTC:                         UTC
Hardw. virt.ext:             enabled
Nested Paging:               enabled
Large Pages:                 enabled
VT-x VPID:                   enabled
VT-x unr. exec.:             enabled
Paravirt. Provider:          Default
Effective Paravirt. Prov.:   KVM
State:                       running (since 2020-05-29T06:24:08.683000000)
Monitor count:               1
3D Acceleration:             disabled
2D Video Acceleration:       disabled
Teleporter Enabled:          disabled
Teleporter Port:             0
Teleporter Address:
Teleporter Password:
Tracing Enabled:             disabled
Allow Tracing to Access VM:  disabled
Tracing Configuration:
[b]Autostart Enabled:           enabled[/b]
[b]Autostart Delay:             0[/b]
Jamal
Posts: 2
Joined: 29. May 2020, 07:49

Re: Virtual machine not starting after autostart setup

Post by Jamal »

To resolve the issue I created /etc/vbox/vbox.cfg and made the following additions to the vboxautostart-service.sh script as the variable were not getting picked from the /etc/default/virtualbox file:

Code: Select all

# silently exit if the package was uninstalled but not purged,
# applies to Debian packages only (but shouldn't hurt elsewhere)
[ ! -f /etc/debian_release -o -x $binary ] || exit 0

[ -r /etc/default/virtualbox ] && . /etc/default/virtualbox
# Variable are not picked by above command so added below
VBOXAUTOSTART_DB=/etc/vbox
VBOXAUTOSTART_CONFIG=/etc/vbox/vbox.cfg
The /etc/vbox file looks like below. Note the autostart.cfg file is not used.

Code: Select all

[root@eportal log]# ls -la /etc/vbox/
total 28
drwxrwxr-t.   2 root       vboxusers   90 Jul  2 08:34 .
drwxr-xr-x. 147 root       root      8192 Jun 14 16:13 ..
-rw-------.   1 314eportal vboxusers    1 Jan 23 14:59 314eportal.start
-rw-------.   1 314eportal vboxusers    1 Jan 24 16:40 314eportal.stop
-rw-r--r--.   1 314eportal vboxusers  109 Sep 12  2019 autostart.cfg
-rw-r--r--.   1 root       root       109 Jul  2 08:34 vbox.cfg
Post Reply