EmuGUI icon indicating copy to clipboard operation
EmuGUI copied to clipboard

QCOW2 virtual hard disk incorrectly identified as RAW format by EmuGUI

Open end2endzone opened this issue 1 year ago • 3 comments

I'm am using qcow2 image format for my virtual hard disks.

When I start the emulation through EmuGUI, way that the image is passed to qemu varies in different ways:

  • -hda "F:/test/test2_demo_foobar.qcow2"
  • -drive file="F:/test/test2_demo_foobar.qcow2",if=ide,media=disk (with an empty qcow2, if I force an IDE controller)
  • -drive format=raw,file="F:/test/test2_demo_foobar.qcow2" (once ubuntu is installed on the disk)

Note that the 3rd option is bad because it identifies the qcow2 image as raw bytes. This prevents qemu from booting using the image after an installation of ubuntu. If I make an installation over this, I will corrupt the qcow2 image with raw bytes. In other words, I will essentially use my qcow2 file as if I would have named it test2_demo_foobar.img.

I am still struggling to find the minimum reproducible steps to reproduce the issue. But I think it starts to go bad once I installed something on the VHD.

According to QEMU's documentation (here and here), raw and qcow2 are the preferred formats for virtual hard disk.

In the gui, when I edit the selected virtual machine, the virtual hard disk format is correctly identified as qcow2: image

end2endzone avatar Feb 16 '24 14:02 end2endzone

If I create a new VM and use the existing VHD test2_demo_foobar.qcow2, then I get the same issue. My image contains a minimum installation of ubuntu-22.04.2-desktop-amd64.iso.

end2endzone avatar Feb 16 '24 14:02 end2endzone

Reproducible steps:

  1. Create a new VM called issue74.
  2. At the VHD step, Create a new VHD in qcow2 format:
    • Click Browse button
      • Browse to the desired directory.
      • Change Save as type from default Hard disk file (*.img) to QCOW2 disk image (*.qcow2).
      • Enter a name issue74.qcow2.
    • EmuGUI correctly identifies qcow2 format (VHD file format drop down is has qcow2 selected).
    • Set a 16GB size.
  3. Starts the virtual machine issue74 without any cdrom attached.
    • "C:/Program Files/qemu/qemu-system-x86_64w.exe" -m 8000 -smp 1 -k pci-ohci -hda "F:/test/issue74/issue74.qcow2" -net nic,model=e1000 -net user -boot c -device sb16
    • No issue so far
  4. Starts the virtual machine issue74 with a small linux based os image cdrom attached (I personnaly tested with ubuntu-22.04.2-desktop-amd64.iso and openmediavault_7.0-20-amd64.iso)
    • Install the OS normally.
    • Shutdown the system
  5. Starts the virtual machine issue74 without any cdrom attached.
    • "C:/Program Files/qemu/qemu-system-x86_64w.exe" -m 8000 -smp 8 -k pci-ohci -drive format=raw,file="F:/test/issue74/issue74.qcow2" -net nic,model=e1000 -net user -boot c -device sb16
    • EmuGUI identfies the image as RAW instead of QCOW2.


I also tried the following:
  • Starts the virtual machine issue74 with gparted-live-1.2.0-1-amd64.iso cdrom attached.
    • "C:/Program Files/qemu/qemu-system-x86_64w.exe" -m 8000 -smp 8 -k pci-ohci -hda "F:/test/issue74/issue74.qcow2" -net nic,model=e1000 -net user -cdrom "E:/iso_images/gparted-live-1.2.0-1-amd64.iso" -boot c -device sb16
    • Format the VHD as msdos partition table with an ext4 file system.
    • Shutdown the system
  • Starts the virtual machine issue74 without any cdrom attached.
    • EmuGUI still uses -hda "F:/test/issue74/issue74.qcow2" and qcow2 format is recognized by qemu.

In other worlds, just formatting the VHD does not trigger EmuGUI to incorrectly use the disk image as RAW. There is something else that I do not understand.

end2endzone avatar Feb 16 '24 17:02 end2endzone

I covered this in another issue. Just create a RAW format disk instead of a QCOW2 one. This will make the VM survive.

Tech-FZ avatar Feb 17 '24 09:02 Tech-FZ