Skip to content

Instantly share code, notes, and snippets.

@il-katta
Created June 15, 2016 12:18
Show Gist options
  • Save il-katta/c3acff61d486bd48b928d6d53dcd9d7f to your computer and use it in GitHub Desktop.
Save il-katta/c3acff61d486bd48b928d6d53dcd9d7f to your computer and use it in GitHub Desktop.
[Unit]
Description = Virtualbox VM
After = systemd-user-sessions.service network.target sound.target
ConditionPathExists = /dev/tty0
[Service]
Type = simple
TTYPath = /dev/tty8
StandardInput = tty
StandardOutput = tty
# Reset the terminal device specified with TTYPath=
# before and after execution.
TTYReset = yes
TTYVHangup = yes
# clear the screeen
TTYVTDisallocate=yes
PermissionsStartOnly = true
User = < YOU USER >
Group = vboxusers
PAMName = login
ExecStart = /usr/bin/xinit /usr/bin/dbus-launch --exit-with-session \
/usr/lib/virtualbox/VirtualBox --startvm "%i" --fullscreen --no-startvm-errormsgbox -- \
:1 -nolisten tcp vt8
ExecStop = /usr/bin/VBoxManage controlvm "%i" poweroff
Restart = on-abort
RestartSec = 5
SyslogIdentifier = virtualbox-%i
[Install]
WantedBy = multi-user.target
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment