Interacting programmatically with VirtualBox VMs

I searched for the possibility to have an uptodate Ubuntu VM so that when I need a new VM I just have to clone that VM. For that I did not want to have SSH installed inside the VM (the clone base should be minimalistic).

Sending text to VMs is easy as pie using the VirtualBox’s command line tool named VBoxManage.

Unfortunately you cannot send text but scancodes (which are not keycodes) but there are tools for translating text to scancode (e.g. http://humbledown.org/keyboard-scancodes.xhtml)

An excellent article about interacting with VirtualBox VMs without the need of services running on the VM itself can be foud here: http://www.jedi.be/blog/2010/08/29/sending-keystrokes-to-your-virtual-machines-using-X-vnc-rdp-or-natiuseve/

The way of sending keycodes is a little bit fragil because it’s like typing blind (the script just sends text by text without the knowledge if there is a login prompt or if the login was succesful or not), so perhaps the better solution would be to use of libraries like http://properjavardp.sourceforge.net/ but for my need (keeping the VM uptodate) the script sending the scancodes does it’s work fine.

Advertisements
This entry was posted in Bash/Shell, Virtualization. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s