Packer file lock issue (qemu-img convert)

Hi all,

I’m having a weird issue when trying to build an alma9 qcow2 image from the packer-maas repository…

It seems the my the OS installation via KS doesn’t finish before the VM is halted and packer attempts to run the qemu-img convert command… Could you guys help me figure out what is going on here?

I’m using packer-maas/alma9 without modification. The VM halt happens right after boot_command…

Here is my PACKER_LOG output:

type or p==> qemu.alma9: No communicator is configured -- skipping StepWaitGuestAddress
2025/06/08 14:47:29 packer-plugin-qemu_v1.1.2_x5.0_linux_amd64 plugin: 2025/06/08 14:47:29 [INFO] communicator disabled, will not connect
2025/06/08 14:47:29 packer-plugin-qemu_v1.1.2_x5.0_linux_amd64 plugin: 2025/06/08 14:47:29 Unable to load communicator config from state to populate provisionHookData
2025/06/08 14:47:29 packer-plugin-qemu_v1.1.2_x5.0_linux_amd64 plugin: 2025/06/08 14:47:29 Running the provision hook
==> qemu.alma9: Halting the virtual machine...
2025/06/08 14:47:29 packer-plugin-qemu_v1.1.2_x5.0_linux_amd64 plugin: 2025/06/08 14:47:29 VM shut down.
==> qemu.alma9: Converting hard drive...
2025/06/08 14:47:29 packer-plugin-qemu_v1.1.2_x5.0_linux_amd64 plugin: 2025/06/08 14:47:29 Executing qemu-img: []string{"convert", "-O", "qcow2", "output-alma9/packer-alma9", "output-alma9/packer-alma9.convert"}
2025/06/08 14:47:29 packer-plugin-qemu_v1.1.2_x5.0_linux_amd64 plugin: 2025/06/08 14:47:29 stdout:
2025/06/08 14:47:29 packer-plugin-qemu_v1.1.2_x5.0_linux_amd64 plugin: 2025/06/08 14:47:29 stderr: qemu-img: Could not open 'output-alma9/packer-alma9': Failed to get shared "write" lock
2025/06/08 14:47:29 packer-plugin-qemu_v1.1.2_x5.0_linux_amd64 plugin: Is another process using the image [output-alma9/packer-alma9]?
==> qemu.alma9: Error getting file lock for conversion; retrying...aste code here