Comment 2 for bug 1875271

Revision history for this message
Lukas svärdkvist (sleepyo) wrote :

I have usually used VboxHeadless to start vm's via systemd unit files, But I guess some use it for some vrdp functionality.

Anyway, VboxManage can do almost the same thing. For me the only change was adding RemainAfterExit=yes in my unit file and changing VboxHeadless --startvm debian to VboxManage command instead. Just wanted to add this in. I briefly looked into Oracle's documentation and also found an old post on there forums mentioning VboxHeadless is the preferred way to start vm's this way. Anyway, works for now.

""This is the recommended way, because when starting the headless interface through VBoxManage, you will not be able to view or log messages that VBoxHeadless may have output on the console. Especially in case of startup errors, such output might be desirable for problem diagnosis.""

Requires=systemd-modules-load.service
After=systemd-modules-load.service

[Service]
Type=simple
User=sleepy
Group=vboxusers
ExecStart=/usr/bin/vboxmanage startvm debian --type headless
RemainAfterExit=yes
ExecStop=/usr/bin/VBoxManage controlvm "debian" poweroff

[Install]
WantedBy=multi-user.target [/code]