Skip to content

Instantly share code, notes, and snippets.

@nightsparc
Created June 17, 2022 14:00
Show Gist options
  • Save nightsparc/58eb2f6fa7f68d996b2066926f8dcc20 to your computer and use it in GitHub Desktop.
Save nightsparc/58eb2f6fa7f68d996b2066926f8dcc20 to your computer and use it in GitHub Desktop.
Start Virtualbox VM via systemd
See https://www.pragmaticlinux.com/2020/10/start-a-virtualbox-vm-on-boot-with-systemd/
```
[Unit]
Description=VirtualBox VM %I
After=network.target vboxdrv.service
Before=runlevel2.target shutdown.target
[Service]
## Add user/group in case the service should be run by the root daemon
#User=USER
#Group=vboxusers
Type=forking
Restart=no
TimeoutSec=5min
IgnoreSIGPIPE=no
KillMode=process
GuessMainPID=no
RemainAfterExit=yes
ExecStart=/usr/bin/VBoxManage startvm %i --type headless
#ExecStart=/usr/bin/VBoxManage startvm %i
ExecStop=/usr/bin/VBoxManage controlvm %i acpipowerbutton
[Install]
WantedBy=multi-user.target
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment