March 15, 2009

HOWTO: Use USB devices in Virtual Machine Manager with QEMU

Filed under: Blog — krkhan @ 3:09 pm

Every once a while, I need to take the backup of my Nokia N72 using PC Suite. Since the task had to be performed on Windows, I expected my virtualized machine to be able to do so. Unfortunately, Virtual Machine Manager does not provide any option in its interface which would allow me to use my USB devices in virtualized machines. Going through the documentation though, here’s the method through which I was able to solve my issue.

First of all, you should have the vendor and product ID’s of the USB device you want to use. Sounds alien? Use the command:

[user@host ~]$ lsusb

Which will show you something like:

Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 005 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 004 Device 002: ID 0a12:0001 Cambridge Silicon Radio, Ltd Bluetooth Dongle (HCI mode)
Bus 004 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 003 Device 003: ID 0421:04c4 Nokia Mobile Phones
Bus 003 Device 002: ID 09da:000a A4 Tech Co., Ltd Port Mouse
Bus 003 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 002 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub

The bold numbers in the line containing “Nokia Mobile Phones” are the vendor and product IDs respectively. Once you’ve noted them down for your required device (in my case: 0x421 and 0x4c4), list the virtual machines’ configuration files:

[user@host ~]$ sudo ls /etc/libvirt/qemu

networks windoze.xml

My virtual machine was named “windoze”, so windoze.xml is the file that I need to edit:

[user@host ~]$ sudo gedit /etc/libvirt/qemu/windoze.xml

In the editor, add the highlighted hostdev lines under the devices section (replacing the vendor and product IDs with the ones noted down from lsusb output):

<hostdev mode='subsystem' type='usb'>
<vendor id='0x0421' />
<product id='0x04c4' />

Save and close the file. Restart the service:

[user@host ~]$ sudo service libvirtd restart

If everything went smoothly, the USB device should now be accessible from within the virtual machine:

Screenshot of Nokia PC Suite connected to a USB device in virtualized Windows
(Click on the thumbnail for larger version.)

Tags: , , , , , , , , , , , ,

April 29, 2007

Video: Windows 95, 98, 2000 and XP simultaneously running virtualized on Linux

Filed under: Blog — krkhan @ 2:04 am

The idea of visualizing the history of Microsoft on four sides of a desktop cube does sound enthralling no matter how much you despise the company’s products. That’s precisely the reason why I spent a whole night trying to configure four different operating systems to run virtualized on QEMU/KVM with networking and multimedia capabilities. The results look good, especially when you have a compositing window manager to extrapolate their effects.

Download the podcast (MP4)

Video screenshot #1 Video screenshot #2
Video screenshots

Hardware Information

Processor Intel Core 2 Duo 6300 @ 1.86GHz
Motherboard Intel DG965RY
RAM 512 MB

Software Information

Host Operating System Linux From Scratch
Host Kernel Linux 2.6.21
Host Virtualization Setup QEMU 0.9.0/KVM-20
Desktop Environment Beryl 0.2.0/Xfce 4.4.1

Note: Windows 98 and 95 don’t like KVM at all, so I had to run their respective virtual machines with the -no-kvm switch.

Tags: , , , , , , , , ,

February 7, 2007

Linux kernel 2.6.20 released

Filed under: Blog — krkhan @ 1:08 am

The first stable release of the Linux kernel in 2007 was announced on 4th February. (more…)

Tags: , , , , ,