Project

General

Profile

VirtualBox » History » Version 1

Version 1/2 - Next ยป - Current version
Charles Atkinson, 17/08/2020 15:45
Creation


VirtualBox

Start VMs at host boot and shut down during host shutdown using systemd

Script

/usr/local/bin/shut_down_vbox_vm.sh

/etc/systemd/system/vboxvmservice@.service

This is specific to the User= user

[Unit]
Description=VBox Virtual Machine %i Service
Requires=systemd-modules-load.service
After=systemd-modules-load.service

[Service]
User=c
Group=vboxusers
ExecStart=/usr/bin/VBoxManage startvm %i --type headless
ExecStop=/usr/local/bin/shut_down_vbox_vm.sh %i
RemainAfterExit=yes

[Install]
WantedBy=multi-user.target

Instantiation

Example, for user c's VM aems3.iciti.av

# systemctl enable vboxvmservice@aems3.iciti.av