[VBoxVmService] -> Discussion & Support

Discussions related to using VirtualBox on Windows hosts.
mattz
Posts: 95
Joined: 18. Feb 2008, 11:51
Primary OS: Mac OS X other
VBox Version: PUEL
Guest OSses: WinXP/Debian/OSX
Location: Germany
Contact:

general help / a step-by-step tutorial

Post by mattz »

The parameter "RunAtDomain=" MUST NOT BE EMPTY, OR ELSE VBoxVmService WILL FAIL!

If you are not running within a domain-controlled environment, paste your local computer's name here (e.g. "RunAtDomain=winserver" -- as always: no quotes here or anywhere else within the .INI-file!!!!)

'This is my .INI file (works like a charm):

Code: Select all

[Settings]
ServiceName=VBoxVmService
PathToVBoxSDL=C:\vbox\VBoxSDL.exe
PathToVBoxVRDP=C:\vbox\VBoxHeadless.exe
PathToVBoxManage=C:\vbox\VBoxManage.exe
RunAsUser=vboxuser
RunAtDomain=winserver
UserPassword=vboxsecret123
[Vm0]
VmName=ubuntuserver-dev
CommandLineUp=c:\vms\startup.exe 0
CommandLineDown=c:\vms\shutdown.exe 0
WorkingDir=C:\vms
StartupMethod=vrdp
ShutdownMethod=savestate
VrdpPort=3389
Some comments:

The host-machine's hostname IS "winserver".
There is an actual user-account on this local system: "vboxuser" (that's the login-name!)
This user-account "vboxuser" has administrative privileges (or else VboxVmService will not run!).
A password has to be set for the user' account! In my demo-case, this password is: "vboxsecret123". Passwords on Windows are case-sensitive!

I used the account "vboxuser" to create the virtual machines, that are to be controlled by the service. This user has to have FULL ACCESS to the Machines' configuration data as well as their .vdi-files!
Any hardlinks in the filesystem point to the original VirtualBox.xml-file that was created for this user and is located at: "C:\Documents and Settings\VboxUser\.VirtualBox\VirtualBox.xml".

Double check, that you have:
---------------------------------------------------------------
- Microsoft Windows 2003 Resource Kit Tools
- Microsoft Visual C++ Runtime (version 2005 or later)
- Microsoft Dotnet Framework 2.0

installed on your host machine.



Checklist:
-------------------------------------------------------------------------

0. set your host-computer's name to "winserver", save & reboot

1. create a local user "vboxuser" with admin-privileges

2. secure this account with the password "vboxsecret123"

3. log out of your winbox

4. log on to the system as "vboxuser"

5. fire up your virtualbox-application

6. create a vm called "vmtest" for testing purposes and install some linux within

7. start the vm "vmtest" - make sure that it works alright

8. shut down the vm

9. uninstall VBoxVmService if you have it installed:
type: VboxVmService.exe -u [ENTER] in a command-prompt

10. unzip a fresh copy of the latest vboxvmservice-package to "c:\vms"

11. open a command prompt

12. type:
del "C:\Documents and Settings\LocalService\.VirtualBox\*.*" [ENTER]

13. type:
del "C:\Documents and Settings\NetworkService\.VirtualBox\*.*" [ENTER]

14. type: fsutil hardlink create "C:\Documents and Settings\LocalService\.VirtualBox\VirtualBox.xml"
"C:\Documents and Settings\vboxuser\.VirtualBox\VirtualBox.xml"
[ENTER]

14a. type: fsutil hardlink create "C:\Documents and Settings\NetworkService\.VirtualBox\VirtualBox.xml"
"C:\Documents and Settings\vboxuser\.VirtualBox\VirtualBox.xml"
[ENTER]

15. type: cd c:\vms [ENTER]

16. type: notepad VBoxVmService.ini [ENTER]

17. delete all contents within the ini-file, then paste the following:

Code: Select all

[Settings]
ServiceName=VBoxVmService
PathToVBoxSDL=C:\Path\to\your\VirtualBox\install\VBoxSDL.exe
PathToVBoxVRDP=C:\Path\to\your\VirtualBox\install\VBoxHeadless.exe
PathToVBoxManage=C:\Path\to\your\VirtualBox\install\VBoxManage.exe
RunAsUser=vboxuser
RunAtDomain=winserver
UserPassword=vboxsecret123
[Vm0]
VmName=vmtest
CommandLineUp=c:\vms\startup.exe 0
CommandLineDown=c:\vms\shutdown.exe 0
WorkingDir=C:\vms
StartupMethod=vrdp
ShutdownMethod=savestate
VrdpPort=3389

18. update "C:\Path\to\your\VirtualBox\install\" to match your local system's setup, save the file and quit notepad

19. type: VBoxVmService.exe -i [ENTER]

20. open up the windows taskmanager, change to the process tab and check the option "show processes for all users"

21. switch back to the command prompt and type: startup_cli.exe 0 [ENTER]

22. you should be seeing several "cmd.exe" processes appearing and disappearing within taskmanager's process list. "VBoxSVC.exe" should come up first, then "VBoxHeadless.exe"

23. all done


--- cheers, mattz

 Edit: : If you experience the issue of your vm's not being fired up by the service, check your xml file and replace any possible relative links with their appropriate absolute values. check this post: http://forums.virtualbox.org/viewtopic. ... c&start=67 for background information on this problem (thanks to nimrod for investigating the issue).


______________
PS: If you are applying for help here, please make sure to post your setup's complete configuration:

- Machine outline (Processor, etc...)
- Windows Version and Service Pack Level
- VirtualBox Version
- VBoxVmService Version
- your complete .INI file 
Last edited by mattz on 19. Dec 2008, 09:33, edited 3 times in total.
mattz
Posts: 95
Joined: 18. Feb 2008, 11:51
Primary OS: Mac OS X other
VBox Version: PUEL
Guest OSses: WinXP/Debian/OSX
Location: Germany
Contact:

Post by mattz »

... just took 10 minutes replaying my previous step-by-step tutorial on win xp sp3 32bit with virtualbox 1.6.2. the service fired up the vm as expected running from LocalService (i hardlinked only to that directory, so i guess you can safely skip the steps 13 and 14a).

---cheers, mattz


---[ EDIT ]---
If you plan on using it with VBox's current version (1.6.2), there seems to be an issue with VBoxSDL.exe -- it just won't work. I'm trying to get in contact with the developer-team next week to figure out a solution to this problem. Yet you can always use VBoxHeadless and the vrdp-mode worked for me without any issues.
mrpeggit
Posts: 2
Joined: 22. Jul 2008, 17:01

Post by mrpeggit »

Hi,

I have manged to successfully run a virtual Debian on my XP box to access my Linux SoftRAID with the help of VBoxVmService. So everything works fine as long as I use startup_cli or when I start the service manually.
When the service has been started automatically the first time on startup it works well, too. But when I restart my machine, the service is not started again and never will. The reason for this seems to be a remaining file in the "run" folder during shutdown. I find several files in the temp, run and lock folders. That leads me to the assumption that the service is not stopped correctly.
Does any one else has this problem, or even better, has a solution for this behaviour? How can I make sure that the service is stopped during shutdown correctly?

Thanks!
mattz
Posts: 95
Joined: 18. Feb 2008, 11:51
Primary OS: Mac OS X other
VBox Version: PUEL
Guest OSses: WinXP/Debian/OSX
Location: Germany
Contact:

Post by mattz »

If you want to be sure about the state of the vm do this:

rename "startup.exe" to "startup.bak", so that it can not be found or triggered (or move it out of the installation folder temporarily).

Shut down, then restart your machine. Open up the Virtualbox GUI and you will see the machines current state.

Remember: The option "poweroff" equals a cable-cut on a running system. I would ALWAYS recommend "savestate". The virtualbox Gui will tell you exactly what state your machine is currently in.

have you tried issuing the startup_cli.exe instead of startup.exe in your .INI-File? Technically they do the exact same thing - but if one version works for you and the other doesn't, I think it would be worth a shot...

I am currently in overload with projects so I am *not* working on a maintenance release at the moment nor do I have the time to track possible problems within the application ... sorry guys - i guess for the moment it's just a question of luck whether vboxvmservice will run with your system setup or not...

cheers, mattz

 Edit:  the runfiles will be deleted last in the shutdown process, so it might be that your system just doesnt stay active long enough to kill all files.
I was planning to add a "brute force clearup" option to the service on startup, since i encountered similar problems on two or three machines. I just didn't find an option to prioritize the vboxvmservice to be an "early shutdown candidate" within a reboot or halt sequence yet. any suggestions here, anyone? 
mrpeggit
Posts: 2
Joined: 22. Jul 2008, 17:01

Post by mrpeggit »

mattz wrote:the runfiles will be deleted last in the shutdown process, so it might be that your system just doesnt stay active long enough to kill all files.
I was planning to add a "brute force clearup" option to the service on startup, since i encountered similar problems on two or three machines. I just didn't find an option to prioritize the vboxvmservice to be an "early shutdown candidate" within a reboot or halt sequence yet. any suggestions here, anyone?
This seems to be the problem. The virtual machine is powered down but the runfile has not been deleted.

Hopefully your work can be integrated into VirtualBox soon so everybody can use this really great feature without any hassle. Thanks for your work so far!
mattz
Posts: 95
Joined: 18. Feb 2008, 11:51
Primary OS: Mac OS X other
VBox Version: PUEL
Guest OSses: WinXP/Debian/OSX
Location: Germany
Contact:

Post by mattz »

VBoxVmService rel20080728 has arrived

What's new?

Added a BRUTEFORCE option to the startup-calls. This will kill any possibly remaining run- or lockfiles for a VM before startup.
The non-cli versions of startup and shutdown now save all their outputs to the logfile.


As always, this release is available from the official Sourceforge Site at:

http://sourceforge.net/projects/vboxvmservice




Cheers, mattz


@mrpeggit: Hope this does the trick for now. :-)
Last edited by mattz on 28. Jul 2008, 02:58, edited 1 time in total.
mattz
Posts: 95
Joined: 18. Feb 2008, 11:51
Primary OS: Mac OS X other
VBox Version: PUEL
Guest OSses: WinXP/Debian/OSX
Location: Germany
Contact:

Post by mattz »

Example usage of the bruteforce-feature:

Code: Select all

[Settings]
ServiceName=VBoxVmService
PathToVBoxSDL=C:\vbox\VBoxSDL.exe
PathToVBoxVRDP=C:\vbox\VBoxHeadless.exe
PathToVBoxManage=C:\vbox\VBoxManage.exe
RunAsUser=VboxUser
RunAtDomain=winserver
UserPassword=vboxsecret123
[Vm0]
VmName=ubuntuserver-dev
CommandLineUp=c:\vms\startup.exe 0 BRUTEFORCE
CommandLineDown=c:\vms\shutdown.exe 0
WorkingDir=C:\vms
StartupMethod=vrdp
ShutdownMethod=savestate
VrdpPort=3389 
nimrod
Posts: 5
Joined: 5. Aug 2008, 17:09

VBoxVMService not starting Virtual Machines

Post by nimrod »

Thanks for the great program, exactly what I needed.

I thought people might be interested in the problem I just encountered though.

VBoxVMService started fine, and everything looked like it was working perfectly (all the right messages, and the correct tmp, run & lock files). However no virtual machines were starting and no VBoxVRDP.exe appeared in the task manager.

After a few hours of going in circles trying different things, I noticed that I didn't have a VBoxVRDP.exe (there's a DLL and an LNK). I tried replacing it in VBoxVMService.ini with VBoxHeadless.exe (see below) and it works like a dream.

PathToVBoxVRDP=C:\Progra~1\sun\xvmvir~1\VBoxHeadless.exe


I'm using version 1.6.2 of Sun xVM VirtualBox.


I hope this helps someone else avoid the pain I went through.

Thanks again,
Colin :D
nimrod
Posts: 5
Joined: 5. Aug 2008, 17:09

...I spoke too soon

Post by nimrod »

I just had further trouble with this.

It worked fine using the start_cli.exe, which I assumed meant that it was all good. However after rebooting to test it didn't work, back to the same symptoms.

I just worked out that it only works using start_cli.exe when the VirtualBox GUI is open. That's obviously not good.
mattz
Posts: 95
Joined: 18. Feb 2008, 11:51
Primary OS: Mac OS X other
VBox Version: PUEL
Guest OSses: WinXP/Debian/OSX
Location: Germany
Contact:

Re: VBoxVMService not starting Virtual Machines

Post by mattz »

nimrod wrote:Thanks for the great program, exactly what I needed.

I thought people might be interested in the problem I just encountered though....
Reading earlier posts (or the release notes) would have saved you quite some time (here my post related to the 1.6.0 release):
mattz wrote:If you are planning to upgrade to VirtualBox's latest version 1.6.0, you need to know the following tweak:

Since the VRDP Server controller is no longer called "VBoxVRDP.exe", but instead "VBoxHeadless.exe", you will have to update the according value in your VBoxVmService.ini-file to look something like:

PathToVBoxVRDP=C:\vbox\VBoxHeadless.exe
...
Your latest problems relate most certainly to runfiles not being deleted on shutdown and a solution to this issue was presented with the latest release and explained three posts earlier. I am happy that you find this hack useful but I have to encourage you to read previously posted information more carefully. This saves both the users and the supporters time to concentrate on actually unreported errors. Furthermore I have to insist on at least some basic infos on your system and setup (as posted earlier in this thread). It's kind of hard trying to guess your software- and systemlayout... #

Once again: Future support inquiries will only be answered, if they have not yet been met by the issued release-information or previously granted assistance. Also posts not including your windows + service pack versions, virtualbox-version and vboxvmservice release id plus your VBoxVmService.ini-Files content will not be treated.

Please remember: This is free software and I use my sparetime trying to support the users the best possible way. So the least I can ask for, is to meet these few requests...


--mattz
nimrod
Posts: 5
Joined: 5. Aug 2008, 17:09

Sorry

Post by nimrod »

Sorry mattz, I didn't mean to cause offence. :(

I did read the first couple of pages of the forum before I downloaded the software, but I didn't realise it later turned into an extension of the documentation. So i didn't know about your request for my details, or the other problem solutions.

I appreciate that you are doing all this in your spare time (I thank-you a lot for all your efforts), which is why I wasn't actually expecting any help, i was just trying to share my experiences to help others.


Here are the details you wanted:
  • - Windows XP Pro (32 bit)
    - SP3
    - Sun xVM VirtualBox 1.6.2
    - VBoxVMService Ver: 2008-07-28
VBoxVMService.ini:

Code: Select all

[Settings]
ServiceName=VBoxVmService
PathToVBoxSDL=C:\Progra~1\sun\xvmvir~1\VBoxSDL.exe
PathToVBoxVRDP=C:\Progra~1\sun\xvmvir~1\VBoxHeadless.exe
PathToVBoxManage=C:\Progra~1\sun\xvmvir~1\VBoxManage.exe
RunAsUser=virtual.box
RunAtDomain=read
UserPassword=********

[Vm0]
VmName=Ubuntu-SVN
CommandLineUp=c:\progra~1\VBoxVMService\startup.exe 0
CommandLineDown=c:\progra~1\VBoxVMService\shutdown.exe 0
WorkingDir=C:\progra~1\VBoxVMService
StartupMethod=vrdp
ShutdownMethod=poweroff
VrdpPort=3390

[Vm1]
VmName=Vista
CommandLineUp=c:\progra~1\VBoxVMService\startup.exe 1
CommandLineDown=c:\progra~1\VBoxVMService\shutdown.exe 1
WorkingDir=C:\progra~1\VBoxVMService
StartupMethod=vrdp
ShutdownMethod=savestate
VrdpPort=3391
(I've tried with just one VM entry)

I haven't had a chance to look into this much more today as I've been in meetings, but having read the whole forum now, I don't think the solution is in there. I tried adding the extra HardLink in addition to the LocalService one, but that hasn't made any difference to my current problem (although it may have become an issue later).


It doesn't seem to be a problem with the run/tmp/lock files not being removed, as I'm deleting them after each failed attempt.


When I call start_cli.exe 0 (or 1) from the command line (after removing any run/tmp/lock files) it runs through without any errors. VBoxHeadless.exe does pop up in the Task Manager, but goes again straight away.

Output when failing to start:

Code: Select all

No previously started VM operations to wait for. Continuing...
Reading global parameters...
Reading parameters for VM0...
Using custom VRDP-Port: 3390

C:\Program Files\VBoxVMService\tmp\u_0_sub.bat ==> C:\Program Files\VBoxVMServic
e\tmp\u_0_sub.exe  (-hidden)


C:\Program Files\VBoxVMService\tmp\u_0_run.bat ==> C:\Program Files\VBoxVMServic
e\tmp\u_0_run.exe  (-hidden)

Installing temporary service "runserv"...
Shutting down "runserv" to avoid malfunctions...
Restarting "runserv"...
Starting VM: "Ubuntu-SVN" via vrdp as a service using account: "virtual.box"...
Moving lockfile: STARTUP to RUN
Shutting down "runserv"...
Removing temporary service "runserv"...
Removing temporary helpfiles...
Done. -- Hit any key to quit --

When I do the same thing with the VirtualBox GUI open the VBoxHeadless.exe stays open, and I can access the VM. This makes no sense to me.

I'm going to keep playing with it, but I have no idea what is different with the VBox GUI open. Maybe it's a sort of red herring.

Thanks mattz,
Colin :)
nimrod
Posts: 5
Joined: 5. Aug 2008, 17:09

That was painful!

Post by nimrod »

I solved it!!!

After much painfull investigation I got down to the point of running the contents of the u_0_run.bat (which becomes u_0_run.exe). Which is thus:

Code: Select all

"C:\Program Files\VBoxVMService\tools\runasv.exe" "C:\Program Files\VBoxVMService\tmp\u_0_sub.exe" \read\virtual.box "******"
This was still resulting in the same thing.

I tried making it call u_0_sub.bat rather than the exe, which I was surprised to find was ok, but still didn't work.

My breakthrough came when I added the following to the end of the line in u_0_sub.bat...

Code: Select all

 > c:\output.log
This successfully caught the output of the call to VBoxHeadless.exe, which revealed that I was apparently calling an invalid VM name. This showed me that it was an issue with access, not a setup issue.

The actual issue eventually turned out to be the fact that my VirtualBox.xml file was referencing the VDI and MACHINE directories relatively. After changing this to fully qualified paths it worked. I don't understand why this would make a difference because it should be running as the virtual.box user in whose directory structure they reside.

Here's what I changed...

from:

Code: Select all

...
<MachineEntry uuid="{195feec8-eb7c-4048-8db6-8b0c305e015f}" src="Machines\Ubuntu-SVN\Ubuntu-SVN.xml"/>
...
<VirtualDiskImage filePath="VDI\Ubuntu-SVN.vdi"/>
...
to:

Code: Select all

...
<MachineEntry uuid="{195feec8-eb7c-4048-8db6-8b0c305e015f}" src="c:\docume~1\virtual.box\.VirtualBox\Machines\Ubuntu-SVN\Ubuntu-SVN.xml"/>
...
<VirtualDiskImage filePath="c:\docume~1\virtual.box\.VirtualBox\VDI\Ubuntu-SVN.vdi"/>
...

Now I just have to find the fix that stops it leaving the run files behind, and it'll be all good. :wink:
mattz
Posts: 95
Joined: 18. Feb 2008, 11:51
Primary OS: Mac OS X other
VBox Version: PUEL
Guest OSses: WinXP/Debian/OSX
Location: Germany
Contact:

Re: That was painful!

Post by mattz »

nimrod wrote:I solved it!!!

Now I just have to find the fix that stops it leaving the run files behind, and it'll be all good. :wink:
First off: It's not that easy to actually offend me. :-) I have to say: Good job and quite a great hint for future users. I will definitely add this to the appropriate section of the manual.

The option to kill any left over runfiles is "BRUTEFORCE" which needs to be added to the startup-calls for each VM within the VBoxVmService.ini-file.

So try this one:

Code: Select all

CommandLineUp=c:\PATH-TO-YOUR\startup.exe 0 BRUTEFORCE 
Good luck!

--mattz
nimrod
Posts: 5
Joined: 5. Aug 2008, 17:09

Thanks

Post by nimrod »

Thank mattz.

It's all running like a dream now!! I can't tell you how happy I am to have this working. :D

Thanks, Colin 8)
TerryE
Volunteer
Posts: 3572
Joined: 28. May 2008, 08:40
Primary OS: Ubuntu other
VBox Version: PUEL
Guest OSses: Ubuntu 10.04 & 11.10, both Svr&Wstn, Debian, CentOS
Contact:

Post by TerryE »

mattz wrote:yet again, i have to promote vboxvmservice ...
Mattz, the thing about vboxvmservice is that we don't have a crisp integrated user guide which you can point users to. What we have is complex discussion with over 60 posts in it. What you should consider doing is a trick that I've learnt on other forums and started to use here which is to have two topics: one of which is your documentation / tutorial which only you post to and a link to a separate discussion topic. You can then use the posts within the main topic to create a chapter structure. I realise that this is a bit of a cludge, but it can be made to work.

Normally we would lock the main topic, so that only moderators post to it. Hover we can't in this case, but what we can do is if you put at the the end of the main topic a general comment "please use XXX (hyperlink) to discuss this. Any posts here will be deleted by the moderators" then we can police this for you. I would suggest that you might be an appropriate candidate for a moderator to this forum, but even though you clearly have a lot of expertise in VBox, you don't really contribute to the forum other than on the single subject of vboxvmservice.
Read the Forum Posting Guide
Google your Q site:VirtualBox.org or search for the answer before posting.
Post Reply