Wednesday, January 12, 2011

VirtualBox VBoxHeadless, the remote desktop server

Which produces no visible output on the host at all, but instead only delivers VRDP data. This front-end has no dependencies on the X Window system on Linux and Solaris hosts, this is usefull on servers where the only purpose is to run VMs and access it remotely.

Prerequisite:
On Virtualbox 4.0 you must have extension pack installed.

To start a virtual machine with VBoxHeadless, you have two options:

VBoxManage startvm "VM name" --type headless

The extra --type option causes VirtualBox to use VBoxHeadless as the front-end to the internal virtualization engine instead of the Qt front-end.

The alternative is to use VBoxHeadless directly, as follows:

VBoxHeadless --startvm

This way of starting the VM is preferred because you can see more detailed error messages, especially for early failures before the VM execution is started. If you have trouble with VBoxManage startvm, it can help greatly to start VBoxHeadless directly to diagnose the problem cause.

Note that when you use VBoxHeadless to start a VM, since the headless server has no other means of output, the VRDP (VirtualBox Remote Desktop Protocol) server will always be enabled, regardless of whether you had enabled the VRDP server in the VM's settings

Accessing the VM remotely:

On Linux host you can test the Remote display of VM using rdesktop, or rdesktop-vrdp which is installed with VirtualBox

rdesktop -a 16 -N 1.2.3.4:3339

As said for the Microsoft viewer above, replace "1.2.3.4" with the host IP address, and 3389 with a different port if necessary. The -a 16 option requests a color depth of 16 bits per pixel, which we recommend. (For best performance, after installation of the guest operating system, you should set its display color depth to the same value). The -N option enables use of the NumPad keys.

rdesktop-vrdp 127.0.0.2:3339

When connecting to localhost in order to test the connection, the addresses localhost and 127.0.0.1 might not work. Instead, the address 127.0.0.2[:3389] has to be used.

On Windows, you can use the Microsoft Terminal Services Connector (mstsc.exe) that ships with Windows. You can start it by bringing up the "Run" dialog (press the Windows key and "R") and typing "mstsc". You can also find it under "Start" -> "All Programs" -> "Accessories" -> "Remote Desktop Connection". If you use the "Run" dialog, you can type in options directly:

mstsc 1.2.3.4[:3389]

1 comment: