[VBoxVmService] -> Discussion & Support

Discussions related to using VirtualBox on Windows hosts.
KeithGS
Posts: 4
Joined: 20. Sep 2009, 05:43
Primary OS: MS Windows 7
VBox Version: OSE other
Guest OSses: Ubuntu 64 bit Server Edition, Windows XP SP3 Professional 64 bit

Re: [VBoxVmService] -> Discussion & Support

Post by KeithGS »

Hello, I'm running on Windows 7 64 bit, and I'm trying to get this working....

[Settings]
ServiceName=VBoxVmService
PathToVBoxSDL=C:\Program Files\Sun\VirtualBox\VBoxSDL.exe
PathToVBoxVRDP=C:\Program Files\Sun\VirtualBox\VBoxHeadless.exe
PathToVBoxManage=C:\Program Files\Sun\VirtualBox\VBoxManage.exe
RunAsUser=Keith
RunAtDomain=Keith-PC
UserPassword=
[Vm0]
VmName=Ubuntu
CommandLineUp=c:\vms\startup.exe 1 BRUTEFORCE
CommandLineDown=c:\vms\shutdown.exe 1
WorkingDir=C:\vms
StartupMethod=vrdp
ShutdownMethod=savestate
VrdpPort=3389
when running startup I get

ERROR: Could not find a registered machine named ''
Details: code VBOX_E_OBJECT_NOT_FOUND (0x80bb0001), component VirtualBox, interface IVirtualBox, callee IUnknown
Context: "FindMachine (Bstr(VMNameOrUuid), machine.asOutParam())" at line 1988 of file VBoxManageInfo.cpp
Errors occurred trying to start VM0!
Check the VBoxVmServ.ini values, sections [Settings] and [Vm0]!
Removing lockfile: STARTUP
Removing temporary helpfiles...
And Yes the service is running, I checked.


any idea why?
FB2000
Posts: 92
Joined: 10. Sep 2009, 13:27
Primary OS: MS Windows 7
VBox Version: PUEL
Guest OSses: CentOS

Re: [VBoxVmService] -> Discussion & Support

Post by FB2000 »

KeithGS wrote:Hello, I'm running on Windows 7 64 bit, and I'm trying to get this working....
And Yes the service is running, I checked.
any idea why?
Well, I might be wrong but just trying to help.

First, I guess you are not running the latest version of VBoxVmService since PathToVBoxVRDP has been changed to PathToVBoxHeadless on the version I am using. Please try the latest version.

Next, you might want to change

Code: Select all

c:\vms\startup.exe 1 BRUTEFORCE
to

Code: Select all

c:\vms\startup.exe 0 BRUTEFORCE
because the first virtual machine is called Vm0.

Actually you should try to run

Code: Select all

c:\vms\startup.exe 0 BRUTEFORCE
or

Code: Select all

c:\vms\startup.bat 0 BRUTEFORCE
at command line and see if your virtual machine starts up normally. If it still doesn't work, or if it works in command line but not in system service, you might want to check these:
1) Make sure the VirtualBox.xml file are hard-linked/copied to the right place (C:\Windows\System32\config\Systemprofile\.VirtualBox for Win7), as clearly written in the VBoxVmService document, so that it can be accessed by system account.
2) Try the patch I've posted in last page. I am also using 64bit Win7 host and I find everything works well with my patch on.
uhleeka
Posts: 1
Joined: 30. Sep 2009, 07:48
Primary OS: MS Windows 2003
VBox Version: OSE other
Guest OSses: Windows XP

Re: [VBoxVmService] -> Discussion & Support

Post by uhleeka »

Hey Mattz,

Thanks much for your hard work on this. I spent hours banging my head trying to get up and running on a Windows 2003 Server (actually, a Windows SBS 2003) and I thought I'd pass along the things that worked for me.

1. I fstuil'd the "Default User" instead of the "Local Service" account:

Code: Select all

fsutil hardlink create "C:\Documents and Settings\Default User\.VirtualBox\VirtualBox.xml" 
		"C:\Documents and Settings\Administrator\.VirtualBox\VirtualBox.xml"
2. I had to change the VrdpPort setting to something other than 3389. This was the big time killer for me. I didn't make the connection that the vrdp port was already bound (on my host server i assume) to 3389. I thought that it was somehow the VBox port that I was binding. :oops: It wasn't until I started digging through the \src\bat\startup_cli.bat file that I finally got an error message saying something about "Cannot bind to port 3389 because it is already in use." So anyhow, I finally got it all working with the following ini config:

Code: Select all

[Settings]
ServiceName=VBoxVmService
PathToVBoxSDL=C:\Program Files\Sun\VirtualBox\VBoxSDL.exe
PathToVBoxHeadless=C:\Program Files\Sun\VirtualBox\VBoxHeadless.exe
PathToVBoxManage=C:\Program Files\Sun\VirtualBox\VBoxManage.exe
RunAtDomain=DOMAIN
RunAsUser=administrator
UserPassword=password
[Vm0]
VmName=BPGREMOTE
CommandLineUp=D:\VirtualBox\VBoxVMService\startup.exe 0 BRUTEFORCE
CommandLineDown=D:\VirtualBox\VBoxVMService\shutdown.exe 0
WorkingDir=D:\VirtualBox\VBoxVMService
StartupMethod=vrdp
ShutdownMethod=poweroff
VrdpPort=3333
Thanks!
SteveWebster
Posts: 1
Joined: 1. Oct 2009, 07:14
Primary OS: MS Windows Vista
VBox Version: OSE other
Guest OSses: XP

Re: [VBoxVmService] -> Discussion & Support

Post by SteveWebster »

Ok I have a minor problem with the VBoxVmService -- Sorry if I am posting in the wrong area but as I see others doing it I just felt like jumping on the band wagon.

Ok here is the problem, I have the vm up and running, I need it to run xp because my stupid print server does not work in Vista x64 (network driver is only 32bit Stupid Linksys). But I have the print driver working fine in the vm and have it network shared to my host machine and all works well when I run it manually, but I want it to startup in the background.

This is the output I see when I do the "startup_cli.exe 0" command

Code: Select all

No previously started VM operations to wait for. Continuing...
Reading global parameters...
Reading parameters for VM0...
VirtualBox Command Line Management Interface Version 3.0.6
(C) 2005-2009 Sun Microsystems, Inc.
All rights reserved.

Name:            WXP
Guest OS:        Windows XP
UUID:            b5225744-39e4-451d-a2b0-1329410b6374
Config file:     C:\Users\Daddio\.VirtualBox\Machines\WXP\WXP.xml
Memory size:     1024MB
VRAM size:       12MB
Number of CPUs:  1
Boot menu mode:  message and menu
Boot Device (1): Floppy
Boot Device (2): DVD
Boot Device (3): HardDisk
Boot Device (4): Not Assigned
ACPI:            on
IOAPIC:          off
PAE:             off
Time offset:     0 ms
Hardw. virt.ext: on
Nested Paging:   off
VT-x VPID:       off
State:           powered off (since 2009-10-01T04:51:15.000000000)
Monitor count:   1
3D Acceleration: off
Floppy:          empty
SATA:            disabled
IDE Controller:  PIIX4
Primary master:  C:\vmxp\WXPVM.vdi (UUID: fe6d0d4f-f7e9-4d60-a15b-037952ccc577)
DVD:             empty
NIC 1:           MAC: 080027BA6E03, Attachment: Bridged Interface 'Realtek RTL81
69/8110 Family PCI Gigabit Ethernet NIC (NDIS 6.0)', Cable connected: on, Trace:
 off (file: none), Type: Am79C973, Reported speed: 0 Mbps
NIC 2:           disabled
NIC 3:           disabled
NIC 4:           disabled
NIC 5:           disabled
NIC 6:           disabled
NIC 7:           disabled
NIC 8:           disabled
UART 1:          disabled
UART 2:          disabled
Audio:           enabled (Driver: DSOUND, Controller: AC97)
Clipboard Mode:  Bidirectional
VRDP:            disabled
USB:             enabled

USB Device Filters:

<none>

Shared folders:  <none>

Guest:

Statistics update:                   disabled


Errors occurred trying to start VM0!
Check the VBoxVmServ.ini values, sections [Settings] and [Vm0]!
Removing lockfile: STARTUP
Removing temporary helpfiles...
Done. -- Hit any key to quit --
and here is my VBoxVmService.ini

Code: Select all

[Settings]
ServiceName=VBoxVmService
PathToVBoxSDL=C:\Program Files\Sun\VirtualBox\VBoxSDL.exe
PathToVBoxHeadless=C:\Program Files\Sun\VirtualBox\VBoxHeadless.exe
PathToVBoxManage=C:\Program Files\Sun\VirtualBox\VBoxManage.exe
RunAsUser=Steven
RunAtDomain=Daddio-PC
UserPassword=******
[Vm0]
VmName=WXP
CommandLineUp=C:\vms\startup.exe 0 BRUTEFORCE
CommandLineDown=C:\vms\shutdown.exe 0
WorkingDir=C:\vms
StartupMethod=
ShutdownMethod=savestate
VrdpPort=3333
It is my 50+ year old father's pc, and I do not think he wants to switch back to xp or move on to 7 just yet. Am I missing something easy? Is it because his computer name is Daddio-PC (a hyphen causing all the problems?)?
methc
Posts: 1
Joined: 14. Oct 2009, 21:49
Primary OS: MS Windows 2003
VBox Version: OSE other
Guest OSses: Windows XP, Windows 2003 R2

Re: [VBoxVmService] -> Discussion & Support

Post by methc »

Hi

I am new to the forum board – I was using the forum for informational purposes but now feel compelled to share my experience with this project with the rest of members and people who might be seeking answers.

Let me start off first by thanking the author of this project. I don’t know why Sun created VirtualBox without a way of automatically starting a Virtual Machine (VM). I believe Sun should seriously look into integrating this great solution.

I know it is frustrating trying to get this project to integrate and work along with VirtualBox, it was very frustrating for me. The reason for this is mainly because I did not understand everything there is to understand about how this project works along, not only with Virtual Box, but also with your OS (whether it’s Windows or a *nix based system). The project itself works well – big thanks to author.

After playing around, trouble-shooting and doing a lot of reading now only from this forum but other forums as well I managed to do a test successfully on a Windows 2003 R2 server running a WinXP VM. I managed to setup the VBox service on my production server in under 30 mins. I only tested it by stopping/restarting the service (which did save state and startup of the VM). Because it is a production server I couldn’t do a physical reboot of the server itself, but I am very confident that the VM will start automatically tomorrow morning without my intervention as I’ve tested all of this on a test server before actually implementing in my business environment.

How I accomplished a successful installation of the Vbox service? In a nut shell….

1. You need to hardlink not only to LocalService and NetworkService but also to Default User.
2. I set security permissions on the following folders –
a) VMS (this is the project folder. I placed this in C:\VMS)
b) LocalService
c) NetworkService
d) Default Users

Note 1: You need to of course add the user account that you are using to START the service to the ACL of the above listed folders.

Note 2: Make sure you push the permissions down by using the propagate function. This will ensure that not only the folder gets the right permissions but also the files within.
3. Change all paths in the .xml file located in the profile that created the VM to absolute paths.
4. Use any other port other than 3389 when using VRDP. Needless to say you need to use a ‘free’ port. Note: I used port 3380 – but when connecting using RDP I leave the port as default (3389). What I did was to turn on remote desktop manually in the WinXP VM.
5. Watch out for the variable ‘PathToVBoxVRDP’ in the .ini file. This variable changed to ‘PathToVBoxHeadless’
6. If your PC (the PC you are running the service from, called the host) is on a domain like mine is you can just use the PC netbios name without the domain trailing after it. You need to fill this in the ini file at variable 'RunAtDomain'.
7. Always use a local user account in the ini file. You of course have to specify the password in ini file! My local user account is part of the admin group.

Maby later there can be some form of encryption for either the user credentials or for the entire ini settings file.
Also, while this is a great project, the log file needs work. People depend on the log file to help them identify problems.

If I remember anything else that might help I’ll update this post.

I hope this helps someone….

Regards,

Carlos De Cunha
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] -> Discussion & Support

Post by mattz »

Hey guys!

Since I have not been visiting this forum for a very long time, I just wanted to say that it's actually pretty nice to see that my old project is still up here. :D

A big round of applause goes to all the supporters and contributors that keep this project alive!!!

Cheers, mattz
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] -> Discussion & Support

Post by mattz »

I just put together a new release including the patches submitted by FB2000. Check http://forums.virtualbox.org/viewtopic. ... 95#p106839 for further details.

--mattz
 Edit:  @all VirtualBox geeks out there: Would it be a good idea to implement support for the VBOX_USER_HOME environment variable? Just thought that this might rid out some of the more common access problems regarding the XML-files... Any comments? 
FB2000
Posts: 92
Joined: 10. Sep 2009, 13:27
Primary OS: MS Windows 7
VBox Version: PUEL
Guest OSses: CentOS

Re: [VBoxVmService] -> Discussion & Support

Post by FB2000 »

Hi Mattz,

I believe it's much better to use VBOX_USER_HOME environment variable, than ask users to copy/hardlink the config file directory. If it works, this should get rid of most the config file access problem, especially for those who using Vista/Window7. I just can't figure out how this variable could be utilized. But I guess you already have an idea, don't you?

Best regards, FB2000
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] -> Discussion & Support

Post by mattz »

Actually I do... :)

The easiest way would be to add the environment variable to the [Settings]-section of the VBoxVmService.ini file.

Since all variables from this section are autocast from within the startup script this should work.

You can actually try this by adding the line:

Code: Select all

VBOX_USER_HOME=C:\Users\{YOUR USER NAME}\.VirtualBox
(if you are using Windows 7) or:

Code: Select all

VBOX_USER_HOME=C:\Documents and Settings\{YOUR USER NAME}\.VirtualBox
(if your OS is Windows XP or 2003) right below the existing line:

PathToVBoxManage=C:\{WHATEVER YOUR VALUE IS HERE}


Then kill your active hardlinks and reboot your system. If VBoxVmService still works as expected afterwards, then you are good to go!


Cheers, Mattz

ps: let me know if that works, since I need to update the docs about this then...
Last edited by mattz on 10. Nov 2009, 07:10, edited 1 time in total.
FB2000
Posts: 92
Joined: 10. Sep 2009, 13:27
Primary OS: MS Windows 7
VBox Version: PUEL
Guest OSses: CentOS

Re: [VBoxVmService] -> Discussion & Support

Post by FB2000 »

Now I see. VBOX_USER_HOME variable is understand by VBoxManage. :D

Simply adding VBOX_USER_HOME to VBoxVmService.ini doesn't seem to work, however. I even tried to set VBOX_USER_HOME at startup.bat directly right above the line calling VBoxManage.exe, with no luck.
But If I set the system variable VBOX_USER_HOME at "Computer->Properties->Advanced system settings->Advanced->Environment Variables", it works! Looks like the problem is variable set at startup.bat is not inherited by VBoxManage. Is there a way to set variable global at batch file?
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] -> Discussion & Support

Post by mattz »

I just reviewed the manual and the VBOX_USER_HOME variable doesn't seem to be allowed a trailing backslash. so you could try removing that final backslash and see if this gets the party going...

you can check the current settings of your VBOX_USER_HOME variable, when you issue the follwing command on a terminal/shell:

Code: Select all

echo %VBOX_USER_HOME%
another approach would be to set a machine wide environment variable from within the startup script. please check, whether setx.exe comes with the windows resource kit tools, though it should already be integrated with windows 7...

just try by opening a command prompt and typing

Code: Select all

setx
and hit enter.

If you get an appropriate response, you could add the following lines to startup.bat (after the delete command towards the globals helper batch file around line no. 94):

Code: Select all

rem #  SETTING VBOX_USER_HOME WITHIN THE MACHINE ENVIRONMENT
echo Setting VBOX_USER_HOME within the machine environment... >> "%VMSInstallPath%\VBoxVmService.log"
setx.exe VBOX_USER_HOME %VBOX_USER_HOME% -m
This would pretty much read the variable locally and then cast it to the machine context. I have attached a "startup_test.bat"-file, which has the above changes already applied.

--- mattz
Attachments
startup_test.zip
(1.9 KiB) Downloaded 46 times
FB2000
Posts: 92
Joined: 10. Sep 2009, 13:27
Primary OS: MS Windows 7
VBox Version: PUEL
Guest OSses: CentOS

Re: [VBoxVmService] -> Discussion & Support

Post by FB2000 »

Hi Mattz,

The setx method works with a little modification: either remove -m option for setx.exe, or add an appropriate .manifest file for startup.exe.

I'll explain why: On Window 7 when a executable file is called inside another process, the new process runs as Standard user by default, unless we add a manifest file and set requestedExecutionLevel. The call to

Code: Select all

setx.exe VBOX_USER_HOME %VBOX_USER_HOME% -m
will fail because we are trying to change system wide variable.

If we just call

Code: Select all

setx.exe VBOX_USER_HOME %VBOX_USER_HOME%
however, it will succeed. The variable is changed only for current user (LocalService), but that's enough for our purpose. VBoxManage.exe could find it and VM can be start up! :D

I guess we don't need the manifest anyway. But I just attached it here because this is what I tried first and just in case someone might be interested.

FYI, the command setx.exe comes native with Windows 7. And the trailing backslash is not a problem. It works with or without the backslash.
Attachments
startup.exe.manifest.zip
unzip and put together with startup.exe.
(581 Bytes) Downloaded 33 times
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] -> Discussion & Support

Post by mattz »

Well - I'm glad we worked it out. As you know I am sort of "blacked out" from testing, since I rid all my Windows boxes in favor of Macs... Anyway, I think it's about time to update the docs. This makes a successful installation of VBoxVmService a whole lot easier... Thanks again for your help!

Cheers, Mattz
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] -> Discussion & Support

Post by mattz »

VBoxVmService Release 20091109-win7 has arrived! More on that here: http://forums.virtualbox.org/viewtopic. ... 51#p108451

Cheers, Mattz
DWolfman
Posts: 6
Joined: 11. Nov 2009, 07:36
Primary OS: Fedora 16
VBox Version: PUEL
Guest OSses: Windows Server 2008 R2

Re: [VBoxVmService] -> Discussion & Support

Post by DWolfman »

mattz wrote:VBoxVmService Release 20091109-win7 has arrived! More on that here: http://forums.virtualbox.org/viewtopic. ... 51#p108451

Cheers, Mattz
While I really like this service capability for VirtualBox and am glad to have this new version that supports Windows 7, I may have to quit using it.

For some reason, Windows 7 kills the virtual machine before the service can finish shutting it down. It doesn't matter what shutdown option I use, as it still does it. With the savestate option the log file indicates that it got done saving it (shows 100% done for that), but when the vm starts up and the Server 2008 R2 guest I have gets to the desktop it asks me why it was not shut down cleanly. This mainly happens if I restart the host (Windows 7) and I did not go through stopping the service first. I have seen it happen even with the startup.exe and shutdown.exe commands from the vms folder in an administrator command prompt, though.

I noticed the service goes to a stopped state within a couple seconds, but it takes up to another 10 to 15 seconds for the vm to actually finish saving it's state and powering off. When Windows 7 goes through it's shutdown before the restart, it seems to go fairly quickly, faster than I think it should if it was really waiting for the vm to shut down.

Is there any way to solve this and have the service actually wait on shutting down until the VM is actually shut down before letting the host continue with it's shutdown? If a solution cannot be found, I'll have to go through setting up some tasks and put a shutdown script in the host OS's group policy to make sure the VM gets shut down cleanly instead.
Post Reply