3

I am using VirtualBox to run Ubuntu 12.04 as a guest in a Windows 7 host. I would like execute a command in Windows that will launch Ubuntu's Firefox. I tried VirtualBox's VBoxManage guestcontrol function. The command seems to do something, but nothing seems to happen in Ubuntu:

C:\VirtualBox>VBoxManage.exe guestcontrol MyVirtualMachineUbuntu exec --image "/usr/bin/firefox" --username bob --password password --wait-stdout --verbose
Waiting for guest to start process ...
Waiting for process to exit ...
Exit code=1 (Status=500 [successfully terminated])

The /usr/bin/firefox command works when I run it in Ubuntu. Also, with guestcontrol, I can successfully call /bin/ls. But I can't actually get a major program like Firefox to run. Any ideas? Thanks.

SpaceRook
  • 185
  • 6
  • Try it with `--username` instead of `--user` – Cipher Menial Dec 10 '12 at 01:21
  • @Simplexion: My script was using --username. I mistyped it when writing the AskUbuntu post. I've now fixed my post. Thanks. – SpaceRook Dec 10 '12 at 03:47
  • 2
    Could it be that it's not routed to the correct display?. Can you try: "DISPLAY=:0 /usr/bin/firefox"?. – Javier Rivera Dec 10 '12 at 08:21
  • @Javier Rivera: Thanks, your comment lead me to the correct solution. I had to add the **--environment "DISPLAY=:0"** parameter and now it works like a charm. If you want to formally answer this question, I will accept your answer. – SpaceRook Dec 13 '12 at 05:43

1 Answers1

1

Could it be that it's not routed to the correct display?

As you have found you can solve it using the --enviroment flag. The command should be:

VBoxManage.exe guestcontrol MyVirtualMachineUbuntu exec --image "/usr/bin/firefox" --username bob --password password --wait-stdout --verbose  --environment "DISPLAY=:0"
Javier Rivera
  • 34,993
  • 11
  • 88
  • 110