Dmitry Leskov

Troubleshooting VBoxVmService – Windows Service For Running VirtualBox VMs

At first, it looked as if VBoxVmService exactly met my desire to have an Ubuntu VM automatically started during Windows boot and run in the background without any interference with the desktop. However, I could not get it to work: VboxManage kept saying “ERROR: Could not find a registered machine named 'name'” no matter what.

I ended up patching VBoxVmService.cpp so as to have it run “VBoxManage list vms” and “VBoxManage list systemproperties” before an attempt to start a VM. The output of the latter has provided a clue to why the output of the former was empty:

   .  .  .
Default machine folder:          C:\Windows\system32\config\systemprofile\.VirtualBox\Machines
Default hard disk folder:        C:\Windows\system32\config\systemprofile\.VirtualBox\HardDisks
   .  .  .

I have then logged the value of the VBOX_USER_HOME environment variable in VBoxVmService. It has been correctly pointing to the VirtualBox subdirectory in my user profile, but it seemed that the VBoxManage process has not been inheriting it for some reason.

I could have dug deeper into this, but have recalled that all my VMs and hard disks images live on a separate partition, so the VirtualBox.xml file contains their full paths. Copying that file to the system profile directory seen above did the trick: the output produced by my patch included a list of my VMs and pointed to the right locations:

   .  .  .
Default machine folder:          V:\Machines
Default hard disk folder:        V:\HardDisks
   .  .  .

VMboxVmService could then start my little Ubuntu server and I could connect to it via SSH – exactly what I needed, with one caveat: now the VirtualBox GUI does not recognize the VM as started. I may therefore need to ensure that the two VirtualBox.xml files contain no duplicated entries…

Just in case, I was using the latest (as of today) VBoxVmService 2.3 (Watermelon) on Windows 7 Home Premium.

Tags: , , , , ,

« | »


Comments are closed.