Page 1 of 1

VM as Windows Service in Separate Mode?

Posted: 20. Aug 2015, 12:34
by Jalil
Version: VirtualBox 5.0
Host: Windows 7

If I run VBoxManage.exe startvm VM001 --type headless as a command line (on User01) and start VirtualBox Manager GUI (VirtualBox.exe on User01) then it shows that VM001 is running, but if I run "VBoxManage.exe startvm VM001 --type headless" as a service (using NSSM) with User01 and launch VirtualBox.exe on User01 then the VirtualBox Manager GUI cannot see that VM001 is running.

How should I force VirtualBox.exe to use an already running VBoxSVC.exe instead of creating a new one on the same User01 session?
Or in other words how to run a VM01 as a headless service and using the Separate Mode to manage it using VirtualBox Manager GUI?

Re: VM as Windows Service in Separate Mode?

Posted: 20. Aug 2015, 14:44
by scottgus1
NSSM command line help webpage has this switch:

Code: Select all

ObjectName: The name of the user account under which the service runs. The default is LOCALSYSTEM.
Maybe you could use this to make the guest run under the right account?

You can also use the Remote Desktop server and a client to see the guest screen while running the guest as a service in another account.

There is another thing to do to get the GUI to notice a service-run guest, but I can't remember what it is. Something with an environment variable, or some such. Hopefully someone who knows will enlighten the both of us :)

Re: VM as Windows Service in Separate Mode?

Posted: 20. Aug 2015, 15:43
by Jalil
scottgus1 wrote:NSSM command line help webpage has this switch:

Code: Select all

ObjectName: The name of the user account under which the service runs. The default is LOCALSYSTEM.
Maybe you could use this to make the guest run under the right account?
That is exactly what I did! I set the service to run as User01 then I started the GUI as User01.
scottgus1 wrote: You can also use the Remote Desktop server and a client to see the guest screen while running the guest as a service in another account.
Yes, I know about it but I want to run the VirtualBox Manager GUI to change the guest settings eg.: Change the Network Adapter (NAT, Bridge, Cable connected,...)
scottgus1 wrote: There is another thing to do to get the GUI to notice a service-run guest, but I can't remember what it is. Something with an environment variable, or some such. Hopefully someone who knows will enlighten the both of us :)
That would be interesting if works well.

Re: VM as Windows Service in Separate Mode?

Posted: 21. Aug 2015, 11:12
by noteirak
What you are trying to achieve goes against the working model of VirtualBox, which is one to isolate user environment and not share VMs.
I don't know if it is possible to achieve what you want but only the devs will be able to answer on this one.

Re: VM as Windows Service in Separate Mode?

Posted: 21. Aug 2015, 11:25
by frank
I cannot explain how this works for Windows but on non-Windows systems, it's all about which user is used. The XPCOM code searches for the directory /tmp/.vbox-$USER-ipc. It needs to have permissions to read this directory. The file lock within this directory contains the PID of the current running VBoxXPCOMIPCD service which is responsible for finding the VBoxSVC service. And ipcd is a socket used to communicate with VBoxSVC.

Someone else will have to comment the Windows bits.

Re: VM as Windows Service in Separate Mode?

Posted: 2. Aug 2016, 03:03
by mribichich
Hi there. I been running vboxvmservice along side phpvirtualbox and they show the same vms state. They are both running with the same user.
But when I open vbox gui the state is not shared even though is the same user.

Is there a way to make them share the state?

I know its probably something to do with user permissions, even when I use the same user for everything the service and the gui dont share state.

Anybody knows if there is something to do?

thanks