QEMU UEFI firemware not recognizing QCOW2 virtual disk at all

Laptop Acer Aspire A315 with i5 2.4 GHz, 16 Gb RAM and NVMe drive.
Using QEMU 7.1

Trying to install Win11 VM from scratch.

First create virtual disk:
qemu-img create -f qcow2 -o extended_l2=on,cluster_size=128k virtuals/win11.qcow2 64.8G

Then run VM like this:

qemu-system-x86_64 \
-name "Win11" \
-machine type=pc-q35-7.1,accel=kvm \
-cpu host,hv_passthrough \
-smp 8,sockets=1,cores=4,threads=2 \
-m 8G \
-drive if=pflash,format=raw,readonly=on,file=/usr/share/qemu/ovmf-x86_64-ms-4m-code.bin \
-drive if=pflash,format=raw,file=virtuals/ovmf-x86_64-ms-4m-vars.bin \
-boot menu=on \
-netdev tap,br=br0,helper=/usr/lib/qemu-bridge-helper,vhost=on,id=n1 -device virtio-net-pci,netdev=n1,mac=52:54:00:12:34:56 \
-rtc base=localtime \
-vga qxl -device virtio-serial-pci -spice unix=on,addr=virtuals/vm_spice.socket,disable-ticketing=on -chardev spicevmc,id=spicechannel0,name=vdagent -device virtserialport,chardev=spicechannel0,name=com.redhat.spice.0 \
-display spice-app \
-audiodev spice,id=xyz -device ich9-intel-hda -device hda-output,audiodev=xyz \
-device virtio-balloon-pci \
-device qemu-xhci,id=xhci1 -chardev spicevmc,name=usbredir,id=usbredirchardev1 -device usb-redir,chardev=usbredirchardev1,id=usbredirdev1 \
-monitor stdio \
-drive file=virtuals/win11.qcow2,index=0,media=disk,format=qcow2,discard=unmap,id=disk1,if=none -device virtio-blk-pci,drive=disk1,physical_block_size=4096,logical_block_size=4096,bootindex=1 \
-drive file=virtuals/Win11_23H2_Spanish_x64v2.iso,index=1,media=cdrom,id=iso1,if=none -device ide-cd,drive=iso1,bootindex=2 \
-drive file=virtuals/virtio-win-0.1.240.iso,index=2,media=cdrom
-chardev socket,id=chrtpm,path=virtuals/tpm/swtpm-sock -tpmdev emulator,id=tpm0,chardev=chrtpm -device tpm-tis,tpmdev=tpm0

The Win11 ISO did boot, and even allowed to format and write to the detected virtio disk after loading the corresponding virtio drivers, then proceeded to install.
But when rebooting, the virtio disk is not recognized at all; instead tries to boot from Win11 ISO again, since it’s the only thing it finds bootable.

Tried entering the UEFI setup with Esc key, and after a device discarding process, I saw that CDVD drives are correctly recognized, but the virtio disk is just merely “UEFI Misc Device” instead of “UEFI QEMU disk”.

I tried every firmware available at /usr/share/qemu/ovmf*, and all give the same result.

However, my old win11.qcow2 disk file, which was created back on Leap 15.4 with QEMU 6.2, is indeed recognized and boots! Albeit after updating to Win11 23h2 every single windows cumulative update makes the vm BSOD, which is why I tried reinstalling.

What’s happening? Can someone help please?
Thanks.

To add to the already exposed above, the option “-device virtio-blk-pci” is virtually unusable: does not yield the “not a valid device name” error, but instead “property not found” with any of parameters drive, block size, bootindex, nor anything…

Sorry for yet again posting

I found an issue that I presume it’s virtually the same I’m having:

Emphasis in the date of posting: this same year; which is the same Leap 15.5 was released, even though they talk about another distribution.

Yet, in my case I don’t have that raw file problem and QEMU parameters are indeed correct.

@F_style I use Virt-Manager for Windows all working fine here I upgraded from Windows 10 by dumping the Windows 11 iso file on the desktop and running from there.

It is irrelevant. UEFI does not “boot from disk”. Is there boot manager entry for Windows? What is boot order?

I enter the UEFI setup within the virtual machine, have 3 main options:
–Device Manager
–Boot Manager
–Boot Maintenance Manager

I enter Boot Manager.
Before booting the Win11 ISO and installing files from it, devices were like this:
UEFI Misc Device
UEFI QEMU DVD-ROM QM00011
EFI Internal Shell
UEFI QEMU DVD-ROM QM00005
And all the rest PXE/HTTP net boot options

After installing from ISO and removing all ISO drives, devices are:
EFI Internal Shell
UEFI QEMU DVD-ROM QM00005
And all the rest PXE/HTTP net boot options

Which means I’m right, after installing from the Win11 ISO UEFI firmware is NOT recognizing the QEMU QCOW2 virtual disk at all.

For the UEFI vars I did “cp /usr/share/qemu/ovmf-x86_64-ms-4m-vars.bin virtuals/” beforehand…

I don’t think that’s correct. Maybe it means that there “\EFI\Boot\bootx64.efi” does not exist in the EFI partition of your virtual disk. Or maybe there is no EFI partition there.

If your Windows install went correctly, there should be an entry for booting Windows (or maybe it is Microsoft). So something went wrong in your install.

I have not tried installing Windows here. But I have installed various linux systems that way. However, I’ve been using “virt-manager” rather than a direct “qemu” command.

I need to reinstall from scratch, so malcolm just bad mocked at my issue here.

I checked the Win11 ISO I downloaded from Microsoft website with the due checksum, and everything right.

Windows installation went all correctly up to the “the system will reboot in 10 seconds”.

And at opensuse bugzilla I’m kind of “banned” in the sense that all my reports are lately either ignored or just closed with no response the next day.

Seriously, what a beautiful community it turned here.

@F_style mocking you? Just showing you… I use virt-manager and then can just start with virsh and connect with the virt-client from any machine on the network, flexibility to run on a non-compliant system. Also look at TPM 2.0, I use CRB here…

1 Like

I still have no idea of why mods and admins here are libvirt lovers for everything KVM related; yet I went and did the attempt of Win11 VM clean installation from scratch using libvirt…

I said “clean installation”, not upgrade through ISO

SAME damn results (makes sense, since libvirt is by definition a wrapper API for QEMU/KVM…)

Guess no one here has the time to properly support a complicated problem, and just limit to “easy/direct” issues…

@F_style Hi, I use qemu as well for the likes of android and MacOS, I use libvirt because I use vagrant or ansible to spin up multiple machines at a time for testing. It’s all about different workflows, the only reason I did install Windows 11 was to test rancher-desktop and nested virtualization with wsl2.

Anyway, back to your issue, this is a fairly recent i5 cpu with P and E cores? Can you show the output from lscpu | grep "Model name:"

As an aside, you could try VirtualBox and see if that works differently or VMware?

The exact CPU model is Intel i5-1135G7 (11th gen i5) 2.4 GHz. I know nothing about “P and E cores”…

Sorry, for now not with the time to try the other virtualization programs…
For reasons I do need to get it working with QEMU/KVM, even if at very last resort through libvirt

Yet another thing I just tried:
It turns that I did have a previous qcow2 of the Win11 vm before attempting the Win11 23h2 version update.
So started it, and this time attempted to update by downloading and running the latest Win11 ISO from within the vm (the malcolm way).

Result: the very same BSOD and everything reverted. Which partly explained why cumulative updates are neither working, but still doesn’t explain the OP issue here.

Only difference was, I was able to note the error code:
0xc1900101 - 0x20017
Which by googling it seems to mean “fatal problem with outdated BIOS or chipset or other drivers”.

Even though it was more than one year ago, I clearly remember that, with this same Win11 vm, the windows update upgrade to version 22h2 back then went flawlessly; otherwise I wouldn’t have been using the vm this whole year…
Drivers? The only “strange/foreign” ones would be the virtio drivers themselves…
Firmware? OVMF with secure boot (the ms-4m variant)
TPM? Using swtpm, in QEMU using tpm-tis device (no idea which is better between tis and crb…)
Vm worked pretty well for the entire year until this 23h2 update

And still, probably unrelated, the original problem at OP, that windows is seemingly not creating the ESP partition?

By the way, trying to use the virtio-scsi device doesn’t work at all neither: with any parameter having specified this device driver qemu fails with “property not found”…

@F_style you can set the version to not update (TargetedRelease group policy) so can stay on that version that works, I did that on my on the road laptop (Windows 10). But most of the applications I use work in Linux nowadays, so hardly ever gets used anymore…

Your cpu is just a normal hyperthreading one, so will be fine.

Stopped virtio services and updated virtio drivers via the latest virtio ISO’s msi installer, while still not starting again all virtio services.

Tried again the cumulative update in the vm, yet same result.

Now I officially tried everything. Seriously, no one here can help as with what on earth is happening

@malcolmlewis :
For the cpu model in QEMU, is there a way to get libvirt’s “host-model” equivalent without having to create a libvirt vm necessarily?

Or, for the CPU model I mentioned the laptop host has, which would be the closest model from QEMU’s cpu list? The most “recent” would be Skylake client, and that’s already like 8 years old…

The point is I’m trying to think about using manual models equivalents instead of “-cpu host”…

@F_style For your machine/setup run virsh capabilities it creates an xml list of what is available for your setup and virsh cpu-models x86_64 for cpu’s.

Finally settled the BSOD problem with installed Win11 vm and cumulative updates; instead of host passthrough cpu option I had to use specific CPU model, based on suggested “virsh capabilities” command, thus for this hots’s physical CPU option turning
-cpu Broadwell-noTSX-IBRS,hv-passthrough
With this updates finally finished installing, and even vm’s performance increased (more on this in my other past thread).

However, and going back to original OP, this still didn’t solve the problem of clean win installation from latest win11 ISO seemingly not “properly creating” the ESP partition, thus going just to UEFI shell, and loop so on…

Could someone help with win11 ISO not creating the freaking ESP partition?
This thing is not happening on bare metal!

@F_style Did a test install in a vm, all good selecting custom install and just the vm disk, completed the install (did the shift F10 and enter OOBE\BYPASSNRO to avoid sign in). Rebooted, all good, reboots fine?