[MacPorts] #68146: qemu @8.0.4: Hangs when used by lima
MacPorts
noreply at macports.org
Thu Nov 2 18:38:16 UTC 2023
#68146: qemu @8.0.4: Hangs when used by lima
-----------------------------+--------------------
Reporter: MidnightRocket | Owner: (none)
Type: defect | Status: new
Priority: Normal | Milestone:
Component: ports | Version:
Resolution: | Keywords:
Port: qemu, lima |
-----------------------------+--------------------
Comment (by mephaust):
I think I have a handle on the problem and how to work around it - still
digging into the proper fix.
Qemu VMs (and thus, lima) depend on EDK2 UEFI images, and these VMs don't
boot very far at all if the UEFI image file is stored with APFS
"transparent" compression. Uncompressing the file seems to work around the
problem - I'm still looking into the proper fix.
To address this, I think we either need to figure out why Qemu's RAW mode
mishandles APFS-compressed files (not so transparent after all, eh?) or
why the image file's being transparently compressed in the first place. Or
both!
== Repro
{{{
qemu-system-x86_64 -accel hvf -cpu host,-pdpe1gb -m 4096 -drive
if=pflash,format=raw,readonly=on,unit=0,file=/opt/local/share/qemu/edk2-x86_64-code.fd
-drive
if=pflash,format=raw,readonly=on,unit=1,file=/opt/local/share/qemu/edk2-i386-vars.fd
}}}
== Workaround
{{{
# install a CLI tool to inspect and modify APFS compression
> sudo port install afscompress
# check to see if UEFI image is compressed
> /opt/local/bin/afscompress -vl /opt/local/share/qemu/edk2-x86_64-code.fd
/opt/local/share/qemu/edk2-x86_64-code.fd:
File is HFS+/APFS compressed.
Compression type: ZLIB in resource fork (4)
File content type: dyn.ah62d4rv4ge80q3a
File size (uncompressed; reported size by Mac OS 10.6+ Finder): 3653632
bytes / 3.7 MB (megabytes, base-10)
File size (compressed): 1789952 bytes / 1.7 MiB
Compression savings: 51.0%
Number of extended attributes: 0
Total size of extended attribute data: 0 bytes
Uncompressed file size reported in compressed header: 3653632 bytes
# decompress file (if compressed above)
> afscompress -vd /opt/local/share/qemu/edk2-x86_64-code.fd
}}}
For Lima specifically, I think you can also work around this by forcing
VMs to use legacy BIOS mode.
--
Ticket URL: <https://trac.macports.org/ticket/68146#comment:2>
MacPorts <https://www.macports.org/>
Ports system for macOS
More information about the macports-tickets
mailing list