Skip to content

Instantly share code, notes, and snippets.

@SamMousa

SamMousa/vm.service

Created Sep 14, 2020
Embed
What would you like to do?
Virtualbox on ZFS in SystemD, proper shutdown and process management
# Inspired by https://blogging.dragon.org.uk/start-stop-virtualbox-with-systemd/
[Unit]
Description=Virtual Box Guest %I
After=network.target virtualbox.service zfs-volume-wait.service
Before=runlevel2.target shutdown.target
[Service]
User=root
Group=root
Type=simple
RemainAfterExit=no
ExecStart=/usr/bin/VBoxHeadless -s %i
ExecStop=-/usr/bin/VBoxManage controlvm %i acpipowerbutton
ExecStop=/usr/bin/bash -c 'until VBoxManage showvminfo DirectResearch | grep -E "^State:" | grep -v running; do sleep 1; done'
[Install]
WantedBy=multi-user.target
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.