gpkvt/modernie_selenium

Error Running VBoxManage guestcontrol

Closed this issue · 24 comments

I don't even know where to start looking.
I'm on OSX10.10.
I got the following errors:

Running VBoxManage guestcontrol "IE8 - Win7" createdirectory "C:\Temp\" --username 'IEUser' --password 'Passw0rd!'
bash: -c: line 0: unexpected EOF while looking for matching `"'
bash: -c: line 1: syntax error: unexpected end of file
[WARNING] Error running VBoxManage guestcontrol "IE8 - Win7" createdirectory "C:\Temp\" --username 'IEUser' --password 'Passw0rd!'

...

Copy rename.bat...
ename.bat" --username 'IEUser' --password 'Passw0rd!'/tmp/rename.bat" "C:\Temp
VBoxManage: error: File copy failed
VBoxManage: error: Copying file "/tmp/rename.bat" failed with status 500, exit code 1
VBoxManage: error: Details: code VBOX_E_IPRT_ERROR (0x80bb0005), component GuestSession, interface IGuestSession
VBoxManage: error: Context: "int ctrlCopyFileToDest(COPYCONTEXT*, const char*, const char*, uint32_t)" at line 1945 of file VBoxManageGuestCtrl.cpp
VBoxManage: error: Copying file "/tmp/rename.bat" failed with status 500, exit code 1.
VBoxManage: error: Error processing "/tmp/rename.bat", rc=VERR_GENERAL_FAILURE
[WARNING] Error running VBoxManage guestcontrol "IE8 - Win7" copyto "Tools/ie_protectedmode.reg" "C:\Temp\ie_protectedmode.reg" --username 'IEUser' --password 'Passw0rd!'

...

Launch rename.bat...
ename.bat' --username 'IEUser' --password 'Passw0rd!'--image 'C:\Temp
VBoxManage: error: Could not resolve path to specified file was not found on guest
VBoxManage: error: Details: code VBOX_E_IPRT_ERROR (0x80bb0005), component GuestProcess, interface IGuestProcess, callee nsISupports
VBoxManage: error: Context: "WaitForArray(ComSafeArrayAsInParam(aWaitStartFlags), ctrlExecGetRemainingTime(u64StartMS, cMsTimeout), &waitResult)" at line 1337 of file VBoxManageGuestCtrl.cpp
[WARNING] Error running VBoxManage guestcontrol "IE8 - Win7" copyto "Tools/ie_disablecache.reg" "C:\Temp\ie_disablecache.reg" --username 'IEUser' --password 'Passw0rd!'

...

Apply IE Protected-Mode Settings...
Running VBoxManage guestcontrol "IE8 - Win7" copyto "Tools/ie_protectedmode.reg" "C:\Temp\ie_protectedmode.reg" --username 'IEUser' --password 'Passw0rd!'
VBoxManage: error: File copy failed
VBoxManage: error: Source file "Tools/ie_protectedmode.reg" does not exist or is not a file
VBoxManage: error: Details: code VBOX_E_IPRT_ERROR (0x80bb0005), component GuestSession, interface IGuestSession
VBoxManage: error: Context: "int ctrlCopyFileToDest(COPYCONTEXT*, const char*, const char*, uint32_t)" at line 1945 of file VBoxManageGuestCtrl.cpp
VBoxManage: error: Source file "Tools/ie_protectedmode.reg" does not exist or is not a file.
VBoxManage: error: Error processing "Tools/ie_protectedmode.reg", rc=VERR_GENERAL_FAILURE
[WARNING] Error running VBoxManage guestcontrol "IE8 - Win7" execute --image "C:\Temp\jre-windows-i586.exe" --username 'IEUser' --password 'Passw0rd!' -- /s

...

Disabling IE-Cache...
Running VBoxManage guestcontrol "IE8 - Win7" copyto "Tools/ie_disablecache.reg" "C:\Temp\ie_disablecache.reg" --username 'IEUser' --password 'Passw0rd!'
VBoxManage: error: File copy failed
VBoxManage: error: Source file "Tools/ie_disablecache.reg" does not exist or is not a file
VBoxManage: error: Details: code VBOX_E_IPRT_ERROR (0x80bb0005), component GuestSession, interface IGuestSession
VBoxManage: error: Context: "int ctrlCopyFileToDest(COPYCONTEXT*, const char*, const char*, uint32_t)" at line 1945 of file VBoxManageGuestCtrl.cpp
VBoxManage: error: Source file "Tools/ie_disablecache.reg" does not exist or is not a file.
VBoxManage: error: Error processing "Tools/ie_disablecache.reg", rc=VERR_GENERAL_FAILURE
[WARNING] Error running VBoxManage guestcontrol "IE8 - Win7" copyto "Tools/ie_disablecache.reg" "C:\Temp\ie_disablecache.reg" --username 'IEUser' --password 'Passw0rd!'

...

Installing Java...
Local file 'Tools/jre-windows-i586.exe' doesn't exist
Running VBoxManage guestcontrol "IE8 - Win7" copyto "Tools/jre-windows-i586.exe" "C:\Temp\jre-windows-i586.exe" --username 'IEUser' --password 'Passw0rd!'
VBoxManage: error: Warning: Source "Tools/jre-windows-i586.exe" does not exist, skipping!
Running VBoxManage guestcontrol "IE8 - Win7" execute --image "C:\Temp\jre-windows-i586.exe" --username 'IEUser' --password 'Passw0rd!' -- /s
VBoxManage: error: Could not resolve path to specified file was not found on guest
VBoxManage: error: Details: code VBOX_E_IPRT_ERROR (0x80bb0005), component GuestProcess, interface IGuestProcess, callee nsISupports
VBoxManage: error: Context: "WaitForArray(ComSafeArrayAsInParam(aWaitStartFlags), ctrlExecGetRemainingTime(u64StartMS, cMsTimeout), &waitResult)" at line 1337 of file VBoxManageGuestCtrl.cpp
[WARNING] Error running VBoxManage guestcontrol "IE8 - Win7" execute --image "C:\Temp\jre-windows-i586.exe" --username 'IEUser' --password 'Passw0rd!' -- /s

...

Installing Firefox...
Local file 'Tools/firefox.exe' doesn't exist
Running VBoxManage guestcontrol "IE8 - Win7" copyto "Tools/firefox.exe" "C:\Temp
                                                                                irefox.exe" --username 'IEUser' --password 'Passw0rd!'
VBoxManage: error: Warning: Source "Tools/firefox.exe" does not exist, skipping!
Running VBoxManage guestcontrol "IE8 - Win7" execute --image "C:\Temp
                                                                     irefox.exe" --username 'IEUser' --password 'Passw0rd!' -- /S
VBoxManage: error: Could not resolve path to specified file was not found on guest
VBoxManage: error: Details: code VBOX_E_IPRT_ERROR (0x80bb0005), component GuestProcess, interface IGuestProcess, callee nsISupports
VBoxManage: error: Context: "WaitForArray(ComSafeArrayAsInParam(aWaitStartFlags), ctrlExecGetRemainingTime(u64StartMS, cMsTimeout), &waitResult)" at line 1337 of file VBoxManageGuestCtrl.cpp
[WARNING] Error running VBoxManage guestcontrol "IE8 - Win7" execute --image "C:\Temp
                                                                                     irefox.exe" --username 'IEUser' --password 'Passw0rd!' -- /S

...

Installing Chrome Driver...
Running VBoxManage guestcontrol "IE8 - Win7" copyto "Tools/selenium_conf/chromedriver.exe" "C:/Windows/system32/chromedriver.exe" --username 'IEUser' --password 'Passw0rd!'
VBoxManage: error: File copy failed
VBoxManage: error: Source file "Tools/selenium_conf/chromedriver.exe" does not exist or is not a file
VBoxManage: error: Details: code VBOX_E_IPRT_ERROR (0x80bb0005), component GuestSession, interface IGuestSession
VBoxManage: error: Context: "int ctrlCopyFileToDest(COPYCONTEXT*, const char*, const char*, uint32_t)" at line 1945 of file VBoxManageGuestCtrl.cpp
VBoxManage: error: Source file "Tools/selenium_conf/chromedriver.exe" does not exist or is not a file.
VBoxManage: error: Error processing "Tools/selenium_conf/chromedriver.exe", rc=VERR_GENERAL_FAILURE
[WARNING] Error running VBoxManage guestcontrol "IE8 - Win7" copyto "Tools/selenium_conf/chromedriver.exe" "C:/Windows/system32/chromedriver.exe" --username 'IEUser' --password 'Passw0rd!'

...

Installing Selenium...
Running VBoxManage guestcontrol "IE8 - Win7" copyto "Tools/selenium_conf/selenium-server-standalone.jar" "C:/selenium/selenium-server-standalone.jar" --username 'IEUser' --password 'Passw0rd!'
VBoxManage: error: File copy failed
VBoxManage: error: Source file "Tools/selenium_conf/selenium-server-standalone.jar" does not exist or is not a file
VBoxManage: error: Details: code VBOX_E_IPRT_ERROR (0x80bb0005), component GuestSession, interface IGuestSession
VBoxManage: error: Context: "int ctrlCopyFileToDest(COPYCONTEXT*, const char*, const char*, uint32_t)" at line 1945 of file VBoxManageGuestCtrl.cpp
VBoxManage: error: Source file "Tools/selenium_conf/selenium-server-standalone.jar" does not exist or is not a file.
VBoxManage: error: Error processing "Tools/selenium_conf/selenium-server-standalone.jar", rc=VERR_GENERAL_FAILURE
[WARNING] Error running VBoxManage guestcontrol "IE8 - Win7" copyto "Tools/selenium_conf/selenium-server-standalone.jar" "C:/selenium/selenium-server-standalone.jar" --username 'IEUser' --password 'Passw0rd!'

...

Installing IEDriverServer...
Running VBoxManage guestcontrol "IE8 - Win7" copyto "Tools/selenium_conf/IEDriverServer.exe" "C:/Windows/system32/IEDriverServer.exe" --username 'IEUser' --password 'Passw0rd!'
VBoxManage: error: File copy failed
VBoxManage: error: Source file "Tools/selenium_conf/IEDriverServer.exe" does not exist or is not a file
VBoxManage: error: Details: code VBOX_E_IPRT_ERROR (0x80bb0005), component GuestSession, interface IGuestSession
VBoxManage: error: Context: "int ctrlCopyFileToDest(COPYCONTEXT*, const char*, const char*, uint32_t)" at line 1945 of file VBoxManageGuestCtrl.cpp
VBoxManage: error: Source file "Tools/selenium_conf/IEDriverServer.exe" does not exist or is not a file.
VBoxManage: error: Error processing "Tools/selenium_conf/IEDriverServer.exe", rc=VERR_GENERAL_FAILURE
[WARNING] Error running VBoxManage guestcontrol "IE8 - Win7" copyto "Tools/selenium_conf/IEDriverServer.exe" "C:/Windows/system32/IEDriverServer.exe" --username 'IEUser' --password 'Passw0rd!'

...

Configure Selenium...
Running VBoxManage guestcontrol "IE8 - Win7" copyto "Tools/selenium_conf/WIN7/IE8/config.json" "C:/selenium/config.json" --username 'IEUser' --password 'Passw0rd!'
VBoxManage: error: File copy failed
VBoxManage: error: Source file "Tools/selenium_conf/WIN7/IE8/config.json" does not exist or is not a file
VBoxManage: error: Details: code VBOX_E_IPRT_ERROR (0x80bb0005), component GuestSession, interface IGuestSession
VBoxManage: error: Context: "int ctrlCopyFileToDest(COPYCONTEXT*, const char*, const char*, uint32_t)" at line 1945 of file VBoxManageGuestCtrl.cpp
VBoxManage: error: Source file "Tools/selenium_conf/WIN7/IE8/config.json" does not exist or is not a file.
VBoxManage: error: Error processing "Tools/selenium_conf/WIN7/IE8/config.json", rc=VERR_GENERAL_FAILURE
[WARNING] Error running VBoxManage guestcontrol "IE8 - Win7" copyto "Tools/selenium_conf/WIN7/IE8/config.json" "C:/selenium/config.json" --username 'IEUser' --password 'Passw0rd!'

...

Prepare Selenium-Autostart...
Running VBoxManage guestcontrol "IE8 - Win7" copyto "Tools/selenium_conf/selenium.bat" "C:/ProgramData/Microsoft/Windows/Start Menu/Programs/Startup/selenium.bat" --username 'IEUser' --password 'Passw0rd!'
VBoxManage: error: File copy failed
VBoxManage: error: Source file "Tools/selenium_conf/selenium.bat" does not exist or is not a file
VBoxManage: error: Details: code VBOX_E_IPRT_ERROR (0x80bb0005), component GuestSession, interface IGuestSession
VBoxManage: error: Context: "int ctrlCopyFileToDest(COPYCONTEXT*, const char*, const char*, uint32_t)" at line 1945 of file VBoxManageGuestCtrl.cpp
VBoxManage: error: Source file "Tools/selenium_conf/selenium.bat" does not exist or is not a file.
VBoxManage: error: Error processing "Tools/selenium_conf/selenium.bat", rc=VERR_GENERAL_FAILURE
[WARNING] Error running VBoxManage guestcontrol "IE8 - Win7" copyto "Tools/selenium_conf/selenium.bat" "C:/ProgramData/Microsoft/Windows/Start Menu/Programs/Startup/selenium.bat" --username 'IEUser' --password 'Passw0rd!'

Thanks for your time.

Have you tried to run a VBox guestcontrol command manually, did they work correctly? If not you have to fix your VirtualBox-Installation.

Also the "Source file "Tools/*" does not exist or is not a file" seems to imply that you don't had set up the Tools directory/config correctly. Are you sure everything is in place like the readme stated?

If guestcontrol works fine manually and you're sure Tools-Dir and Config are fine please enable the debugging uncomment the following lines in mkvm.sh:

#set -x
#set -e

set -x will print commands and their arguments as they are executed
set -e will exit the script when an error occurs

I have these issues too, does anyone know what the issue is? New version of VirtualBox maybe?

  • counter=0
  • '[' 0 -lt 10 ']'
  • echo 'Running VBoxManage modifyvm "IE9 - Win7" --nic1 bridged --bridgeadapter1 "en0"'
    Running VBoxManage modifyvm "IE9 - Win7" --nic1 bridged --bridgeadapter1 "en0"
  • bash -c 'VBoxManage modifyvm "IE9 - Win7" --nic1 bridged --bridgeadapter1 "en0"'
  • '[' 0 = 0 ']'
  • guestcontrol_error=0
  • break
  • '[' 0 = 0 ']'
  • return 0
  • chk error 0 'Could not set Bridge'
  • '[' 0 '!=' 0 ']'
  • log '[OK]'
  • tee -a IE9-Win7.log
  • echo '[OK]'
    [OK]
  • set_rdp_config
  • log 'Setting VRDE-Port ...'
  • echo Setting VRDE-Port ...
  • tee -a IE9-Win7.log
    Setting VRDE-Port ...
    ++ find VMs/ -name '*.vbox' -print0
    ++ xargs -0 grep TCP/Ports
    ++ awk '-F"' '{print $4}'
    ++ sort
  • vrdeports=
  • (( i=9000 ))
  • (( i<=10000 ))
  • echo
  • grep -q 9000

Is your adapter name for the bridge really "en0" or "eth0" maybe?

en0: flags=8863<UP,BROADCAST,SMART,RUNNING,SIMPLEX,MULTICAST> mtu 1500
inet 192.168.23.78

WiFi Seems to be en0

Also I have en3 for Thunderbolt -> CAT5
If I manually switch to en0 and then run:
VBoxManage modifyvm "IE9 - Win7" --nic1 bridged --bridgeadapter1 "en0"
It switches to en3?
Some kind of preferencing?
Still, I dont get why it quits, its not really an error using either.

Looks like thats not the problem anyway. It goes OK and moves onto the next method: set_rdp_config()

  • chk error 0 'Could not set Bridge'
  • '[' 0 '!=' 0 ']'
  • log '[OK]'
  • echo '[OK]'
  • tee -a IE9-Win7.log
    [OK]
  • set_rdp_config
  • log 'Setting VRDE-Port ...'
  • echo Setting VRDE-Port ...
  • tee -a IE9-Win7.log
    Setting VRDE-Port ...
    ++ find VMs/ -name '*.vbox' -print0
    ++ xargs -0 grep TCP/Ports
    ++ awk '-F"' '{print $4}'
    ++ sort
  • vrdeports=
  • (( i=9000 ))
  • (( i<=10000 ))
  • echo
  • grep -q 9000

Sorry, my fault. Have you checked that the value for vm_path="VMs/" in config.sh is correct? It's the path were your VMs are created. It seems that the script isn't able to find a free port for VRDE (the port you use to connect to the machine via RDP). echo shouldn't be empty.

If your Path is correct you can skip the set_rdp_config-part (delete/comment line 585) and set the port manually after the Machines are created (or use the random port VirtualBox will set automatically), just to see if everything else works fine. If you don't want to connect to the machines via RDP it doesn't matter at all.

I commented out the RDP line and now I get this.

[OK]

  • create_temp_path
  • vm_temp='C:\Temp'
  • log 'Creating C:\Temp...'
  • echo Creating 'C:\Temp...'
  • tee -a IE9-Win7.log
    Creating C:\Temp...
  • execute 'VBoxManage guestcontrol "IE9 - Win7" createdirectory "C:\Temp" --username '''IEUser''' --password '''Passw0rd!''''
  • counter=0
  • '[' 0 -lt 10 ']'
  • echo 'Running VBoxManage guestcontrol "IE9 - Win7" createdirectory "C:\Temp" --username '''IEUser''' --password '''Passw0rd!''''
    Running VBoxManage guestcontrol "IE9 - Win7" createdirectory "C:\Temp" --username 'IEUser' --password 'Passw0rd!'
  • bash -c 'VBoxManage guestcontrol "IE9 - Win7" createdirectory "C:\Temp" --username '''IEUser''' --password '''Passw0rd!''''
    bash: -c: line 0: unexpected EOF while looking for matching `"'
    bash: -c: line 1: syntax error: unexpected end of file

Can you run guestcontrol commands by hand successfully?

Interesting.
This is what the script does:
VBoxManage guestcontrol "IE9 - Win7" createdirectory "C:\Temp" --username 'IEUser' --password 'Passw0rd!'

and i get: -bash: !': event not found

If I try this it seems to work:
VBoxManage guestcontrol 'IE9 - Win7' createdirectory 'C:\Temp' --username 'IEUser' --password 'Passw0rd!'

??? escaping the double quote? or something weird?

You can try to change execute "VBoxManage guestcontrol \"${vm_name}\" createdirectory \"${vm_temp}\" --username 'IEUser' --password 'Passw0rd!'" to execute "VBoxManage guestcontrol \"${vm_name}\" createdirectory \"${vm_temp}\" --username \"IEUser\" --password \"Passw0rd!\"" and see if it plays nice. If so you have to do this on every VBoxManage-line containing username and password, of course.

If all works fine I'll change the script here.

[OK]

  • create_temp_path
  • vm_temp='C:\Temp'
  • log 'Creating C:\Temp...'
  • echo Creating 'C:\Temp...'
  • tee -a IE9-Win7.log
    Creating C:\Temp...
  • execute 'VBoxManage guestcontrol "IE9 - Win7" createdirectory "C:\Temp" --username "IEUser" --password "Passw0rd!"'
  • counter=0
  • '[' 0 -lt 10 ']'
  • echo 'Running VBoxManage guestcontrol "IE9 - Win7" createdirectory "C:\Temp" --username "IEUser" --password "Passw0rd!"'
    Running VBoxManage guestcontrol "IE9 - Win7" createdirectory "C:\Temp" --username "IEUser" --password "Passw0rd!"
  • bash -c 'VBoxManage guestcontrol "IE9 - Win7" createdirectory "C:\Temp" --username "IEUser" --password "Passw0rd!"'
    bash: -c: line 0: unexpected EOF while looking for matching `"'
    bash: -c: line 1: syntax error: unexpected end of file

The commands work when I run them manually with single quotes just not double quotes.
I tried to do a find replace but i think i just made it worse.

Well. Try the other way. Replace " with ' and vice versa. Or try to escape the ! in Passw0rd! as it is a special char for bash.

hrm super annoying, i tried Passw0rd\! and that didnt work, and then Passw0rd\\! and that didnt work, goddamn escaping. Is there a way to use a different password?

Github is hiding my extra slashes? I can see them when I hit edit on the post!!! WTF?

I'm afraid not. You might can change it using a Windows-Command-Line-Tool using VBox guestcontrol, but you have to provide the initial Password.

What system you are using? Maybe your bash is different to ours.

(I've updated you comment to make the slashes visible.)

OSX Yosemite and iTerm 2

I know that https://github.com/tobyontour/modernie_selenium some changes for MacOS (some of them were already backported here), but I don't know if it was for Yosemite. But maybe toby has some advice that might help you.

I can check the script on Yosemite by myself but not in the next 2 weeks, sorry.

I got the same error.
I tried to change the path separator from backslash to slash.
It works without errors.

-  vm_temp="C:\\Temp\\"
+  vm_temp="C:/Temp/"
gpkvt commented

Please check if you can run the guestcommand hand. What's your virtualbox version?

I got a similiar error a while ago because virtualbox guestcommand now needs a filename in the target for all copy actions, before it just used the source filename if just a path was given. This was fixed in ievms a while ago, so this shouldn't be your problem but maybe it's just another syntax problem.

I'm using 4.3.28-100309Debianwheezy without problems.

My virtualbox version is 4.3.28r100309 on OS X Yosemite 10.10.3, bash 4.3.33.
If I entered the command manually, I got the error above: "-bash: !': event not found"...
I think this problem may be only occurred on yosemite virtualbox.
Thank you for replying my comment.

gpkvt commented

I assume it's the ! in --password 'Passw0rd!', which is a reserved char in bash. Usually this shouldn't be a problem, because it's enclosed in ', but it's worth a try. Just add a \ before the ! and run the command again.

I had a similar issue, a few notes:

  • The method copyto required full, really full, path (I used pwd to format the path on the script). In config.sh I used: tools_path="$(pwd)/Tools/" (@julienbechade @madhavajay).
  • When using single quotes I didn't need to escape the ! on the password, when using double quotes I did need to escape (@gpkvt).

This was tested on Ubuntu 14.04 LTS.