Pages
  • Homepage
  • Queztaz/Tech Inventory
  • Emacs/Emacs With BiDirectional Google Calendar Sync
  • Emacs/Setting up Mu4e and Multiple Gmail Accounts
  • Emacs/EWW Hacks
  • Linux/Creating an Offline Debian Mirror Repository
  • Linux/Migrate Wiki.js to Another Server
  • Linux/Adding Bitwarden to the Pinephone Pro
  • Pinebook Pro/Custom Kernel
  • Pinebook Pro/Keyboard Firmware Update
  • Pinebook Pro/Netbsd Installation
  • Pinebook Pro/Setting Up Zram
  • Pinebook Troubleshooting/Pro Common Issues
  • Pinebook Pro/Use NVME as Root
  • Pinebook Pro/Write to SPI Flash
  • Qemu/Chroot Into a Different Architecture
  • Qemu/Choot Into an Img File
  • Qemu/Mount Virtual Images
  • Qemu/Windows Xp Fix Smb Not Working
  • Qemu/Windows Xp Installation
  • Misc/Finding the Default Wireless Password to TG1672G Routers
  • Misc/Running Ollama Portably
  • Windows/Cloning a Bios Boot Drive to Disimilar Hardware with UEFI
  • Windows/Automatic CHKDSK Scans Using Powershell & Email Alerts
  • Windows/Creating a Decent Portable Terminal
  • Windows/Merging HyperV Snapshots With Powershell
  • Windows/Simulating Bad Blocks on NTFS Filesystems
  • Windows/Creating and Viewing a Storport on Windows Server
  • Mikrotik/Creating a Client to Site VPN With
  • Mikrotik/Securing Router With Firewall
  • Mikrotik Setup Dynamically Changing IP With No-IP Api
Homepage
  • Homepage
  • Queztaz/Tech Inventory
  • Emacs/Emacs With BiDirectional Google Calendar Sync
  • Emacs/Setting up Mu4e and Multiple Gmail Accounts
  • Emacs/EWW Hacks
  • Linux/Creating an Offline Debian Mirror Repository
  • Linux/Migrate Wiki.js to Another Server
  • Linux/Adding Bitwarden to the Pinephone Pro
  • Pinebook Pro/Custom Kernel
  • Pinebook Pro/Keyboard Firmware Update
  • Pinebook Pro/Netbsd Installation
  • Pinebook Pro/Setting Up Zram
  • Pinebook Troubleshooting/Pro Common Issues
  • Pinebook Pro/Use NVME as Root
  • Pinebook Pro/Write to SPI Flash
  • Qemu/Chroot Into a Different Architecture
  • Qemu/Choot Into an Img File
  • Qemu/Mount Virtual Images
  • Qemu/Windows Xp Fix Smb Not Working
  • Qemu/Windows Xp Installation
  • Misc/Finding the Default Wireless Password to TG1672G Routers
  • Misc/Running Ollama Portably
  • Windows/Cloning a Bios Boot Drive to Disimilar Hardware with UEFI
  • Windows/Automatic CHKDSK Scans Using Powershell & Email Alerts
  • Windows/Creating a Decent Portable Terminal
  • Windows/Merging HyperV Snapshots With Powershell
  • Windows/Simulating Bad Blocks on NTFS Filesystems
  • Windows/Creating and Viewing a Storport on Windows Server
  • Mikrotik/Creating a Client to Site VPN With
  • Mikrotik/Securing Router With Firewall
  • Mikrotik Setup Dynamically Changing IP With No-IP Api

Qemu/Windows Xp Installation

Table of content
  • Installation
    • Dependencies
  • Installing Windows XP
  • Installing Mouse Drivers
  • Installing Ethernet and Display Drivers
  • Sharing HOST folder through SMB

Installation

Dependencies

  • Windows XP ISO (archive.org)

  • Virtio Floppy Image (fedorapeople.org)

  • qemu & spice-gtk (installed via apt-get)

Installing Windows XP

Product Key: MRX3F-47B9T-2487J-KWKMF-RPWBY

Here's the shell script to start the installation. Windows XP will automatically search through the virtio.vfd floppy image when locating the storage drivers. That floppy image has all the drivers your networking, virtual display, virtio, etc. Mouse input and networking won't work until after you're logged in.

qemu-system-x86_64 \
    -enable-kvm \
    -cpu host -smp 4 \
    -m 3G \
    -boot d \
    -cdrom  "WINDOWSXP.iso" \
    -fda "VIRTIO.vfd" \
    -vga qxl \
    -spice port=55555,addr=0.0.0.0,disable-ticketing \
    -chardev spicevmc,id=vdagent,name=vdagent \
    -device virtio-net,netdev=netdevice -netdev user,id=netdevice,smb=$HOME \
    -drive file=windowsxp.qcow2,if=virtio,cache=none,aio=native

After you run that, use a spice client to connect to the VM. I use spice-gtk.

Installing Mouse Drivers

When you log in, WindowsXP is going to open a wizard that lets you automatically add new hardware. Use your keyboard to go through these prompts. This step is important since it will install the drivers to get your mouse working

After that's done, poweroff the VM and replace your qemu shell script with the following:

qemu-system-x86_64 \
        -enable-kvm \
        -daemonize \
        -cpu host -smp 4 \
        -m 3G \
        -device virtio-net,netdev=netdevice -netdev user,id=netdevice,smb=$HOME \
        -fda "VIRTIO.vfd" \
        -usb \
        -device ich9-usb-ehci1,id=usb \
        -device ich9-usb-uhci1,masterbus=usb.0,firstport=0,multifunction=on \
        -device ich9-usb-uhci2,masterbus=usb.0,firstport=2 \
        -device ich9-usb-uhci3,masterbus=usb.0,firstport=4 \
        -chardev spicevmc,name=usbredir,id=usbredirchardev1 \
        -device usb-redir,chardev=usbredirchardev1,id=usbredirdev1 \
        -chardev spicevmc,name=usbredir,id=usbredirchardev2 \
        -device usb-redir,chardev=usbredirchardev2,id=usbredirdev2 \
        -chardev spicevmc,name=usbredir,id=usbredirchardev3 \
        -device usb-redir,chardev=usbredirchardev3,id=usbredirdev3 \
        -vga qxl \
        -spice port=55555,disable-ticketing \
        -usbdevice tablet \
        -device virtio-serial \
        -chardev spicevmc,id=vdagent,name=vdagent \
        -device virtserialport,chardev=vdagent,name=com.redhat.spice.0 \
        -drive file=windowsxp.qcow2,if=virtio,cache=none,aio=native

You really only need to remove your WindowsXP iso, but I added more qemu arguemnts to enable USB redirection in spice-gtk.

Installing Ethernet and Display Drivers

Open up a command prompt and type "devmgmt.msc" to open the Device Manager. Under "Unknown Devices", right click each item to open the properties, then re-install the driver. Since our VIRTIO.VFD file is still attached, Windows XP will automatically install the drivers for the networking, display, etc.

Sharing HOST folder through SMB

In the shell snippets above, I have smb=$HOME added to expose my home folder as an SMB share on the guest. Qemu will use a newer version of SMB that Windows XP wont support, causing the whole thing to be broken. To fix this, we have to edit Qemu's temporary SMB.CONF file while the Virtual Machine is booting up.

Add the sed command to the bottom of your Qemu shell script. When Windows XP boots up, you should be able to access your files using this UNC path: \\10.0.2.4\qemu

qemu-system-x86_64 \
    -daemonize...

# Fixing SMB
sed -e 's/\[qemu\]/min protocol = NT1\n\[qemu\]/' -i /tmp/qemu-smb.*/smb.conf
PREVRANDOMNEXT