Page 1 of 1

[Ubuntu server 20.04] Starting VM via systemd fails

Posted: 11. Jul 2020, 11:41
by dban
Hi,

I'm having an issue - I'm on Ubuntu Server 20.04 and I'd like to start a VM via systemd service. If the server is booted and everything is loaded I can manually start the systemd service with

Code: Select all

sudo systemctl start vbox@UbuntuD.service
but it will not start automatically, I'm getting the following error on boot

Code: Select all

Jul 11 11:37:56 lezz systemd[1]: Starting vbox@UbuntuD.service...
Jul 11 11:37:59 lezz VBoxManage[1085]: VBoxManage: error: The virtual machine 'UbuntuD' has terminated unexpectedly during startup with exit code 1 (0x1)
Jul 11 11:37:59 lezz VBoxManage[1085]: VBoxManage: error: Details: code NS_ERROR_FAILURE (0x80004005), component MachineWrap, interface IMachine
Jul 11 11:37:59 lezz VBoxManage[1085]: Waiting for VM "UbuntuD" to power on...
Jul 11 11:37:59 lezz systemd[1]: vbox@UbuntuD.service: Control process exited, code=exited, status=1/FAILURE
Jul 11 11:37:59 lezz systemd[1]: vbox@UbuntuD.service: Failed with result 'exit-code'.
Jul 11 11:37:59 lezz systemd[1]: Failed to start vbox@UbuntuD.service.
Jul 11 11:38:42 lezz systemd[1]: /etc/systemd/system/vbox@.service:1: Assignment outside of section. Ignoring.
systemd-file

Code: Select all

Description=the %I
Before=runlevel2.target shutdown.target
After=systemd-modules-load.service network.target virtualbox.service vboxdrv.service

[Service]
User=vbox
Group=vboxusers
Type=forking
Restart=no
TimeoutSec=5min
IgnoreSIGPIPE=no
KillMode=process
GuessMainPID=no
RemainAfterExit=yes

ExecStart=/usr/bin/VBoxManage startvm %i --type=headless
ExecStop=/usr/bin/VBoxManage controlvm %i acpipowerbutton

[Install]
WantedBy=multi-user.target
I don't get it what's the problem, my assumption is that the vboxdrv is missing, but it is added in the after line. ://

Thank you for your support

Re: [Ubuntu server 20.04] Starting VM via systemd fails

Posted: 11. Jul 2020, 12:02
by dban
If I add a delay

Code: Select all

ExecStartPre=/bin/sleep 90
the service starts regulary.

Re: [Ubuntu server 20.04] Starting VM via systemd fails

Posted: 11. Jul 2020, 12:50
by fth0
Is a VBox.log file created during the failing VM start? If yes, please post a zipped copy of it.