5

VBoxManage guestcontrol [vmname] run/start

I managed to open Calculator on my Windows 10 guest VM from my Ubuntu 23.04 host using the command:

VBoxManage guestcontrol $MY_VM_NAME run --exe "C:\\Windows\\System32\\calc.exe" --username $MY_USERNAME --password $MY_PASSWORD

Problem

However, when doing the same for WordPad, Microsoft Office applications or Adobe Acrobat Reader, it doesn't work:

VBoxManage guestcontrol $MY_VM_NAME run --exe "C:\\Program Files\\Windows NT\\Accessories\\wordpad.exe" --username $MY_USERNAME --password $MY_PASSWORD

Note: run and start give the same results.

Details

On the Ubuntu host, when I execute the last command, the cursor flashes and the prompt is never returned. In the Windows 10 VM, looking at the Task Manager, I note that the application (WordPad in this example) appears in the background processes list. When I try, using the same command, to execute a personal script I've converted into .exe file instead of an application, the outputs I'm used to see in the guest Windows "Terminal" appear in the host Ubuntu Terminal (see Test section below). It is like if the guestcontrol process attempts to redirect the output of the app to the host. However, I don't know why I have no problem when opening Calculator.

enter image description here

Using the --verbose option returns:

$ VBoxManage guestcontrol $MY_VM_NAME start --verbose --exe "C:\\Windows\\System32\\calc.exe" --username $MY_USERNAME --password $MY_PASSWORD
Executing:
  Image : C:\Windows\System32\calc.exe
  arg[0]: C:\Windows\System32\calc.exe
Creating guest session as user 'toto'...
Waiting for guest session to start...
Successfully started guest session (ID 8)
Starting guest process ...
[1284 - Session 8]
Wait result is 'started' (1)
Process successfully started!
Guest session detached

$ VBoxManage guestcontrol $MY_VM_NAME start --verbose --exe "C:\\Program Files\\Windows NT\\Accessories\\wordpad.exe" --username $MY_USERNAME --password $MY_PASSWORD
Executing:
  Image : C:\Program Files\Windows NT\Accessories\wordpad.exe
  arg[0]: C:\Program Files\Windows NT\Accessories\wordpad.exe
Creating guest session as user 'toto'...
Waiting for guest session to start...
Successfully started guest session (ID 9)
Starting guest process ...
[8812 - Session 9]
Wait result is 'started' (1)
Process successfully started!
Guest session detached

Ubuntu, Windows and VirtualBox tested versions

I got same results for both VirtualBox v6.1 and v7.0. I've also tried with VMs created from Win10_21H2_English_x64.iso and Win10_22H2_English_x64v1.iso. However, no matter the version of VirtualBox, if I'm using Ubuntu 22.04, then it works perfectly.

EDIT 1: Exact same behavior on Ubuntu 23.10 than on Ubuntu 23.04.

EDIT 2: The problem is still going on with VirtualBox v7.0.12.

Test

I've create a HelloWorld script that I converted to an executable file on the guest. From the host, when I do

toto@toto-pc:~$ VBoxManage guestcontrol $MY_VM_NAME run --exe "C:\\Users\\Toto\\Desktop\\runapp\\runHello.exe" --username $MY_USERNAME --password $MY_PASSWORD
Hello, World!
toto@toto-pc:~$

note that "Hello, World!" shows up in the Terminal of my host instead of the guest.

4
  • 1
    Just a thought as I don't have the means to try it at the moment ... You seem to double escape the backslashes (once with the quotes and another with an extra backslash) ... This is common practice needed when the line will be parsed by two shells (local and remote) See for example: Using scp to copy a remote file containing spaces requires double space escaping. Why? ... Therefore try double escaping the spaces in the path of second command as well i.e. "C:\\Program\ Files\\Windows\ NT\\Accessories\\wordpad.exe".
    – Raffa
    Commented Sep 16, 2023 at 10:39
  • I've tried. It returns an error. Please note that the command of my post seems to respond since WordPad starts in the VM. However, it starts as a background process.
    – TVG
    Commented Sep 18, 2023 at 8:02
  • 1
    I have tried it and both commands worked (both apps opened in the foreground) ... But, run seems to wait for wordpad until it's closed while start instead worked as expected ... So try that like: VBoxManage guestcontrol $MY_VM_NAME start --exe "C:\\... ... If that didn't work then most likely it's a Windows issue.
    – Raffa
    Commented Sep 20, 2023 at 11:55
  • 1
    I quickly looked into some documents and manual pages for the difference between the two and couldn’t find clear explanation yet … I will however keep looking or even trace both when I have time … Meanwhile start is most likely certainly the one to use for your purpose.
    – Raffa
    Commented Sep 20, 2023 at 12:17

2 Answers 2

5
+50

Preface

This answer is merely informative and is not intended to be a complete solution to the question ... Although, it could be.

Ubuntu side of things

There are two similar commands of interest for the guestcontrol utility, run and start which are slightly different ... From the documentation for VBoxManage guestcontrol:

Run a Command on the guest

VBoxManage guestcontrol 
run [--arg0=argument 0] [--domain=domainname] [--dos2unix]
[--exe=filename] [--ignore-orphaned-processes] [ --no-wait-stderr |
--wait-stderr ] [ --no-wait-stdout | --wait-stdout ] [ --passwordfile=password-file | --password=password ] [--profile] [--putenv=var-name=[value]] [--quiet] [--timeout=msec] [--unix2dos]
[--unquoted-args] [--username=username] [--verbose] 

The VBoxManage guestcontrol vmname run command enables you to execute a program on the guest VM. Standard input, standard output, and standard error are redirected from the VM to the host system until the program completes.

... and:

Start a Command on the guest

VBoxManage guestcontrol  start [--arg0=argument 0] [--domain=domainname]
[--exe=filename] [--ignore-orphaned-processes] [
--passwordfile=password-file | --password=password ] [--profile] [--putenv=var-name=[value]] [--quiet] [--timeout=msec]
[--unquoted-args] [--username=username] [--verbose] 

The VBoxManage guestcontrol vmname start command enables you to execute a guest program until it completes.

... So, as you can see, the one you should use is the latter(i.e. start) as the former will keep the standard I/O streams of the guest process open and redirect them to the terminal on the host (or more precisely connect them) thus resulting in some applications that can accept/expect input before they start like a file argument to open in the case of "WordPad" to keep waiting and not fully load and hold the prompt in the terminal on the host ... while simple applications like "Calculator" which appear to not be aware of those I/O streams disconnects them immediately and starts (i.e. as far as the process on the host knows, the command on the guest has terminated and the I/O streams are disconnected and therefore, the prompt in the terminal is freed and restored).

Windows side of things

There are limitations ... The Windows OS imposes certain limitations for graphical applications. See Chapter 14, Known Limitations ... Which are:

Guest control. On Windows guests, a process started using the guest control execute support will not be able to display a graphical user interface unless the user account under which it is running is currently logged in and has a desktop session.

... and:

Also, to use accounts without or with an empty password, the guest's group policy must be changed. To do so, open the group policy editor on the command line by typing gpedit.msc, open the key Computer Configuration\Windows Settings\Security Settings\Local Policies\Security Options and change the value of Accounts: Limit local account use of blank passwords to console logon only to Disabled.

... and other experimental features that might cause issues affecting GUI applications:

Some Oracle VM VirtualBox features are labeled as experimental. Such features are provided on an "as-is" basis and are not formally supported. However, feedback and suggestions about such features are welcome. A comprehensive list of experimental features is as follows:

  • Hardware 3D acceleration support for Windows, Linux, and Oracle Solaris guests

  • Hardware 2D video playback acceleration support for Windows guests

  • ICH9 chipset emulation

  • EFI firmware

  • Using Oracle VM VirtualBox and Hyper-V on the same host

My advice

Use the available option --verbose to see what is actually happening (reporting from the guest side might be limited by what Windows chooses to report or not report) like for example so:

VBoxManage guestcontrol $MY_VM_NAME start --verbose \
--exe "C:\\Program Files\\Windows NT\\Accessories\\wordpad.exe" \
--username $MY_USERNAME --password $MY_PASSWORD
21
  • The prompt in the terminal is freed when using start. However, both run and start options open the app as a background process in the guest. Note that generally I'm using a file argument such as -- WINWORD/arg0 "Z:\\Path\\To\\My\\File.docx".
    – TVG
    Commented Sep 20, 2023 at 14:19
  • @TVG Your --verbose output shows that on the Ubuntu side there appears to be no problem ... So, I'd focus on the Windows side of things.
    – Raffa
    Commented Sep 20, 2023 at 14:37
  • Many thanks for your help. Note that it works fine on Ubuntu 22.04.
    – TVG
    Commented Sep 20, 2023 at 21:19
  • Any finding on the Windows side? Are you definitely sure this is not a Ubuntu 23.04 problem since it works fine on Ubuntu 22.04?
    – TVG
    Commented Sep 27, 2023 at 8:44
  • @TVG "Are you definitely sure...?" ... From what I know about how things work, I'd say almost definitely sure ... But, Let me trace it (the communication between host and guest) in depth and try to reproduce the problem if I can then I will report back to you with a definite verdict ... Hopefully today if I get some free time or else probably tomorrow :-)
    – Raffa
    Commented Sep 27, 2023 at 10:25
1

Solution

The issue comes from VirtualBox Guest Additions v7. Downgraded to a v6 version solve the problem.

Details

  • Host OS: Ubuntu 23.10
  • Guest OS: Windows 10
  • VirtualBox: v7.0.10
  1. In the Windows 10 VM, uninstall Oracle VM VirtualBox Guest Additions (Control Panel > Uninstall a program).
  2. Power off the VM.
  3. Download the ISO file from an older version of the VirtualBox Guest Additions here. Works with VBoxGuestAdditions_6.1.48.iso.
  4. (Optional) Save the ISO file under ~/.config/VirtualBox/.
  5. In the VirtualBox Manager, choose the ISO file for SATA Port 1: [Optical Drive] VBoxGuestAdditions_6.1.48.iso.
  6. Start the VM.
  7. Under "This PC", double click on CD Drive (D:) VirtualBox Guest Additions, then on VBoxWindowsAdditions.exe and follow the instructions to install VirtualBox Guest Additions v6.1.48.

Note

None of the VirtualBox Guest Additions v7 seems to work. Then, since only the VirtualBox Guest Additions v6 are working, it is maybe better to also use VirtualBox v6 instead of VirtualBox v7.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .