Friday, May 8, 2009

Step-By-Step Instructions on Using Sun's VirtualBox to run Windows XP in Ubuntu

Background: I have 3 computers:
  1. my employer-issued a Dell desktop set up as a dual-boot Windows XP/Ubuntu 9.04 64-bit system that sits in my office,

  2. my personal ThinkPad R52 laptop set up as an Ubuntu 8.10 system with Windows XP running inside VirtualBox that I use at home, and

  3. my personal Lenovo IdeaPad S10 netbook running Windows XP that I use for traveling/presentations.
In this post, I'll share my experiences about setting up and running Windows XP in a virtual environment using Sun Microsystem's VirtualBox in Ubuntu 8.10 on my 4-year old ThinkPad R52, which comes with a Pentium M processor, 512 MB RAM and 80 GB harddrive. I still need Windows XP from time to time because of software without Linux equivalents (e.g., Finale for music composition, Garmin mapping software for my iQue 3600 PDA, Nokia mapping and PC Suite for my Nokia N95, etc.)

I chose Sun VirtualBox for its small footprint, ease of installation, seamless integration between the host and guest, and general user friendliness. Moreover, VirtualBox allows me to run a virtual environment on a laptop with limited resources (512 MB RAM and a non-virtualized Pentium M processor). The trade-off is that when Windows XP is running inside VirtualBox, I cannot do other tasks in Ubuntu. But at least, Windows XP runs at a decent pace, even with 512 MB RAM and a non-virtualized Pentium M processor. By comparison, Microsoft Windows 7's virtual Windows XP mode requires a processor that support virtualization and therefore the "ancient" Pentium M processor on my ThinkPad R52 is out.

There are actually two versions of VirtualBox:
  1. A full-featured closed-end (proprietary) version of VirtualBox distributed under a Personal Use and Evaluation License (PUEL), which allows for free non-commercial (i.e., personal or educational) use. The proprietary version also comes with a GUI front-end that makes installation and configuring a breeze.

  2. an open-source version called the VirtualBox Open Source Edition (VirtualBox OSE) distributed under the GNU General Public License (GPL).
If you need USB or serial port support, seamless integration between host and guest, etc., you are better off install the full-featured close-end/proprietary version, which comes with all the features you need, rather than trying to build those features through command line hacks for the Open Source Edition (OSE). In particular, the proprietary version comes with a built-in USB controller emulator, such that any USB devices attached to the host can be seen and accessed by the guest. For a further discussion, please consult the WikiPedia article on VirtualBox.

Here's how I installed and configure VirtualBox on my ThinkPad:

Step 1: Download and install the proprietary (non-free) package

Head over to Sun Microsystem's VirtualBox Linux download site to download the appropriate non-free package for your Linux distribution (in my case, I selected Ubuntu 8.10 ("Intrepid Ibex") i386 for my 32-bit installation of Ubuntu 8.10 on my ThinkPad. The package architecture has to match the Linux kernel architecture. If you are running a 64-bit kernel, install the appropriate AMD64 package (it does not matter if you have an Intel or an AMD CPU). Mixed installations (e.g. Debian/Lenny ships an AMD64 kernel with 32-bit packages) are not supported.

The VirtualBox Linux download site also has repository information and public key for updating your VirtualBox installation. I took the opportunity to add the relevant line (in my case: deb http://download.virtualbox.org/virtualbox/debian intrepid non-free) and the matching public key to my software sources (System > Administration > Software Sources, Third Party Software, Authentication).


Step 2: Configure VirtualBox

Make Tech Easier has a set of easy-to-follow configuration instructions for the proprietary version of VirtualBox. These instructions worked for me and I got VirtualBox running in no time. These instructions guide you on how to:
  1. add vboxusers to your group,
  2. configure VirtualBox's memory and virtual hard disk,
  3. configure virtual disk image type, and
  4. install Windows XP (you need the installation CD + full license key)

Step 3: Install VirtualBox Guest additions

The VirtualBox Guest additions provides: (a) seamless mouse integration between the host and guest, (b) cut and paste support between host and guest, and (c) automatic resizing (resizing the VirtualBox virtual machine window will automatically resize the guest OS desktop).

The easy way to install the VirtualBox Guest additions is to use the "Devices" menu on the VirtualBox virtual machine window to mount the VirtualBox Guest Additions programs iso file as a virtual CD-ROM image. Alternatively, you can also: (a) go to Settings, CD/DVD-ROM, (b) check Mount CD/DVD Drive, (c) check the radio button for ISO Image File, and (d) select the VBoxGuessAdditions.iso file.

Once mounted, you can double-click the CD-ROM icon/drive under Windows My Computer to run the VirtualBox Guest additions installer. If you are stuck, you can watch this video tutorial for help.


Step 4: Advanced Setup

Sharing Folders Between Host & Guest

One neat thing about VirtualBox is the ability to share folders between the host and guest. This is down through the network files. Here's how you do it (works for VirtualBox 2.2.2, which is what I installed on my ThinkPad):
  1. go to Settings, Shared Folders
  2. Select the first of 3 icons on the right (add shared folders) to add the folders you want to share between host and guest
  3. The Windows XP guest will access these shared folders as network folders (under Windows XP networking).
  4. Click OK

USB Support


For USB support, you have to set up the USB device filters:
  1. go to Settings, USB
  2. check both enable USB Controller and enable USB 2.0 (EHCI) Controller
  3. the row of icons on your right allow you to add, modify or delete universal or specific filters (pointing the mouse over each icon will display its function in the status bar)
  4. Click OK

Serial Port Support

For Serial Port support, you have to set up the Serial Port mode and path:
  1. go to Settings, Serial Ports
  2. Under the Port 1 tab, check enable Serial Port
  3. For Port Number, you can use COM1
  4. For Port Mode, select Host Device from the pull-down submenu
  5. The "Create Pipe" will be grayed out
  6. For port path, type: /dev/ttyS0
  7. Click OK

For Additional/Advanced Documentation:

No comments:

Post a Comment