ctarbi.de - qemu-kvm · winxpsp3 · paravirtualization · virtio-win · spice

Tested With

qemu

QEMU emulator version 8.1.3
Copyright (c) 2003-2023 Fabrice Bellard and the QEMU Project developers

spicy

spicy 0.42

Tun/Tap Setup

The steps below help create an exclusive network between the host and the guest, isolated from the internet.

Setup

#!/bin/sh
set -eu
LOCAL_INTERFACE=tap99
LOCAL_IP=192.168.99.1
if ! ip link show "${LOCAL_INTERFACE}"; then
    ip tuntap add "${LOCAL_INTERFACE}" mode tap
    ip addr flush dev "${LOCAL_INTERFACE}"
    ip link set "${LOCAL_INTERFACE}" up
    ip address add "${LOCAL_IP}" dev "${LOCAL_INTERFACE}"
    ip route add 192.168.99.0/24 dev tap99
fi

Cleanup

#!/bin/sh
set -eu
LOCAL_INTERFACE=tap99
LOCAL_IP=192.168.99.1
if ip link show "${LOCAL_INTERFACE}"; then
    ip link set "${LOCAL_INTERFACE}" down
    ip link delete "${LOCAL_INTERFACE}"
fi

Useful

ip link show dev tap99
ip -brief link
ip -brief addr
ip route

Install Guest OS drivers

Install spice-guest-tools-0.141.exe in guest os, link in references.

Run Script

First run with virtio_drivers_installed=no to be able to download from the host and then install spice-guest-tools-0.141.exe.

After successfully installing guest tools, then restart the guest with virtio_drivers_installed=yes.

#!/bin/sh
set -eu

virtio_drivers_installed=no

set --

set -- "$@" -machine 'pc-i440fx-8.1,usb=off,vmport=off,dump-guest-core=off,memory-backend=pc.ram,hpet=off,acpi=on'
set -- "$@" -accel 'kvm'
set -- "$@" -cpu 'host,migratable=on'
set -- "$@" -m 'size=2097152k'
set -- "$@" -object '{"qom-type":"memory-backend-ram","id":"pc.ram","size":2147483648}'
set -- "$@" -overcommit 'mem-lock=off'
set -- "$@" -smp '2,sockets=2,cores=1,threads=1'

if [ x"${virtio_drivers_installed}" = xyes ]; then
    set -- "$@" -netdev '{"type":"tap","ifname":"tap99","id":"tapnet99","script":"no","downscript":"no"}'
    set -- "$@" -device '{"driver":"virtio-net-pci","netdev":"tapnet99","id":"net0","mac":"52:54:00:69:c7:22"}'
    set -- "$@" -spice port=5900,addr=127.0.0.1,disable-ticketing=on
    set -- "$@" -device virtio-serial -chardev spicevmc,id=vdagent,debug=0,name=vdagent
    set -- "$@" -device virtserialport,chardev=vdagent,name=com.redhat.spice.0
    set -- "$@" -audiodev '{"id":"audio1","driver":"spice"}'
    set -- "$@" -device '{"driver":"AC97","id":"sound0","audiodev":"audio1"}'
    set -- "$@" -vga qxl
else
    set -- "$@" -netdev '{"type":"tap","ifname":"tap99","id":"tapnet99","script":"no","downscript":"no"}'
    set -- "$@" -device '{"driver":"rtl8139","netdev":"tapnet99","id":"net0","mac":"52:54:00:69:c7:22"}'
fi

set -- "$@" -name winxpsp3x86
set -- "$@" -monitor stdio
set -- "$@" -boot order=dc

exec qemu-system-x86_64 "$@" /libvirt-storage/winxp_sp3_x86.qcow2

Tips

launch from README.txt

nofake-exec.sh --error -Rrun.sh -orun.sh README.txt -- sh -eu

use a backing file

backing=/libvirt-storage/winxp_sp3_x86.qcow2
out=${backing%.qcow2}--temp.qcow2

if [ ! -f "${out}" ]; then
    chmod a-w "${backing}"
    qemu-img create -f qcow2 -o backing_file="${backing}" -F qcow2 "${out}"
fi

N.B.: update qemu-system-x86_64 call to use the --temp.qcow2 suffix

get back in time (away from 2038)

set -- "$@" -rtc base=2022-01-01,clock=vm

Spicy Viewer

spicy -h 127.0.0.1 -p 5900 --title 'winxpsp3x86'

Screenshots

devmgmt

netconfig

ping-host

ping-guest

References

More details in the link below.

This page was last modified on May 2, 2025 at 21:56:31 UTC.