Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

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.

share|improve this question
    
Try it with --username instead of --user –  Simplexion Dec 10 '12 at 1: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 3: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 8: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 5:43
add comment

1 Answer 1

up vote 1 down vote accepted

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"
share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.