Running Windows XP Pro on Ubuntu with Qemu and KQemu (Qemu accelerator)

Tuesday, February 5, 2008 | Labels: | |

Okay, that's a lengthy title. Sorry about that. I couldn't figure out a better one.

Anyhow, this is a guide/how-to on how to run Windows XP Pro on Ubuntu Gutsy Gibbon using Qemu. I am going to go through this section by section; so that you don't get lost along the way.

Installing Qemu

This part is very straightforward.

sudo apt-get install qemu


Done.
Installing KQemu

This part is not as simple as the previous one. You actually don't need this to get Windows up and running on Ubuntu; but you need this so that it runs smoother. If not, you will be looking at 3 frames per second slide show which is a real pain the ass when you are actually trying to be as productive as you can.

First, let's install a few things first shall we?

sudo apt-get install module-assistant kqemu-common kqemu-source


Please note that you might already have module-assistant.

After that you need to compile and install the kqemu module; like so:

sudo module-assistant prepare
sudo module-assistant auto-install kqemu-source


When that is done, we need to modprobe it (so as to make it available to be used):

sudo modprobe kqemu


Change the permission so that other users can use it.

sudo chmod 666 /dev/kqemu

You can make sure that the permission is correct and that it is already up and running:

ls -l /dev/kqemu


Okay, that completes the installation of Kqemu. I don't plan on emulating Windows so often so I didn't make this as a startup. If you need it to be on startup, you can refer to a guide here.

Installing Windows XP Pro

The installation is going to take FOREVER. I warned you. So do it before you go to sleep. I did it on the day I had to go somewhere else; and it finished when I got back which is just nice.

First, let's create a hard disk image. Yes, you don't need a partition to install Windows.

qemu-img create windows.img 3500M


3500M means 3500MB or 3.5GB. It means you have just created a hard disk for Windows with a size of 3.5GB.

Next, let's boot into Windows! I am using a CD Image here.

qemu -boot d -cdrom /path/to/cd_image -hda /path/to/hdd_image


.. and proceed with the lengthy installation.

You can also do this with a CD. Instead of using the above command, use this one instead.

qemu -boot d -cdrom /dev/cdrom0 -hda /path/to/hdd_image


You can replace /dev/cdrom0 with your own CD drive if you need to. When the installation is done. Just shutdown Qemu by closing the window.
Booting Windows XP Pro

Use this:

qemu -boot c -hda /path/to/hdd_image


... and you shall boot into Windows normally :D

By default, the RAM for the guest OS is only 128MB. You can give it more RAM by specifying a boot flag.

qemu -boot c -hda /path/to/hdd_image -m 256


Sharing folders between Windows and Ubuntu

Before that, you should boot Windows with NIC enabled! (NIC = Network Interface Controller)

qemu -boot c -hda /path/to/hdd_image -net user -net nic


This is the least boot flag you should have. You can add more if you want to.

You need SAMBA! Configuring Samba is a different matter. You can refer here for the easiest method to configure Samba.

Now when you share a folder, make sure to give the folder write permission. From Windows, press Window + R, type in:

\\10.0.2.2\name_of_shared_folder


You should then be able to see the shared folder and dump files there :)
Easy way to choose boot flags/parameters

There's this GUI tool called qemu-launcher. Install it.

sudo apt-get install qemu-launcher


After installed, you can launch it from Applications > Accessories > Qemu Launcher. It's so much easier to boot from here and furthermore, you can enable audio for your Windows! :D

I think that is enough to get you up and running Windows on Ubuntu. Drop me a comment if you run into any issues and I might be able to help.

References:
1. https://help.ubuntu.com/community/WindowsXPUnderQemuHowTo
2. http://ubuntuforums.org/showthread.php?t=39513

3 comments:

  1. Redge says:

    Finally, something that worked! I just love these step-by-steps, especially if they work. It saves me from crawling through FAQ's, lengthy tutorials, man-pages and --help. I'd been trying for days to get some virtualization going.

    One quick point: in my shiny new hardy install, the cd-rom was under /dev/cdrom. In case anyone else runs into this.

    Well thanks mate. Now I'm going to see about working with my new virtual XP box.

  2. jjatria says:

    Worked flawlessly for me too. Thanks a lot!

    I remember trying QEMU a couple of years ago and I have to say, it has certainly come a long way since then. Seems like a lot of people are doing something right lately!

    By the way, I tried qemu-launcher and found it to be very, very lacking in functionality. I ended up crafting my own lengthy command line to execute QEMU and put that on a shortcut on my KMenu. Works everytime!

  3. George says:

    Nice how-to, got me started rather well. Just want to mention the program Qemulator. I have been using this lately and it has much more functionality than qemu-launcher and, in my opinion, is much easier to use. It allows you to do everything mentioned here and more through the GUI. Version 0.5 is even available in (k)Ubuntu's repositories.