10

After I launch a virtual machine (Ubuntu 12.04) in headless mode on Windows 7 host

C:\Users\XXX>VBoxManage startvm "ubuntu 12.04" --type headless 
Waiting for VM "ubuntu 12.04" to power on... 
VM "ubuntu 12.04" has been successfully started.

Can I somehow launch the normal GUI that I would get by launching the virtual machine from VirtualBox' GUI ?

I know that I should be able to RDP to this machine but when I use Windows 7 built in RDP client and use localhost:rdp_port (forwarded by NAT in VB options) I get the error

    ---------------------------
    Remote Desktop Connection
    ---------------------------
    Your computer could not connect to another console session on the remote 
    computer because you already have a console session in progress.
    ---------------------------
    OK   Help   
    ---------------------------

What can I do in this situation to connect to this virtual machine with GUI ?

Is it the only solution for me to turn the machine off and then launch it with the GUI ? It sounds really not convenient to do this every time I need GUI - since I want the machine to be headless.

EDIT

I have also tried xrdp but I cannot connect to the machine - I have it behind the VirtualBox NAT and the ports are forwarded.

8

I just solved this problem by clicking the green arrow "Show" at the top of the VirtualBox GUI while my headless instance was already running.

I could see what the VM window would look like inside the "Preview" Pane on the VirtualBox GUI, and after clicking "Show", the VM window came up as though I had initially powered on the machine from the Virtualbox GUI.

Edit: When you close the VM window, it will give you the additional option to "Continue running in the background", so your headless instance can revert to being headless again. VirtualBox GUI with Show button highlighted

3

You can attach to a headless VM by running VBoxSDL --startvm <VMname> --separate. If you run VBoxSDL with no args you can see other options you may be interested in.

  • Thx, usefull and for a connection to another host? – Philippe Gachoud Oct 3 '18 at 18:15
1

After getting the same error, I just changed the default port 3389 to something else.

I used random port number (in my case 5500). Then it worked.

And disabled Windows firewall for a moment - but I don't think firewall was the problem.

1

I solved the problem - I didn't have VirtualBox extension pack installed. While it is added in Linux version of VirtualBox, you have to install it separately on Windows.

  • 1
    But could you open the GUI of a Headless VM? – Fabricio PH May 24 '14 at 3:43
1
  1. You can click on the Show button to get the GUI of a headless VM in the VirtualBox Manager:

  2. When you are done with using the GUI, you can detach it and your VM will go back headless.

I tested this on Windows 10 and it worked as of VirtualBox 5.1.22. Should be the same on Mac/Linux.

0

My experience has been that VirtualBox's RDP is actually provided using VNC, and not the Microsoft RDP protocol. I was able to use the VRDE feature using VNC Viewer (rather than Microsoft Remote Desktop).

In case it helps, here are the commands I used to configure VRDE access to a VM which runs on a headless server (not keyboard, mouse, monitor attached).

Find the UUID of the VM:

vboxmanage list vms

VM=0cb7efa7-82d2-4fe7-9abe-79db4e4ee117

vboxmanage modifyvm $VM \
    --vrde on \
    --vrdeport 3389 \
    --vrdeaddress "" \    # WARN! Access from anywhere on network
    --vrdemulticon on \
    --vrdereusecon on \
    --vrdeauthtype null   # WARN! No authentication (just press enter if prompted for password)

If you launch the VM paused, you can quickly test the VNC connection and VDRE settings (e.g. if you change the port, etc) without the cost of booting the VM, or indeed tearing it down when you want to try another setting:

vboxheadless --startvm $VM --start-paused

Fire up your VNC client and try to connect, and if you successful find yourself viewing a big black rectangle you are good to unpause the VM and begin the boot process:

vboxmanage controlvm $VM resume

(I played with -vrdeauthtype external without success - I was never able to successful authenticate over VNC)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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