id = 2840 title = "After converting the Windows 10 system disk from qcow2 to LUKS format with pre-allocated space, the system fails to boot" state = "opened" created_at = "2025-02-25T09:14:57.193Z" closed_at = "n/a" labels = ["Storage"] url = "https://gitlab.com/qemu-project/qemu/-/issues/2840" host-os = "linux" host-arch = "x86" qemu-version = "QEMU 9.2.50" guest-os = "windows10" guest-arch = "x86" description = """When converting a qcow2 file containing an installed Windows 10 system to LUKS format, using the --target-is-zero parameter in the conversion command prevents the LUKS image from shrinking. However, when attempting to boot the virtual machine with the converted LUKS file, VNC login shows a black screen, and the system fails to start. If the conversion is performed without the --target-is-zero parameter, the system boots up normally""" reproduce = """1. create a luks image qemu-img create -f qcow2 --object secret,data=123,id=sec0 -o preallocation=full,encrypt.format=luks,encrypt.key-secret=sec0 encry_ok.qcow2 50G 2. qemu-img convert -t none -T none --object secret,id=sec0,data=123 -f qcow2 ./windows10.qcow2 -n -m 1 --target-image-opts driver=qcow2,encrypt.key-secret=sec0,file.filename=encry_ok.qcow2 --target-is-zero windows10.qcow2 container windows20 system and it can be booted 3. ./qemu-system-x86_64 -accel kvm -cpu SandyBridge -object memory-backend-memfd,id=mem1,size=4G -machine memory-backend=mem1 -smp 4 -object secret,id=sec0,data=123,format=raw -drive if=none,driver=qcow2,file.filename=/sdc1/luzhipeng/encry_ok.qcow2,encrypt.key-secret=sec0,id=drive0,cache=none -device virtio-blk,drive=drive0,bootindex=1 -monitor stdio -vnc :4 4. vnc shows a black screen, and the system fails to start 5. if use convert command: qemu-img convert -t none -T none --object secret,id=sec0,data=123 -f qcow2 ./windows10.qcow2 -n -m 1 --target-image-opts driver=qcow2,encrypt.key-secret=sec0,file.filename=encry_ok.qcow2 6. the windows10 system can start successful""" additional = """"""