Unable to convert Image to Mender format using mender-convert

Hi I am using Dra7xx/ Jacinto6plus. I am trying to convert my Image using mender-convert 2.5 version.
Output of my fdisk -l golden-image-1.img is

Disk golden-image-1.img: 29.7 GiB, 31914983424 bytes, 62333952 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x8ba2f9ba

Device Boot Start End Sectors Size Id Type
golden-image-1.img1 * 2048 3908297 3906250 1.9G c W95 FAT32 (LBA)
golden-image-1.img2 3909632 62333951 58424320 27.9G 83 Linux

Below is the error when I am converting my image

sudo MENDER_ARTIFACT_NAME=release-1 ./docker-mender-convert --disk-image input/golden-image-1.img --config configs/mender_convert_config
Running mender-convert --disk-image input/golden-image-1.img --config configs/mender_convert_config
Running mender-convert-extract: --config ./work/override_compression_config --disk-image input/golden-image-1.img --config configs/mender_convert_config
2021-10-08 09:07:20 [INFO] [mender-convert-extract] Using configuration file: configs/mender_convert_config
2021-10-08 09:07:21 [INFO] [mender-convert-extract] Using configuration file: ./work/override_compression_config
2021-10-08 09:07:21 [INFO] [mender-convert-extract] Using configuration file: configs/mender_convert_config
2021-10-08 09:07:21 [INFO] [mender-convert-extract] Validating disk image
2021-10-08 09:07:21 [INFO] [mender-convert-extract] Disk parsed successfully
2021-10-08 09:07:21 [INFO] [mender-convert-extract] NUMBER OF PARTS: 2 TYPE: dos
2021-10-08 09:07:21 [INFO] [mender-convert-extract] PART 1: SIZE: 1.9G TYPE: 0xc
2021-10-08 09:07:21 [INFO] [mender-convert-extract] PART 1: extracting to work/part-1.fs
2021-10-08 09:08:10 [INFO] [mender-convert-extract] PART 2: SIZE: 27.9G TYPE: 0x83
2021-10-08 09:08:10 [INFO] [mender-convert-extract] PART 2: extracting to work/part-2.fs
2021-10-08 09:42:14 [INFO] [mender-convert-extract] Extracting boot gap to work/boot-gap.bin
mender-convert-extract has finished. Cleaning up…
Running mender-convert-modify: --config ./work/override_compression_config --disk-image input/golden-image-1.img --config configs/mender_convert_config
2021-10-08 09:42:17 [INFO] [mender-convert-modify] Using configuration file: configs/mender_convert_config
2021-10-08 09:42:17 [INFO] [mender-convert-modify] Using configuration file: ./work/override_compression_config
2021-10-08 09:42:17 [INFO] [mender-convert-modify] Using configuration file: configs/mender_convert_config
2021-10-08 09:42:22 [INFO] [mender-convert-modify] Installing Mender client and related files
2021-10-08 09:42:23 [INFO] [mender-convert-modify] Installing Mender client version latest
2021-10-08 09:42:36 [INFO] [mender-convert-modify] Successfully downloaded mender-client_3.1.0-1_armhf.deb
2021-10-08 09:42:40 [INFO] [mender-convert-modify] Successfully installed mender-client_3.1.0-1_armhf.deb into /mender-convert/work/rootfs/
2021-10-08 09:42:41 [INFO] [mender-convert-modify] Creating the Mender Configure state folder in the data partition
2021-10-08 09:42:46 [WARN] [mender-convert-modify] Found multiple kernel images:

/mender-convert/work/rootfs/boot/zImage-dra7xx-evm.bin
/mender-convert/work/rootfs/boot/zImage-4.4.84-g742f84423d
/mender-convert/work/rootfs/boot/zImage

2021-10-08 09:42:46 [WARN] [mender-convert-modify] Selecting newest kernel image:

/mender-convert/work/rootfs/boot/zImage-dra7xx-evm.bin

2021-10-08 09:42:46 [WARN] [mender-convert-modify] Set MENDER_GRUB_KERNEL_IMAGETYPE to override selected kernel
2021-10-08 09:42:46 [INFO] [mender-convert-modify] Found Linux kernel image:

/mender-convert/work/rootfs/boot/zImage-dra7xx-evm.bin

2021-10-08 09:42:47 [FATAL] [mender-convert-modify] Detected a kernel which does not have an EFI stub. This kernel is not supported when booting with UEFI. Please consider using a U-Boot port if the board has one (look for a board specific file in configs), or find a kernel which has the CONFIG_EFI_STUB turned on. To ignore this message and proceed anyway, set the MENDER_IGNORE_MISSING_EFI_STUB=1 config option.
mender-convert-modify has finished. Cleaning up…
Log file available at: logs/convert.log.27CN

I have enabled CONFIG_EFI_STUB in my kernel but still I am facing the same issue. If I need to ignore this message where to set MENDER_IGNORE_MISSING_EFI_STUB=1 config option.

Thank you,
Deepthi

Given that it’s finding multiple kernels, is it selecting the one you expect it to?, as you have a versioned kernel and a non-versioned kernel and it’s selecting the non-versioned kernel.

Hi dellgreen,

Thank you for the reply.
Given that it’s finding multiple kernels, is it selecting the one you expect it to?
No
How to select which kernel to use and how to ignore EFI_STUB?

Thank you,
Deepthi

you can try removing unwanted kernels from your golden image before putting it through the mender-conversion process. Depending on your distro they normally have tools/options for cleaning up unused kernels and their supporting files

Hi Dellgreen,

I removed the kernels but still I am getting the same error.
How to disable EFI_STUB

Thank you,
Deepthi

I believe MENDER_IGNORE_MISSING_EFI_STUB=1 should be in placed in your own mender-convert config file

https://tracker.mender.io/browse/MEN-2404

Hi Dellgreen,

I am able to disable MENDER_IGNORE_MISSING_EFI_STUB.Now I am unable to configure MENDER_STORAGE_TOTAL_SIZE_MB . I have done changes in mender_convert_config but I am not getting how much memory need to be allocated to this variable.

Below is the error:
user@user-Latitude-5490:~/Mender/mender-convert$ sudo MENDER_ARTIFACT_NAME=release-1 ./docker-mender-convert --disk-image input/golden-image-1.img
Running mender-convert --disk-image input/golden-image-1.img
Running mender-convert-extract: --config ./work/override_compression_config --disk-image input/golden-image-1.img
2021-10-11 16:09:24 [INFO] [mender-convert-extract] Using configuration file: configs/mender_convert_config
2021-10-11 16:09:24 [INFO] [mender-convert-extract] Using configuration file: ./work/override_compression_config
2021-10-11 16:09:25 [INFO] [mender-convert-extract] Validating disk image
2021-10-11 16:09:25 [INFO] [mender-convert-extract] Disk parsed successfully
2021-10-11 16:09:25 [INFO] [mender-convert-extract] NUMBER OF PARTS: 2 TYPE: dos
2021-10-11 16:09:25 [INFO] [mender-convert-extract] PART 1: SIZE: 1.9G TYPE: 0xc
2021-10-11 16:09:25 [INFO] [mender-convert-extract] PART 1: extracting to work/part-1.fs
2021-10-11 16:11:50 [INFO] [mender-convert-extract] PART 2: SIZE: 27.9G TYPE: 0x83
2021-10-11 16:11:50 [INFO] [mender-convert-extract] PART 2: extracting to work/part-2.fs
2021-10-11 17:15:17 [INFO] [mender-convert-extract] Extracting boot gap to work/boot-gap.bin
2021-10-11 17:15:19 [INFO] [mender-convert-modify] Using configuration file: configs/mender_convert_config
mender-convert-extract has finished. Cleaning up…
Running mender-convert-modify: --config ./work/override_compression_config --disk-image input/golden-image-1.img
2021-10-11 17:15:19 [INFO] [mender-convert-modify] Using configuration file: ./work/override_compression_config
2021-10-11 17:15:28 [INFO] [mender-convert-modify] Installing Mender client and related files
2021-10-11 17:15:30 [INFO] [mender-convert-modify] Installing Mender client version latest
2021-10-11 17:15:45 [INFO] [mender-convert-modify] Successfully downloaded mender-client_3.1.0-1_armhf.deb
2021-10-11 17:15:49 [INFO] [mender-convert-modify] Successfully installed mender-client_3.1.0-1_armhf.deb into /mender-convert/work/rootfs/
2021-10-11 17:15:50 [INFO] [mender-convert-modify] Creating the Mender Configure state folder in the data partition
2021-10-11 17:15:51 [INFO] [mender-convert-modify] Using root device A in mender.conf: /dev/mmcblk0p2
2021-10-11 17:15:51 [INFO] [mender-convert-modify] Using root device B in mender.conf: /dev/mmcblk0p3
2021-10-11 17:15:53 [WARN] [mender-convert-modify] No mender.conf file found in resources. Have you remembered to run the bootstrap script?
2021-10-11 17:15:53 [INFO] [mender-convert-modify] Creating state scripts version file.
2021-10-11 17:15:53 [INFO] [mender-convert-modify] Installing a custom /etc/fstab (see /mender-convert/logs/convert.log.53OR for more info)
2021-10-11 17:15:54 [INFO] [mender-convert-modify] Using boot partition device in fstab: /dev/mmcblk0p1
2021-10-11 17:15:54 [INFO] [mender-convert-modify] Using data partition device in fstab: /dev/mmcblk0p4
2021-10-11 17:15:54 [INFO] [mender-convert-modify] Performing platform specific modifications (if any)
2021-10-11 17:15:54 [INFO] [mender-convert-modify] Running hook: platform_modify
2021-10-11 17:15:54 [INFO] [mender-convert-modify] Performing user/local specific modifications (if any)
2021-10-11 17:15:54 [INFO] [mender-convert-modify] Running hook: user_local_modify
2021-10-11 17:15:54 [INFO] [mender-convert-modify] Performing overlay specific modifications (if any)
2021-10-11 17:15:54 [INFO] [mender-convert-modify] Running hook: overlay_modify
mender-convert-modify has finished. Cleaning up…
Running mender-convert-package: --config ./work/override_compression_config --disk-image input/golden-image-1.img
2021-10-11 17:15:59 [INFO] [mender-convert-package] Using configuration file: configs/mender_convert_config
2021-10-11 17:15:59 [INFO] [mender-convert-package] Using configuration file: ./work/override_compression_config
2021-10-11 17:15:59 [WARN] [mender-convert-package] The allocated boot part size 500 MiB is too small.
2021-10-11 17:15:59 [WARN] [mender-convert-package] The actual boot part size is 1907 MiB
2021-10-11 17:15:59 [WARN] [mender-convert-package] Will adjust MENDER_BOOT_PART_SIZE_MB automatically
2021-10-11 17:15:59 [WARN] [mender-convert-package] Consider adjusting the configuration file to avoid this message
2021-10-11 17:16:37 [WARN] [mender-convert-package] The calculated rootfs partition size 6960 MiB is too small.
2021-10-11 17:16:37 [WARN] [mender-convert-package] The actual rootfs image size is 15498 MiB
2021-10-11 17:16:37 [FATAL] [mender-convert-package] You can try adjusting the MENDER_STORAGE_TOTAL_SIZE_MB variable to increase available space, or modify one of the variables IMAGE_ROOTFS_SIZE, IMAGE_ROOTFS_EXTRA_SPACE or IMAGE_OVERHEAD_FACTOR to reduce the size of the root filesystem.
mender-convert-package has finished. Cleaning up…
Log file available at: logs/convert.log.53OR

Thank you,
Deepthi

as a starting point i would set MENDER_STORAGE_TOTAL_SIZE_MB to

1907 + (15498 * 2) + preferredDataPartitionSize

and then fine tune from there on. There are other ways to do it.

So for example in one of my projects is set the following in my mender config file (your numbers will be different)

MENDER_STORAGE_TOTAL_SIZE_MB="23168"
MENDER_BOOT_PART_SIZE_MB="512"
MENDER_DATA_PART_SIZE_MB="1024"

which gives me approx 10G part A and Part B partitions.

I set a small data partition as i always configure the image to grow and resize the data partition on boot to fill whatever medium it may be running on.

Hi Dellgreen,

Now I have generated mender-convert image, I am able to see the partitions which are created using fdisk -l command but my board is not booting from the sdcard.
How to test whether it is able to boot or not?
Do I need to do any modifications in uboot source code?

Thank you,
Deepthi

I’m sorry, I’m not familiar with your board so don’t know. The manufacturer usually has pdfs with more info on that.

I am having the same issue as the OP, good ol’ EFI STUB not found in the kernel.

I have a customized version of mender_convert_config that has been dubbed mender_convert_rushowr (I literally copied the original to the new file and then edited the new file), and within this file I placed at the top before the compression settings:

MENDER_IGNORE_MISSING_EFI_STUB=1

When that didn’t make a difference in the conversion result, I doublechecked this thread and discovered that maybe it might need to be placed in, say, raspberrypi4_ubuntu_config.
So the aforementioned variable was defined and assigned the appropriate value in THAT file.
I run the conversion process again…and get the same result.
Oh, and I almost forgot, here’s the conversion command used both times:

MENDER_ARTIFACT_NAME=release-1 ./docker-mender-convert \
--disk-image input/golden-image-1.img --config \
configs/raspberrypi4_ubuntu_config --config \
configs/mender_convert_ronin \
--overlay rootfs_overlay_demo/

I hate to complain, so I’ll hold off (for now) and just plead for assistance. I’m not sure why this issue was solved with a fix that I then tried and the result is a fatal error. (Sorry, the ordered, logical part of my brain is just as frustrated as the creative, emotional side, and that’s not a great thing, since logical brain is the one that tells emotional to chill out when it’s freaking out).

Thoughts, ideas regarding this issue?

Thanks in advance