Mender-convert fails on dd step

Hi! I’ve been trying out Mender for the first time, and I’m having some trouble converting an image I generated with mkosi (Ubuntu 20.04 with some extra stuff installed). The image boots fine when I launch it from a USB stick, but when I try to run mender-convert on it it fails and I have not been able to find out why. Has anyone experienced an issue like this before?

MENDER_ARTIFACT_NAME=release-1 ./docker-mender-convert     --disk-image input/ubuntu_cuda.img     --config configs/generic_x86-64_hdd_config     --overlay rootfs_overlay_demo/
Running mender-convert --disk-image input/ubuntu_cuda.img --config configs/generic_x86-64_hdd_config --overlay rootfs_overlay_demo/
Running mender-convert-extract: --config ./work/override_compression_config --disk-image input/ubuntu_cuda.img --config configs/generic_x86-64_hdd_config --overlay rootfs_overlay_demo/
2022-01-14 07:51:58 [INFO] [mender-convert-extract] Using configuration file: configs/mender_convert_config
2022-01-14 07:51:58 [INFO] [mender-convert-extract] Using configuration file: ./work/override_compression_config
2022-01-14 07:51:58 [INFO] [mender-convert-extract] Using configuration file: configs/generic_x86-64_hdd_config
2022-01-14 07:51:58 [INFO] [mender-convert-extract] Validating disk image
2022-01-14 07:51:58 [INFO] [mender-convert-extract] Disk parsed successfully
2022-01-14 07:51:58 [INFO] [mender-convert-extract] NUMBER OF PARTS: 2 TYPE: gpt
2022-01-14 07:51:58 [INFO] [mender-convert-extract] PART 1: SIZE: 512M TYPE: c12a7328-f81f-11d2-ba4b-00a0c93ec93b
2022-01-14 07:51:58 [INFO] [mender-convert-extract] PART 1: extracting to work/part-1.fs
2022-01-14 07:51:59 [INFO] [mender-convert-extract] PART 2: SIZE: 15G TYPE: 4f68bce3-e8cd-4db1-96e7-fbcaf984b709
2022-01-14 07:51:59 [INFO] [mender-convert-extract] PART 2: extracting to work/part-2.fs
mender-convert-extract has finished. Cleaning up...
Running mender-convert-modify: --config ./work/override_compression_config --disk-image input/ubuntu_cuda.img --config configs/generic_x86-64_hdd_config --overlay rootfs_overlay_demo/
2022-01-14 07:53:12 [INFO] [mender-convert-modify] Using configuration file: configs/mender_convert_config
2022-01-14 07:53:12 [INFO] [mender-convert-modify] Using configuration file: ./work/override_compression_config
2022-01-14 07:53:12 [INFO] [mender-convert-modify] Using configuration file: configs/generic_x86-64_hdd_config
mount: /mender-convert/work/rootfs: mount(2) system call failed: File exists.
mender-convert-modify has finished. Cleaning up...
umount: work/rootfs: not mounted.
2022-01-14 07:53:13 [ERROR] [mender-convert] mender-convert failed
2022-01-14 07:53:12 [DEBUG] [mender-convert-extract] When running: (modules/disk.sh:64): run_and_log_cmd():  

	dd if=input/ubuntu_cuda.img of=work/part-2.fs skip=1050624 bs=512 count=31459295 conv=sparse status=none
2022-01-14 07:53:12 [INFO] [mender-convert-modify] Using configuration file: configs/mender_convert_config
2022-01-14 07:53:12 [INFO] [mender-convert-modify] Using configuration file: ./work/override_compression_config
2022-01-14 07:53:12 [INFO] [mender-convert-modify] Using configuration file: configs/generic_x86-64_hdd_config
2022-01-14 07:53:13 [ERROR] [mender-convert] mender-convert failed
2022-01-14 07:53:13 [ERROR] [mender-convert] mender-convert exit code: 32

My config looks like this, only modified some values from default:

MENDER_ADDON_CONNECT_INSTALL='y'
MENDER_ADDON_CONFIGURE_INSTALL='y'

MENDER_STORAGE_DEVICE_BASE=/dev/sda
MENDER_DEVICE_TYPE="x86_64"

MENDER_BOOT_PART_SIZE_MB=512
MENDER_STORAGE_TOTAL_SIZE_MB=475000
IMAGE_ROOTFS_SIZE="-1" 

# Nothing to copy
MENDER_COPY_BOOT_GAP="n"

function platform_modify() {
    #
    # Make sure /lib64 exists since the Mender binary requires it.
    # Some systems put everything under /lib (ie Yocto) and a simple
    # symlink is enough to find everything Mender needs.
    #
    if [ ! -e work/rootfs/lib64 ]; then
        run_and_log_cmd "ln -s /lib work/rootfs/lib64"
    fi
}

Could it be related to this? It seems my system does not unmount loop devices correctly.