Quantcast
Channel: Ubuntu Forums - Virtualisation
Viewing all articles
Browse latest Browse all 4211

Virtualbox 5.0.18 systemd startup

$
0
0
Hi,

I have setup a headless virtualbox on ubuntu server 16.04 and everything is working fine except I am unable to get it to automatically start on boot using systemd.

The service file looks like this (/lib/systemd/system/vbox.service):
Code:

[Unit]
Description=VBox Virtual Machine Service


[Service]
Type=simple
User=administrator
ExecStart=/usr/bin/VBoxHeadless --startvm "Windows2012"
ExecStop=/usr/bin/VBoxManage controlvm "Windows2012" poweroff


[Install]
WantedBy=multi-user.target

When I run systemctl status vbox.service command after boot I get the following:
Code:

vbox.service - VBox Virtual Machine Service
  Loaded: loaded (/lib/systemd/system/vbox.service; enabled; vendor preset: enabled)
  Active: failed (Result: exit-code) since Tue 2016-05-31 23:22:41 BST; 2min 54s ago
  Process: 1000 ExecStop=/usr/bin/VBoxManage controlvm Windows2012 poweroff (code=exited, status=1/FAILURE)
  Process: 961 ExecStart=/usr/bin/VBoxHeadless --startvm Windows2012 (code=exited, status=1/FAILURE)
 Main PID: 961 (code=exited, status=1/FAILURE)


May 31 23:22:41 server VBoxHeadless[961]:          You will not be able to start VMs until this problem is fixed.
May 31 23:22:41 server systemd[1]: vbox.service: Main process exited, code=exited, status=1/FAILURE
May 31 23:22:41 server VBoxManage[1000]: WARNING: The character device /dev/vboxdrv does not exist.
May 31 23:22:41 server VBoxManage[1000]:          Please install the virtualbox-dkms package and the appropriate
May 31 23:22:41 server VBoxManage[1000]:          headers, most likely linux-headers-generic.
May 31 23:22:41 server VBoxManage[1000]:          You will not be able to start VMs until this problem is fixed.
May 31 23:22:41 server VBoxManage[1000]: VBoxManage: error: Machine 'Windows2012' is not currently running
May 31 23:22:41 server systemd[1]: vbox.service: Control process exited, code=exited status=1
May 31 23:22:41 server systemd[1]: vbox.service: Unit entered failed state.
May 31 23:22:41 server systemd[1]: vbox.service: Failed with result 'exit-code'.

If I run the command sudo systemctl start vbox it starts up no problem and the status is fine.
Code:

administrator@server:~$ systemctl status vbox.service
● vbox.service - VBox Virtual Machine Service
  Loaded: loaded (/lib/systemd/system/vbox.service; enabled; vendor preset: enabled)
  Active: active (running) since Tue 2016-05-31 23:17:52 BST; 31s ago
 Main PID: 4489 (VBoxHeadless)
  CGroup: /system.slice/vbox.service
          ├─4489 /usr/lib/virtualbox/VBoxHeadless --startvm Windows2012
          ├─4500 /usr/lib/virtualbox/VBoxXPCOMIPCD
          └─4505 /usr/lib/virtualbox/VBoxSVC --auto-shutdown


May 31 23:17:52 server systemd[1]: Started VBox Virtual Machine Service.
May 31 23:17:53 server VBoxHeadless[4489]: 31/05/2016 23:17:53 Listening for VNC connections on TCP port 3390
May 31 23:17:53 server VBoxHeadless[4489]: 31/05/2016 23:17:53 Listening for VNC connections on TCP6 port 5900

I have tried to install virtualbox-dkms and linux-headers-generic, but they are already installed. I assume the problem is something to do with WARNING: The character device /dev/vboxdrv does not exist but I am not sure how to fix it, since it works fine when I run it manually.

I am quite new to linux, so I might be missing something very obvious.. Can someone tell me how I should proceed to try and fix this?

Thanks

Viewing all articles
Browse latest Browse all 4211

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>