Monday, April 21, 2008

Running Windows on Solaris with VirtualBox

Sun Microsystems acquired InnoTek. InnoTek is the creator of VirtualBox, a family of virtualization products.

I'd been wandering how I would have run an instance of Windows (sigh) on top of Solaris Express Developer Edition but because the processor of my Sun Ultra 20 M2 does not have virtualization extensions (is not HVM capable), I wasn't left with many options.

But when I read about VirtualBox, I decided to give it a try and I must say that I was impressed. Installation was straightforward and Windows was installing (sigh) just after few minutes after downloading the package.

I downloaded the OpenSolaris distribution of VirtualBox and installed it with pkgadd. Once the package was installed, I tried to run VirtualBox but it couldn't find some libraries. A quick ldd showed that:
$ ldd /opt/VirtualBox/VirtualBox | grep found
VBoxKeyboard.so => (file not found)
libqt-mt.so.3 => (file not found)
VBoxRT.so => (file not found)
VBoxREM.so => (file not found)
VBoxVMM.so => (file not found)
VBoxXPCOM.so => (file not found)
Finding missing libraries was easy and the script I wrote to solve the problem is the following no-brainer:
$ cat ./bin/prepare-vb-env
#!/bin/bash
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/opt/VirtualBox:/opt/VirtualBox/qtgcc/lib
export LD_LIBRARY_PATH
PATH=$PATH:/opt/VirtualBox
export PATH
Sourcing this script into your shell will prepare the environment and VirtualBox will run. Creating a new virtual machine was straight forward. After pressing the "New" button, this welcome screen was shown:



This is the typical useless welcome screen in which you've no choice but pressing "Next" or "Cancel".



In this screen, you can set the name of the virtual machine and choose the guest operating system from a pretty rich list which includes:
  • DOS
  • Windows 3.1
  • Windows 95
  • Windows 98
  • Windows ME
  • Windows NT 4
  • Windows 2000
  • Windows XP
  • Windows Server 2003
  • Windows Vista
  • OS/2 WARP 3
  • OS/2 WARP 4
  • OS/2 WARP 4.5
  • Linux 2.2
  • Linux 2.4
  • Linux 2.6
  • FreeBSD
  • OpenBSD
  • NetBSD
  • Netware
  • Solaris
  • L4


In this screen, you can choose the amount of memory you want to assign to the virtual machine. For a Windows XP instance, 512 MB works pretty well. Please consider that VirtualBox is going to reserve this amount of memory for itself and unless you want your Solaris host and your Windows guest starting to swap (even if long time Windows users may be used to it), check that your machine has a proper amount of RAM available for the virtual machine.



The last step is creating a file which will be used by VirtualBox to mimic hard disks for Windows. You can create a maximum of 4 disks, the typical master or slave disks attached to the primary and secondary IDE bus channels.

The first time the virtual machine is run, it will ask for an installation CD or an ISO image of it and the installation will start.

I really liked VirtualBox ease of installation and ease of management and suggest it to everybody wants to run a Windows instance on its Solaris. As far as it's concerned the other supported operating systems, I just tried a Linux 2.6 installation of both Ubuntu and Slackware with no problem. I'm using this image, instead of a lx branded zone, because I'm an old Slackware user and I wanted to run a 2.6 kernel, whose support is (still) experimental. If a 2.4 kernel is no issue for you and you don't need a desktop installation, I would recommend installing a CentOS image on a Solaris lx branded zone. Even if you need a GUI application, you can connect with ssh -X to your linux zone and user your Solaris Xorg instance as a server.

1 comment:

Matt Carson said...

Thanks man - that was really helpful for me. I was having loads of problems trying to get VirtualBox setup for a Solaris Zone - aaaaggghhh!!!!

Thankfully also I found a blog some guy had written about getting virtualbox up and running in a solaris zone. After spending ages on google and getting half answers or shoddy technical notes - I tried what this guy said and it worked a treat !

http://b0zmeister.x10host.com/virtualbox-in-a-solaris-zone-the-tried-tested-reliable-way/