I had windows 10 running with qemu for a while however I decided to switch to the q35 chipset. My new script works fine for the first boot but after that it will no longer boot. Here is my script:
cp /usr/share/ovmf/x64/OVMF_VARS.fd /tmp/MY_VARS.fd
export QEMU_AUDIO_DRV=pa
export QEMU_PA_SERVER=/run/user/1000/pulse/native
export PULSE_COOKIE=/home/luke/.config/pulse/cookie
export QEMU_AUDIO_TIMER_PERIOD=500
USERID=$(whoami)
precreationg=$(/usr/bin/ip tuntap list | /usr/bin/cut -d: -f1 | /usr/bin/sort)
sudo /usr/bin/ip tuntap add user $USERID mode tap
postcreation=$(/usr/bin/ip tuntap list | /usr/bin/cut -d: -f1 | /usr/bin/sort)
IFACE=$(comm -13 <(echo "$precreationg") <(echo "$postcreation"))
/usr/bin/qemu-system-x86_64 \
-name $vmname,process=$vmname \
-machine type=q35,accel=kvm \
-global ICH9-LPC.disable_s3=1 \
-global ICH9-LPC.disable_s4=1 \
-enable-kvm \
-cpu host,kvm=off,hv_vapic,hv_relaxed,hv_spinlocks=0x1fff \
-smp 6,sockets=1,cores=6 \
-m 12288 \
-mem-path /dev/hugepages \
-mem-prealloc \
-balloon none \
-rtc clock=host,base=localtime \
-device ich9-intel-hda -device hda-output \
-device qxl,bus=pcie.0,addr=1c.4,id=video.2 \
-vga none \
-nographic \
-k en-us \
-spice port=5901,addr=127.0.0.1,disable-ticketing \
-usb \
-device ioh3420,bus=pcie.0,addr=1c.0,multifunction=on,port=1,chassis=1,id=root.1 \
-device vfio-pci,host=04:00.0,bus=root.1,addr=00.0,x-pci-sub-device-id=0x0519,x-pci-sub-vendor-id=0x1043,multifunction=on \
-device vfio-pci,host=04:00.1,bus=root.1,addr=00.1 \
-soundhw hda \
-drive if=pflash,format=raw,readonly,file=/usr/share/ovmf/x64/OVMF_CODE.fd \
-drive if=pflash,format=raw,file=/tmp/MY_VARS.fd \
-boot menu=on \
-boot order=cd \
-device virtio-scsi-pci,id=scsi \
-device scsi-hd,drive=hd \
-drive if=none,id=hd,cache=none,format=raw,file=/home/luke/.qemu/windows/windows10.img,aio=native,cache.direct=on \
-drive if=ide,file=/home/luke/.qemu/windows/Win10_1803_English_x64.iso,index=1,media=cdrom \
-drive if=ide,file=/home/luke/.qemu/windows/virtio-win-0.1.141.iso,index=2,media=cdrom \
-net nic,macaddr=$macaddr -net tap,ifname="$IFACE" $* \
-device pci-bridge,addr=12.0,chassis_nr=2,id=head.2 \
-device virtio-keyboard-pci,bus=head.2,addr=03.0,display=video.2 \
-device virtio-mouse-pci,bus=head.2,addr=04.0,display=video.2 \
-object input-linux,id=mouse1,evdev=/dev/input/by-id/usb-Razer_Razer_DeathAdder_Chroma-event-mouse \
-object input-linux,id=kbd1,evdev=/dev/input/by-id/usb-Razer_Razer_BlackWidow_Chroma-event-kbd,grab_all=on,repeat=on \
-monitor telnet:127.0.0.1:7100,server,nowait
sudo ip link set dev $IFACE down &> /dev/null
sudo ip tuntap del $IFACE mode tap &> /dev/null
i am running Arch Linux (linux 4.18.5) with the ovmf package from the main repos and the qemu-patched package from the aur.
When it boots it doesn’t find the virtio device on all boots after the first. I have to manually load it in order to get into windows. Rebooting the host does not work. However, I can get it fixed if I create a virtual machine in Virtual Machine Manager using the same devices as this script and boot it once. After the vm from virt-manager is booted and shutdown, I can successfully boot from qemu command line once.
Anyone know what is going on? I am at a loss.