Quantcast
Channel: Thinking too much » VirtualBox
Viewing all articles
Browse latest Browse all 5

Using VNC with headless VirtualBox VMs

$
0
0

The OSE edition of VirtualBox 4.1.8 under FreeBSD includes support for VNC when running in headless mode. This short note documents the fact for my own records.

Today I upgraded to VirtualBox 4.1.8_OSE on my FreeBSD 8.3-PRERELEASE (r232754) home server. I rather like VirtualBox’s built-in VNC server — it enables remote console/screen access to your virtual machines (VMs) using any VNC client.

Starting VNC server mode

VNC server mode is available when you boot your VM in headless mode (i.e. not via the VirtualBox GUI) and supply the “--vnc” option on the command line. For example, I start a VM called “Win7″ in the following manner:

 gja@gjabkup2.space4me.com :VBoxHeadless -startvm Win7 --vnc
 Oracle VM VirtualBox Headless Interface 4.1.8_OSE
 (C) 2008-2012 Oracle Corporation
 All rights reserved.

Then, when I connect to port 5900 using a remote VNC client (in this case, ssvncviewer) I see the following from VBoxHeadless:

 15/03/2012 00:13:49 Listening for VNC connections on TCP port 5900
 Set framebuffer: buffer=803204000 w=800 h=600 bpp=32
 Set framebuffer: buffer=808f88000 w=1118 h=819 bpp=32
 15/03/2012 00:13:57 WARNING: New width (1118) is not a multiple of 4.
 15/03/2012 00:13:58 Got connection from client 10.1.1.6
 15/03/2012 00:13:58 other clients:
 15/03/2012 00:13:58 Client Protocol Version 3.8
 15/03/2012 00:13:58 Protocol version sent 3.8, using 3.8
 15/03/2012 00:13:58 rfbProcessClientSecurityType: executing handler for type 1
 15/03/2012 00:13:58 rfbProcessClientSecurityType: returning securityResult for client rfb version >= 3.8
 15/03/2012 00:13:59 Pixel format for client 10.1.1.6:
 15/03/2012 00:13:59 32 bpp, depth 24, little endian
 15/03/2012 00:13:59 true colour: max r 255 g 255 b 255, shift r 16 g 8 b 0
 15/03/2012 00:13:59 Using compression level 1 for client 10.1.1.6
 15/03/2012 00:13:59 Using image quality level 9 for client 10.1.1.6
 15/03/2012 00:13:59 Enabling X-style cursor updates for client 10.1.1.6
 15/03/2012 00:13:59 Enabling full-color cursor updates for client 10.1.1.6
 15/03/2012 00:13:59 Enabling cursor position updates for client 10.1.1.6
 15/03/2012 00:13:59 Enabling LastRect protocol extension for client 10.1.1.6
 15/03/2012 00:13:59 Enabling NewFBSize protocol extension for client 10.1.1.6
 15/03/2012 00:13:59 Using tight encoding for client 10.1.1.6

The situation as seen by ssvncviewer is:

  [gja@gjadesktop]/home/gja(112)% ssvncviewer 10.1.1.12

  Proto: RFB 003.008

  Connected to RFB server, using protocol version 3.8
  Security-Type: 1 (rfbSecTypeNone)  Latency: 0.26 ms
  No VNC authentication needed
  VNC authentication succeeded (0) for rfbSecTypeNone (RFB 3.8)

  Desktop name "Win7 - VirtualBox"

  VNC server default format:
    32 bits per pixel.  Least significant byte first in each pixel.
    True colour: max red 255 green 255 blue 255, shift red 0 green 8 blue 16
  Using default colormap which is TrueColor.  Pixel format:
    32 bits per pixel.  Least significant byte first in each pixel.
    True colour: max red 255 green 255 blue 255, shift red 16 green 8 blue 0
  geometry: 1118x819+399+178 ycrop: 0
  create_image()
  try_create_image: shm image create fail: image == NULL
  try_create_image: created *non-shm* image: 1118x819
  try_create_image: image->bytes_per_line: 4472

  guessed: -compresslevel 1
  guessed: -qualitylevel  9
  enabling 'delay_sync' mode for faster local drawing,
  disable via env SSVNC_DELAY_SYNC=0 if there are painting errors.

And hey-presto! I have my remote Win7 VM’s desktop available inside my ssvncviewer’s local window.
Passwords and non-standard ports

Specify “--vncpass <password>” on the VBoxHeadless command line and VNC clients will need to provide this password when connecting.

You can start the VNC server on a non-standard port by specifying “--vncport <port>” on the VBoxHeadless command line.



Viewing all articles
Browse latest Browse all 5

Trending Articles