Tech-FZ / EmuGUI

A QEMU GUI that I made.
https://tech-fz.github.io/EmuGUI-doc/
GNU General Public License v3.0
103 stars 10 forks source link

QCOW2 virtual hard disk incorrectly identified as RAW format by EmuGUI #74

Open end2endzone opened 4 months ago

end2endzone commented 4 months ago

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:

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 commented 4 months ago

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 commented 4 months ago

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:

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.

Tech-FZ commented 4 months ago

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