Create qube from Windows XP Mode

I want to use Windows XP instead of Windows 10 because the SSD of my laptop is small. Although I extract a Windows 10 key from the BIOS with Linux, I heard the installation size is at least 32 GB if I fully update w10. Some forum posts say it needs 60 - 80 GB. I don’t have a key for Windows 7.

I tried to create a Windows XP Qube from a Windows XP Mode installer.

Step 1: Download and extract the 32-bit Windows XP image:
  • Download Windows XP mode from an old snap shot of the official download link at the internet archive. For other languages, see these direct links.

  • With 7-zip, extract the .exe file to get a xpm file. Extract xpm again to get VirtualXPVHD. Rename to VirtualXP.vhd.

Step 2: Shrink the virtual size of the XP image from 128 GB to 3GB
  • Install virtualbox onto a computer with Linux. Use virtual box to create a virtual machine that runs the XP image (VM A). Go through the installation. Shutdown the XP VM. [Note: 1. We cannot do this step in a qube because Qubes OS & Xen don’t support nested virtualization. We can’t run VirtualBox within a Qube within Xen. 2. I tried to shrink the image without running the installation. I can’t boot the resulting image. 3. Without shrinking the image first, the .img file in step 4 would be 128 GB.]

  • Download an .iso file for a live CD for Linux (I used Lubuntu’s Live CD). Create another VM that has an optical drive and insert the .iso file into the VM (VM B). Add the image (VirtualXP.vhd) of VM A as a hard drive to the existing IDE controller of VM B.

  • Start VM B. In the Linux live system, install gparted. Use gparted to shrink the partition of Windows XP in the /dev/sda from 128GB to 3 GB. The VirtualXP.vhd now represents a 128 GB virtual hard drive with a 3 GiB partition at the beginning of the drive. Shutdown VM B.

  • In the host Linux, create a 3000 MB blank image with vboxmanage createmedium disk --filename VirtualXP_shrinked.vmdk --format VMDK --size 3000. Then copy the data with vboxmanage clonehd VirtualXP.vhd VirtualXP_shrinked.vmdk --existing.

Step 3:Install SAS driver
  • According to this reddit post (Has anyone managed to get a Windows XP HVM running in Qubes 4.0), Xen would simulate a LSI SAS 3000 8-port with 1068 controller to interface with the virtual hard drive. However, Windows XP lacks the driver for the controller. Therefore, it is necessary to add the driver to Windows XP.

  • Download the driver from HP to the Linux host by aria2c

  • In Virtualbox → Settings of VM B → Storage, add a LsiLogic SAS controller.

  • Install guest addition to VM B. Use a shared folder to transfer the driver into the VM. Run the installer of the driver, which extracts files to C:\swsetup\SP42842. When Windows XP finds the controller, ask XP to look for the driver in C:\swsetup\SP42842. Uninstall the guest addition. Shutdown VM B.

  • Transfer the image from the IDE controller to the SAS controller. Specifically, go to storage settings of VM B. Remove the IDE controller. Add the VirtualXP_shrinked.vmdk image to the SAS controller.

  • Reboot VM B. Check if Windows XP can boot.

Step 4: Create a qube from the image
  • Transfer the VirtualXP_shrinked.vmdk image (with a size of about 1.6 GB) in the Linux computer to a fedora disposable Qube on a Qubes OS computer. In the fedora Qube, sudo dnf install qemu-img. Convert the .vmdk image to a 3 GB .raw image by qemu-img convert -O raw VirtualXP_shrinked.vmdk VirtualXP_shrinked.img. [I think .raw is same as .img]

  • Create a HVM, following the official guide (StandaloneVMs and HVMs | Qubes OS).

  • Specifically, transfer the image from the disposable qube to dom0 by qvm-run --pass-io untrusted 'cat "/home/user/VirtualXP_shrinked.raw"' > /home/<dom0_user>/VirtualXP_shrinked.img

  • Then, create the VM by qvm-create --property=virt_mode=hvm --property=memory=4096 --property=kernel='' --label red --standalone --root-move-from /home/<dom0_user>/VirtualXP_shrinked.img WinXP_32

Step 5: Start the WinXP_32 VM. After the text curosr blinks for a few seconds, the VM shuts down on its own.

What went wrong?

I installed qemu-kvm. qemu-system-i386 -m 4096 WinXPModeShrinked.img stops at message:

Booting from Hard Disk ...
A disk read error occurred
Press Ctrl+Alt+Del to restart
_ (blinking cursor)