Thursday, August 13, 2009

Running WindowsXP on VirtualBox on Ubuntu Karmic

Recently installed the latest alpha of Karmic and thought I'd give it a shot with VirtualBox and Windows XP.

The most important thing to do right now is realise the there are two version of VirtualBox:
  • virtualbox-ose (open source edition) - no USB support
  • virtualbox-puel - the one with USB support
The OSE edition is in the repositaries:
sudo-s
apt-get install virtualbox-ose
  • Then run it: Applications -> Accessories -> VirtualBox OSE
The PUEL version needs downloading and installing using the .deb package maintainer or:
  • add the following repro:
    deb http://download.virtualbox.org/virtualbox/debian jaunty non-free
  • then add the key and install it
wget -q http://download.virtualbox.org/virtualbox/debian/sun_vbox.asc -O- | sudo apt-key add -
sudo apt-get install virtualbox-3
  • You should find it under Applications -> System Tools
THE REST

Create a new virtual machine and follow the wizard. I chose to use the following settings:
  • windows
  • XP
  • 512 MB RAM
  • Dynamic HDD (max 50GB)
BEWARE: the dynamic HDD maximum cannot be increaed after this point. If you use dynamic, the file in /home/username/.VirtualBox/HardDrives will start out small and grow to the maximum file size stated here.

Once this is done, double click on the newly created VM and follow the "First Run Wizard". Pop the XP installation CD in the drive and choose that as the media to use for installation.

The Windows installation proceeds: the only problem that I had was when trying to Eject the disc (the XP disc is an upgrade disc and I needed to put an old NT disc in). At first, the Eject just wouldn't happen - I joked that Windows clearly didn't want to leave the machine. After using the right click -> Eject option from the desktop a couple of times, it relented.

In fact, the whole process was far less stressful than it used to be installing it on a fresh box - the network worked first time and I didn't have to wait for the "34 minutes" while watching a blue screen. Instead, I could fire up firefox and do some surfin'.

When the VM needs keyboard or mouse action, life is very simple:
  • keyboard: simply bring the VM window to focus
  • mouse: click on the VM window or use the "capture key" which, by default is the Right Ctrl key
And, that was it.


Just needed to install all the updates... trivial really, keep re-visiting the Updates page via the control panel, and install SP1, SP2, SP3 and a couple of other pieces of software and restarting the VM about 7 times!

NETWORK FOLDERS

Getting networked folders sorted is pretty simple too.

  • ensure that the VM is fired up
  • install the "guest additions": from the VirtualBox menu: Devices -> Install Guest Additions
  • follow the prompts from within the VM
Now, share the Host's folders:
  • from the live VM window, choose Devices -> Shared Folders
  • within the popup window, use the add button (top right) and choose the folder you want to share
  • I chose to make the sharing permanent too
That's one side done... now for the Windows glue:
  • within Windows, choose "Start -> Run"
  • type "net use x: \\vboxsvr\NameOfYourFolderHere"
Have a look in MyComputer, and you should see a shiny networked drive. And, changes either side of the glue persist in realtime.

USB and iPHONE

Of course, this is only going to work if you've downloaded the PUEL version (see above).

  • add yourself to the vboxusers group
  • add this line to /etc/fstab, replacing XXX for the groupid of vboxusers: NB. most posts talk about /proc/bus/usb, but this didn't exist on my Karmic install, so I changed it to /dev/bus/usb
    none /dev/bus/usb usbfs devgid=XXX,devmode=664 0 0
  • restart your machine: some people say restart some services, some say logout...
Once the machine has restarted, double check that the USB controller is working on the VM: for some reason mine wasn't.
  • goto Control Panel -> System -> Hardware -> Device Manager
  • check that the USB controller is installed correctly and there aren't any other drivers missing
  • if there are problems, double click and choose to search for driver from the web
Now, USB should be working:
  • check the iPhone is recognised by plugging it in and seeing if it is listed under the USB menu at the bottom or within the Devices menu
  • click the checkbox next to them to ensure that Windows connects to them
  • install iTunes
  • done!

7 comments:

Krapez said...

I'm a new user of ubuntu-karmic...
First I had a virtualbox-ose and no USB... I followed your steps to install "the other" virtualbox. Since the command (sudo apt-get install virtualbox-3) didn't work (assuming 3.1 should be typed) I followed the upper link and downloaded and installed vbox from web (http://www.virtualbox.org/wiki/Linux_Downloads)

Installation finished successfully but... how can I run this thing? There's no shortcut...?!? (not in Programs...)
Thanks. Sasha.

Unknown said...

I think that if you run the command virtualbox from the command line, it should work.

Failing that try "virtual" and then hit tab for tab-autocompletion.

Krapez said...

Nice, typing "VirtualBox" works... but...
what does that mean?

The vboxdrv kernel module is not loaded. Either there is no module
available for the current kernel (2.6.31-15-generic) or it failed to
load. Please recompile the kernel module and install it by

sudo /etc/init.d/vboxdrv setup

You will not be able to start VMs until this problem is fixed.

It means we have a problem, a?
S.

Unknown said...

I don't really know that much about VirtualBox. I wrote down the commands I followed on my first attempt at installation that worked for me.

They were really just a reminder for me in the future. Perhaps you might get more help on the VirtualBox forums?

Sorry I can't be of more help

Jeremy

KenN said...

I had to log out and back in before Virtualbox would run (and appear in system tools)

Unknown said...

recompile your kernel
(mine is in /usr/src/linux), then run
sudo /etc/init.d/vboxdrv setup,then type
make clean
to get the space back.
I have openSUSE 11.2 and this worked for me.

Unknown said...

And if, like me, you've never actually recompiled a kernel, here's a quick guide!

http://www.beginlinux.com/desktop_training/ubuntu/1098-compile-your-own-ubuntu-kernel