Sunday, June 18, 2006

How to run Windows XP under Ubuntu Dapper


Because Dapper was just too Damn reliable... nah, seriously, I need to run Microsoft Visual Studio, and doing so under wine was not going to cut it, and dual booting was going to be a pain, VMWare was not open source so....QEMU to the rescue.


There's a program called qemu (, by Fabrice Bellard.

Basically it makes a virtual PC within your PC with some standard spec's (NE 2000 network card, Cirrus CLGD 5446 PCI VGA card, etc). The advantage of this is that you're running the actual OS ! (some may say that is not an advantage...)

QEMU keeps this "PC's" partition in one single file, so you can copy that file off somewhere safe and have a "snapshot" of your PC for when the viruses and other nasties get in.

Other neat things in the documentation.

-You can also make that image read only, so that it will never change. (it uses /tmp for a temp file)

-Just like VMWare you can move that image to another machine running QEMU and it should just work.

-QEMU uses a Samba option on the command line to let XP see a samba share, so you can get files in and out of your new OS.


install qemu
sudo apt-get install qemu

make a directory to put the xp image / iso files etc.
mkdir winxp
cd winxp/

one off creation of the "partition", I used 4.3 gig so I could burn backups to a DVD.
qemu-img create winxp.img 4300M

put in xp cd and type...
qemu -boot d -hda winxp.img -cdrom /dev/cdrom -m 256 -localtime
read this line as "boot -d hda", d=boot from cdrom (c=boot from hdd)
"-cdrom /dev/cdrom" tells qemu where the CD to boot from is
"-m 256" is how much memory this machine has access to
-localtime" tells the new pc's bios to set itself to GMT/UTC from the real PC clock.

now go thru the XP install!

then to boot just make a shortcut to:
qemu -boot c -hda winxp.img -m 256 -localtime
Notice the "c" not makes us boot from the winxp.img file, not the cdrom, as I've left off the -cdrom option here this PC now has no access to the CD drive.

You're all done, log in and try going to ! (it worked for me YMMV)

Note : If you get an error when logging on to XP (after entering password).

If you get an error Error code 0x800703e6 on Product Activation, then your XP is pre sp1 or sp2, follow these instructions....

download sp2

make an iso of the sp2 exe file.
mkisofs -o sp2.iso WindowsXP-KB835935-SP2-ENU.exe

boot into XP but press F8 immediately to go into safe mode, pointing -cdrom to the iso file of SP2 will mean that the XP machine will have a "cdrom" available when you boot into it.
qemu -boot c -hda winxp.img -cdrom sp2.iso -m 256

Use explorer to get to the cdrom and click the exe file to install SP2. One error will com up about "Invalid Access to Memory Location", no biggy, just hit OK and it will finish.

All done, no more 0x800703e6


Blogger volkan said...

Is ıt fast enough? I`ve tried qemu 3 months ago with my 512MB ram pc but it was too slow to be used. There is something called "kqemu" to accelerate the qemu but ı couldn`t get it worked. So do you need kqemu?

9:12 am  
Blogger Rodrigo Schmidt said...

Congratulations for the blog.

I've just added this to my bookmarks and will try to run WindowsXP on my Dapper Drake in a few minutes.

Keep up the great work.

2:49 pm  
Blogger linuxpixie said...

Great Post ! I did it on SuSE 10 because I got the idea from you.
It took alot of time, but now I have WINXP inside my SUSE.
I only need to know How to access the internet from inside WINXP under qemu, and how to acess the cdrom from inside, so I could install VB studio and Office inside.
if any ideas, please tell
10x, Oz.

5:52 pm  
Blogger John said...

For those whoi find this too slow, but have trouble getting kqemu to compile, there's a great automated script and faq at that downloads, compiles and installs it all for you.


6:24 pm  
Blogger Edgar said...

i did everything u wrote in this blog..but then when win xp ask me for login and password..and i didnt made i cant log in into xp :(
can u help me with that

8:35 am  
Blogger Mac said...

To get access to the cdrom when you are inside XP, run it with the "-cdrom /dev/cdrom" option.

qemu -boot c -hda winxp.img -cdrom /dev/cdrom -m 256 -localtime

11:38 am  
Blogger Mac said...

lorenzone92. No you don't need the CD image you can boot from the actual cd.

qemu -boot d -hda winxp.img -cdrom /dev/cdrom -m 256 -localtime

11:39 am  
Blogger Mac said...

Yiyoshi / Alberto, you talk about password problems, XP installs have always asked me for a password on setup. I can't help you with an XP install that has not asked you to setup a admin password.

11:41 am  
Blogger Mac said...

Pixie, internet access from XP just worked for me (after boot I ran google and there it was!). I know there are a lot of command line options available in QEMU to do with network access, read the documentation and try some of them.

11:43 am  
Blogger Mac said...

QEMU is not super fast by itself, I recomment trying to get the acceleration program KQEMU working, there is also a program called qvm86, which is an open source accelerator, just google qvm86. I have not got either of these working yet, but will post instructions when I do.

11:46 am  
Blogger Don said...

Thanks. It worked for me on Dapper and a Certera notebook which is very generic. Intel mainboard and Pentium M 1.73 mhz cpu and 512 mb RAM.

2:51 pm  
Blogger 魔法設計的藝術 said...

Hi I am interested.I have a question.I already have a ntfs partition with installed win XP.can QEMU direct launch it without making a image?

3:47 pm  
Blogger Flatline said...

Somewhere (I can't really find the article now) I read that quemu-created images can be read through VMWare Player (which is free altough closed-source). So if you find qemu slow, you could try this solution, many says VMWare is really faster than qemu (I didn't try it myself).
Anyway, how much RAM do you have installed? On my 512MB laptop it's a crawl!

4:43 pm  
Blogger Mac said...

This comment has been removed by a blog administrator.

4:27 pm  
Blogger Mac said...


There is a -smb option for qemu that specifies an smb share (you need samba loaded). I've not used it, but just RTFM and you'll find it ! :-) Mac

4:29 pm  
Blogger Pedro said...

Realizo TODOS los pasos que están en el How-To y me tira el mismo error que a varios:

qemu: could not open hard disk image 'winxp.img'

8:35 am  
Blogger Pedro said...

Me respondo a mí mismo, también a los otros con el mismo problema:

El error se da debido a dónde se crea la imagen (en qué disco), la primera vez lo hice fue en un disco tipo vfat y no me funcionó (y me marcaba 0 byte de tamaño)

Luego volví a crear la imagen en mi home (ext3) y lo hizo sin problemas, además de que me marcó el archivo winxp.img del tamaño con el que fue creado...

8:38 am  
Blogger Edgar said...

maybe chris richard could be interested in this many other people too
The "Ubuntu in Windows" article:
Free Emulation with Qemu
Current version 1.1, June 2006.




saludos pedro de donde eres

1:42 pm  
Blogger A Computer Geek said...

While I found this tutorial extremely helpful there are a couple tips I would like to add for everyone else....

Once you install QEMU insert your Windows XP cdrom and make an iso image of the disk. Name it xp.iso and save it in the same directory as your winxp.img file then when you go to start QEMU to install XP use this command:

qemu -boot d -hda winxp.img -cdrom xp.iso -m 256 -localtime

That will start the install from the xp.iso file and will reduce install time by at least half over using the actual cd.

12:29 pm  
Blogger Unknown said...

Nice Blog. I can't run my setup's of my drivers , ViaXXX sound , the Ethernet Rine card, Usb 2.0... so i will try with Vmware.Byee

5:41 am  
Blogger Open Source, Minds, Future said...

Works Great.

Not bad for my first virtualization. I only have three questions? And any help will be greatly appreciated.

1) what command can I type into the Alacarte Menu Editor to run QEMU via a shortcut? (tried: sudo cd winxp/qemu -boot c -hda winxp.img -m 256 -localtime) Didn't work.

2) How can I get a Lexmark Printer (P4350) to print under the host and guest OS?
(Ubuntu 6.06 Host - Windows XP Guest)

3) How can I drag and drop or copy and paste file between the host and guest OS?


3:38 pm  
Blogger ALIENDUDE5300 said...

Ubuntu Running Under Windows
I changed your instructions a little and did the opposite - running Ubuntu Edgy (6.10) under Windows XP. however, I cant get any internet access. Does anyone have an idea how to get it connected to the internet? (I know how to connect Ubuntu to the internet without emulation but it can't detect the access controller.)

12:41 pm  
Blogger Antunovic Mladen said...

I have installed qemu on ubuntu 6.10 ad then I installed windows xp as virtual machine and my really windows xp gone because it was on C: or in linux hda but I also tried to put hda7 like this
qemu -boot d -hda7 winxp.img -cdrom /dev/cdrom -m 256 -localtime and it doesn't work and result is my windows crashed but my linux and windows in qemu still work.

Is there any way to install windows on qemu and to have my real windows because I need both.

I have to make virtual machines because that is my work on faculty

3:23 am  
Blogger Unknown said...

Hi, it's very interesting article, I was using, but i have a problem, the virtual machine don't use bridge, so the virtual machine isn't part of the network.


5:39 am  
Blogger Lankan526 said...

why is the qemu windows small? i dont know if it is always small because it is small right now when installing, but is it actually that small? and how can i make it bigger?

1:31 pm  
Blogger Boris said...

When I failed to start qemu several times with this error:
qemu -boot c -hda hd.img -cdrom /dev/cdrom -m 256 -localtime
qemu: could not open hard disk image '/dev/cdrom'

I found the solution: sudo qemu -boot c -hda hd.img -cdrom /dev/cdrom -m 256 -localtime

9:38 pm  
Blogger NastySam said...

ok quick question how well do games work through this because thats really the only thing i miss about windows

6:32 am  
Blogger James said...

does Visual Studio work well ?

2:45 am  
Anonymous Anonymous said...

Hi I have an intel macbook and I eventually plan to run windows through ubuntu as above however I really don't know what I'm doing! I've got as far as backing up all my files and partitioning my hard drive. I've downloaded ubuntu - now I'm stuck. Obviously I can't open the ubuntu files because osx won't read them. What do I do now?

Many thanks for your help in advance

12:19 pm  
Blogger Unknown said...

It wouldn't let me format the drive as NTFS so had to do FAT32. Other than that, it's installing just fine! I'll post when I have tried VS2005 and Photoshop CS3!

12:44 am  
Blogger Luis Cabellos said...

I have the same problem than jonesey, is it possible to format it in NTFS after the instalation?

7:33 am  
Blogger Unknown said...


There is one thing i dont undertand.

Why is it necessary to install windows when you, with other programs like Wine, can import your already installed programs for example Dreamweaver and photoshtop to Linux.

Isnt it possible to just "run" windows in the background (like in your screemshot) by using the already installed windows.

By "reinstalling" windows, one will have to reinstall all the other programs as well ...

I find that a bit problematic and would like to figure out why it cant be possible to execute windows with the one already installed.

I hope someone can reflect upon this and enlighten me about this situation.



2:28 am  
Blogger Costa Rica Weddings said...

This comment has been removed by the author.

9:55 am  

Post a Comment

<< Home