# Command-line tool to connect to a VirtualBox guest console

Is there a tool or library to connect to a VirtualBox guest console (such as XM console) for Xen? A few requirements include:

• Tools different than SSH
• Other than PHPvVrtualBox
• Not a GUI client (I’m connecting from the command-line)
• It should require making as few changes to guest settings as possible
-
What kind of operation do you want to perform on VirtualBox? Is it to do something inside the guest OS (like ssh would do) or to manipulate the guest (pause it, attach a drive, shut it down)? And from which platform (OS) are you trying to connect to the guest? –  Tonin Dec 21 '12 at 20:22
I want to connect as if in front of the physical machine, since the start. like xen start DOMAIN_NAME -c or xen console DOMAIN_NAME. understand if you've used Xen –  rkmax Dec 21 '12 at 21:27
Are you trying to connect from the VirtualBox host or from another independent host? What OS are you running on that host? –  Tonin Dec 21 '12 at 21:38

To my knowledge, there is no equivalent to Xen xm console for VirtualBox, so you need to tweak it.

If you want to access the guest console from any host, you first need to configure VirtualBox to use the serial port and then redirect this serial port in some way. On a UNIX system, VirtualBox makes the serial port available through a socket (not really a pipe).

From the VirtualBox host, you can either transform this socket in a pty, allowing to connect with a tool like screen or you can transform the UNIX socket in a TCP socket, then allowing remote connections with a tool like telnet.

Depending on the OS running on the guest, you need to tell it to actually put the console on the serial port. This is usually possible through the boot loader or even the first screen of the installation manager. Here is such an example with a Solaris installation. So this can work before any network is available on the guest and you can see the full boot sequence like if you were in front of the guest machine.

Here is another example to debug a booting linux kernel.

-

I wasn't completely sure from your question but it sounds like you are wanting to access your *nix console from the host computer without running a GUI.

You actually don't need any tool or library to do this. The easiest way I've found is by setting up a virtual serial port on your *nix guest and then making sure the guest attaches a tty to that serial port. Here is a guide for setting this all up for Ubuntu guests.

On the host side (I'm on a Windows host) you just create a serial port and attach it to a "host pipe". I gave it the name of:

\\.\pipe\UbunutuCOM1


You can then use PuTTY to connect to the same named pipe using a serial connection.

-
this serial port works before or after than guest boot? –  rkmax Dec 21 '12 at 21:07
The guide has instructions for setting up the serial port from grub all the way through the boot up process. –  heavyd Dec 21 '12 at 21:30
Forgive my ignorance but once this process starts the virtual machine also allows me to work as if connected via SSH? –  rkmax Dec 21 '12 at 21:32
Yes, you get a console just like you would if you were SSH-ed into the machine. –  heavyd Dec 21 '12 at 21:34
is tedious is the guest configuration, try to see if I can configure it with puppet –  rkmax Dec 21 '12 at 21:36

I guess you want to connect to a VirtualBox guest running on another machine and running with the VRDE extension enabled. This extension enables connections to the guest console through the VRDP protocol (VirtualBox Remote Display Protocol). So you need a VRDP client.

VRDP is essentially the VirtualBox implementation of Microsoft RDP, the Remote Desktop Protocol. So an RDP client should work to connect to a VirtualBox guest having it's VRDP port enabled.

In the UNIX world, one such client is rdesktop. It is available in the usual Linux distros, for OSX and the other *BSD variants. Another alternative, if you're using KDE, is krdc, the KDE RDP client. Check your package manager.

On Microsoft systems, you should be able to use the Microsoft Terminal Services Connector or mstsc.exe

All those RDP client take one mandatory parameter: the host to connect to (as an IP or as a hostname) and one optional parameter: the port to connect to on the guest host (usually defaulting to 3389).

If it's not what you're looking for, could you make your question clearer please?

-
I'm not looking for a GUI client. i need execute from host console my host dont have GUI –  rkmax Dec 21 '12 at 21:06
Sorry, I didn't understood your question. Technically speaking, I think it's not a VRDP connection you want as the VRDE extension is to connect to the desktop. –  Tonin Dec 21 '12 at 21:29
I want to connect as if in front of the physical machine, since the start. like xen start DOMAIN_NAME -c or xen console DOMAIN_NAME. understand if you've used Xen –  rkmax Dec 21 '12 at 21:30