Can't create Mender images for Ubuntu Server x64

Hi All,

I’m working with @krystof to get a bootable Ubuntu image with mender_convert. I’ve been able to get an image to boot when using an Ubuntu bionic based mkosi image but not when using focal.

The issue seems to be that the focal image generated by mkosi contains some additional kernel and initramfs images that the bionic image does not.

See this excerpt of the mender_convert log output when running with a Ubuntu focal based mkosi image as input:

2020-06-02 01:25:22 [INFO] [mender-convert-modify] Installing Mender client and related files
2020-06-02 01:25:27 [INFO] [mender-convert-modify] Found Linux kernel image: 

	work/rootfs/boot/vmlinuz
work/rootfs/boot/vmlinuz-5.4.0-26-generic
work/rootfs/boot/vmlinuz.old

basename: extra operand 'work/rootfs/boot/vmlinuz.old'
Try 'basename --help' for more information.
2020-06-02 01:25:27 [INFO] [mender-convert-modify] Found initramfs image: 

	work/rootfs/boot/initrd.img-5.4.0-26-generic
work/rootfs/boot/initrd.img
work/rootfs/boot/initrd.img.old

basename: extra operand 'work/rootfs/boot/initrd.img.old'
Try 'basename --help' for more information.

It seems that when there are multiple kernel / initramfs images on the input image mender_convert fails silently. By that I mean that even when this output is in the mender_convert log it still generates an output image and returns a 0 return code. The converted image does not boot however.

For reference here are the working mkosi and mender_convert configurations.

mkosi config:

[Distribution]
Distribution=ubuntu
Release=bionic

[Output]
Format=gpt_ext4
Bootable=yes

[Partitions]
RootSize=3G


[Packages]
Packages=nano less tmux ssh dnsutils curl ethtool iproute2 isc-dhcp-client netplan.io iputils-ping ca-certificates lshw pciutils

[Validation]
Password=test

mender_convert config:

MENDER_STORAGE_DEVICE_BASE=/dev/sda
MENDER_DEVICE_TYPE="x86_64"
MENDER_COPY_BOOT_GAP="n"
MENDER_STORAGE_TOTAL_SIZE_MB="7168"
MENDER_BOOT_PART_SIZE_MB="256"
MENDER_DATA_PART_SIZE_MB="256"
IMAGE_ROOTFS_SIZE="-1"

By changing Release=bionic in the mkosi config to Release=focal I can reproducibly break the converted image.