pete_c
Guru
Here have been running a Windows VB on my main automation server which is running Ubuntu 18.04 64 bit and recently upgraded to VirtualBox 6.0.
I have had issues autostarting the VB using standard virtual box autostart.
Found a new way to do this this morning and it works well.
Documenting here on a post.
Get rid of vboxautostart-service
1 - sudo systemctl disable vboxautostart-service
2 - sudo rm -rf /lib/systemd/system/vboxautostart-service.service
3 - sudo rm -rf /etc/vbox
User permissions for Virtualbox
1 - type groups to see if you are in the vboxusers group
IE:
pete@ICS-HS3Pro:~$ groups
pete adm cdrom sudo dip plugdev lpadmin sambashare vboxusers
2 - if not put yourself in the vboxusers group typing:
sudo usermod -a -G vboxusers pete
3 - type groups again to make sure you are in the group vboxusers
New Unit File for systemd
1 - Create a new Unit file
sudo nano /etc/systemd/system/vm_autostart_name.service
IE: sudo nano /etc/systemd/system/vm_autostart_W7.service
2 - use this text as a template: (I used vm_name=W7)
[Unit]
Description=VM vm_name
After=network.target vboxdrv.service
Before=runlevel2.target shutdown.target
[Service]
User=pete
Group=vboxusers
Type=forking
Restart=no
TimeoutSec=5min
IgnoreSIGPIPE=no
KillMode=process
GuessMainPID=no
RemainAfterExit=yes
ExecStart=/usr/bin/VBoxManage startvm vm_name --type headless
ExecStop=/usr/bin/VBoxManage controlvm vm_name acpipowerbutton
[Install]
WantedBy=multi-user.target
Reload systemd daemon
sudo systemctl daemon-reload
Using the service
1 - Enable the service
sudo systemctl enable vm_autostart_name
2 - Start, Stop and Status of service
sudo systemctl start vm_autostart_name
sudo systemctl stop vm_autostart_name
sudo systemctl status vm_autostart_name
That's it. Works great over here.
I have had issues autostarting the VB using standard virtual box autostart.
Found a new way to do this this morning and it works well.
Documenting here on a post.
Get rid of vboxautostart-service
1 - sudo systemctl disable vboxautostart-service
2 - sudo rm -rf /lib/systemd/system/vboxautostart-service.service
3 - sudo rm -rf /etc/vbox
User permissions for Virtualbox
1 - type groups to see if you are in the vboxusers group
IE:
pete@ICS-HS3Pro:~$ groups
pete adm cdrom sudo dip plugdev lpadmin sambashare vboxusers
2 - if not put yourself in the vboxusers group typing:
sudo usermod -a -G vboxusers pete
3 - type groups again to make sure you are in the group vboxusers
New Unit File for systemd
1 - Create a new Unit file
sudo nano /etc/systemd/system/vm_autostart_name.service
IE: sudo nano /etc/systemd/system/vm_autostart_W7.service
2 - use this text as a template: (I used vm_name=W7)
[Unit]
Description=VM vm_name
After=network.target vboxdrv.service
Before=runlevel2.target shutdown.target
[Service]
User=pete
Group=vboxusers
Type=forking
Restart=no
TimeoutSec=5min
IgnoreSIGPIPE=no
KillMode=process
GuessMainPID=no
RemainAfterExit=yes
ExecStart=/usr/bin/VBoxManage startvm vm_name --type headless
ExecStop=/usr/bin/VBoxManage controlvm vm_name acpipowerbutton
[Install]
WantedBy=multi-user.target
Reload systemd daemon
sudo systemctl daemon-reload
Using the service
1 - Enable the service
sudo systemctl enable vm_autostart_name
2 - Start, Stop and Status of service
sudo systemctl start vm_autostart_name
sudo systemctl stop vm_autostart_name
sudo systemctl status vm_autostart_name
That's it. Works great over here.