Emulating Windows XP on Linux in 2023

Multithreaded JavaScript, O'Reilly 2021, has been published!

Just for a bit of nostalgia I thought it would be fun to fire up an emulator with Windows XP. On my laptop I run a much more recent version of the kernel (5.15.55) than what my distro normally provides (Kubuntu 22.04). This makes it hard to install the headers and ultimately means that I haven't figured out how to run my usual Virtual Box. So, for this project, I opted to experiment with qemu.

Windows XP emulated on Linux in 2023
Windows XP emulated on Linux in 2023

First, there are a bunch of packages that I needed to install:

sudo apt install qemu-system qemu qemu-utils virt-manager

Next, I needed a copy of a Windows XP installation disk. Feel free to dig through your drawer of obsolete operating systems. Alternatively the Internet Archive has you covered as well. Download that file and save it as winxp.iso.

Next you'll need to create a virtual disk for the virtual machine to use. The following command will make one with a size of 10GB which is plenty for goofing around with:

qemu-img create -f qcow2 winxp.img 10G

At this point you're ready to run the operating system and perform an installation. For that run this command:

qemu-system-x86_64 \
  -hda winxp.img \
  -cdrom winxp.iso \
  -boot d  \
  -cpu qemu64 \
  -enable-kvm \
  -cpu host \
  -m 2048 \
  -vga cirrus \
  -net nic,model=rtl8139 \
  -net user \
  -usbdevice tablet \
  -vga virtio

Once this happens you'll need to go through the Windows XP installation process. I've done this a million times but if it's your first time you might need to find a separate guide for that. When prompted for a license you'll need to dig through your old drawer of operating system license codes.

Once the installation is complete you'll have a 1024x768 desktop, or something like that. Right click on the desktop and jump through the menus and change the resolution to something more palatable. I haven't gotten into the high DPI world so my 1920x1080 display worked like a charm.

Once that's done it's time to use the internet. Sadly, Internet Explorer can't be used to download a new browser as SSL is completely broken. Instead you'll need a more modern browser. Opera 36 seems to be the best bet but I couldn't find a way to download it without SSL. I even uploaded an EXE to a server without SSL but still couldn't convince IE to download it via HTTP.

Instead, you can make an ISO file and add just the Opera installer and reboot with that attached, then copy the file within the VM and run it that way. On your host OS, visit the Opera Download page, scroll down to the Opera 36 for Windows XP, and download that. Once downloaded, rename the file to operaxp.exe. Finally, run this command to create an iso:

mkisofs -o opera.iso operaxp.exe

Now, shutdown Windows XP via the start menu, then run it again using a slightly augmented command to mount the other ISO:

qemu-system-x86_64 -hda winxp.img -cdrom opera.iso \
  -boot d -cpu qemu64 -enable-kvm \
  -cpu host -m 2048 -vga cirrus \
  -net nic,model=rtl8139  -net user \
  -usbdevice tablet -vga virtio

Run the command, then launch My Computer and open the CDROM. Copy the OPERAXP.EXE file to the desktop, then double click it to install. Once that's done you'll be able to browse the internet.

I immediately downloaded a high resolution version of the Bliss wallpaper, and installed my favorite Windows XP Royale theme.

At this point you don't need either ISO anymore so just augment the command to remove the -cdrom opera.iso flag when launching in the future.

Of course, this is for nostalgia purposes only. Don't actually try to use it for anything important. You'll get an SSL error with every new website you visit in Opera and you can consider the connection insecure. The UI redraws slowly and if you wanted to do retro gaming you would be much better off using Wine.

Thomas Hunter II Avatar

Thomas has contributed to dozens of enterprise Node.js services and has worked for a company dedicated to securing Node.js. He has spoken at several conferences on Node.js and JavaScript, is an O'Reilly published author, and is an organizer of NodeSchool SF.