Mender-convert for Raspberry Pi 3 - storage/card too small

Whenever I run mender-convert the output is 8.6GB, whether I supply it with a golden image from an 8GB SD card or the standard 2021-10-30-raspios-bullseye-armhf-lite.img

This 8.6GB file then doesn’t fit on my 8GB SD card?

Hmm, interesting.

The linked imabe above should be converted with the latest mender-convert, and is only 7.4GiB.

What parameters are you running the conversion with?

I follow the instructions above (Build Docker image for mender-convert) line-by-line and I end up with a .img file that’s 8.6 GB (8,589,934,592 bytes). Thanks.

There is one difference between the image produced by the tutorial above, and the image provided in the link, and that is that the image provided in the link has a few extra configurations added.

Especially the configurations from configs/images/raspberrypi_raspbian_config.

Most interestingly for you probably is the added:

# Real life SD cards typically have less than they advertise. First off, they
# often use a base of 1000 instead of 1024, and even then they are often smaller
# than advertised. The number below is based on a conservative target of 7.9GB
# (that's mathematical GB, base 1000), converted to MiB, rounding down.
MENDER_STORAGE_TOTAL_SIZE_MB=7534

@edpgcooper

1 Like

i used

$ cat configs/raspberrypi3_config
RASPBERRYPI_CONFIG="raspberrypi3"
RASPBERRYPI_KERNEL_IMAGE="kernel7.img"
MENDER_KERNEL_IMAGETYPE="zImage"
MENDER_DEVICE_TYPE="raspberrypi3"

source configs/raspberrypi_config

MENDER_BOOT_PART_SIZE_MB=256
MENDER_STORAGE_TOTAL_SIZE_MB=15000

and as first try the variation with the source not in the middle but at the end - but that didn’t make a difference.

2022-11-18 17:43:11 [WARN] [mender-convert-package] The actual boot part size is 256 MiB
2022-11-18 17:43:11 [WARN] [mender-convert-package] Will adjust MENDER_BOOT_PART_SIZE_MB automatically
2022-11-18 17:43:11 [WARN] [mender-convert-package] Consider adjusting the configuration file to avoid this message
2022-11-18 17:43:12 [INFO] [mender-convert-package] Rootfs filesystem size will be 2791 MiB

The Warning concerning MENDER_BOOT_PART_SIZE_MB stays and the rootfs is not adjusted to the increased image size.
The output image size is increased in a way that it also would not fit on the 8GB sdcard again. Seems MENDER_STORAGE_TOTAL_SIZE_MB is ignored.

mender-convert$ MENDER_ARTIFACT_NAME=rpimended.img    ./docker-mender-convert   --disk-image ./input/armhf_bullseye_20220922_updated_javafx11_8gb.img   --config ./configs/raspberrypi3_config   --overlay ./output
using log file at: xxx/mender-convert/logs/convert.log.1668793345-20908
Running mender-convert --disk-image ./input/armhf_bullseye_20220922_updated_javafx11_8gb.img --config ./configs/raspberrypi3_config --overlay ./output
Running mender-convert-extract: --config ./work/override_compression_config --disk-image ./input/armhf_bullseye_20220922_updated_javafx11_8gb.img --config ./configs/raspberrypi3_config --overlay ./output
2022-11-18 17:42:26 [INFO] [mender-convert-extract] Using configuration file: configs/mender_convert_config
2022-11-18 17:42:26 [INFO] [mender-convert-extract] Using configuration file: ./work/override_compression_config
2022-11-18 17:42:26 [INFO] [mender-convert-extract] Using configuration file: ./configs/raspberrypi3_config
2022-11-18 17:42:26 [INFO] [mender-convert-extract] Validating disk image
2022-11-18 17:42:26 [INFO] [mender-convert-extract] Disk parsed successfully
2022-11-18 17:42:26 [INFO] [mender-convert-extract] NUMBER OF PARTS: 2 TYPE: dos
2022-11-18 17:42:26 [INFO] [mender-convert-extract] PART 1: SIZE: 256M TYPE: 0xc
2022-11-18 17:42:26 [INFO] [mender-convert-extract] PART 1: extracting to work/part-1.fs
2022-11-18 17:42:27 [INFO] [mender-convert-extract] PART 2: SIZE: 7.2G TYPE: 0x83
2022-11-18 17:42:27 [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/armhf_bullseye_20220922_updated_javafx11_8gb.img --config ./configs/raspberrypi3_config --overlay ./output
2022-11-18 17:43:07 [INFO] [mender-convert-modify] Using configuration file: configs/mender_convert_config
2022-11-18 17:43:07 [INFO] [mender-convert-modify] Using configuration file: ./work/override_compression_config
2022-11-18 17:43:07 [INFO] [mender-convert-modify] Using configuration file: ./configs/raspberrypi3_config
2022-11-18 17:43:08 [INFO] [mender-convert-modify] Installing Mender client and related files
2022-11-18 17:43:08 [INFO] [mender-convert-modify] Installing Mender client version latest
2022-11-18 17:43:09 [INFO] [mender-convert-modify] Successfully downloaded mender-client_3.4.0-1+debian+bullseye_armhf.deb
2022-11-18 17:43:10 [INFO] [mender-convert-modify] Successfully installed mender-client_3.4.0-1+debian+bullseye_armhf.deb into /mender-convert/work/rootfs/
2022-11-18 17:43:10 [INFO] [mender-convert-modify] Creating state folder in the data partition for Mender add-ons
2022-11-18 17:43:10 [INFO] [mender-convert-modify] Using root device A in mender.conf: /dev/mmcblk0p2
2022-11-18 17:43:10 [INFO] [mender-convert-modify] Using root device B in mender.conf: /dev/mmcblk0p3
2022-11-18 17:43:10 [INFO] [mender-convert-modify] Installing the local mender.conf file
2022-11-18 17:43:10 [INFO] [mender-convert-modify] Creating state scripts version file.
2022-11-18 17:43:10 [INFO] [mender-convert-modify] Installing a custom /etc/fstab (see /mender-convert/logs/convert.log.1668793345-20908 for more info)
2022-11-18 17:43:10 [INFO] [mender-convert-modify] Using boot partition device in fstab: /dev/mmcblk0p1
2022-11-18 17:43:10 [INFO] [mender-convert-modify] Using data partition device in fstab: /dev/mmcblk0p4
2022-11-18 17:43:10 [INFO] [mender-convert-modify] Performing platform specific modifications (if any)
2022-11-18 17:43:10 [INFO] [mender-convert-modify] Running hook: platform_modify
2022-11-18 17:43:11 [INFO] [mender-convert-modify] Certain service files have been changed to align with our /uboot boot partition mount point. See convert.log for more information
2022-11-18 17:43:11 [INFO] [mender-convert-modify] Enabling UART in U-Boot configuration
2022-11-18 17:43:11 [INFO] [mender-convert-modify] Performing user/local specific modifications (if any)
2022-11-18 17:43:11 [INFO] [mender-convert-modify] Running hook: user_local_modify
2022-11-18 17:43:11 [INFO] [mender-convert-modify] Applying rootfs overlay: ./output
2022-11-18 17:43:11 [INFO] [mender-convert-modify] Performing overlay specific modifications (if any)
2022-11-18 17:43:11 [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/armhf_bullseye_20220922_updated_javafx11_8gb.img --config ./configs/raspberrypi3_config --overlay ./output
2022-11-18 17:43:11 [INFO] [mender-convert-package] Using configuration file: configs/mender_convert_config
2022-11-18 17:43:11 [INFO] [mender-convert-package] Using configuration file: ./work/override_compression_config
2022-11-18 17:43:11 [INFO] [mender-convert-package] Using configuration file: ./configs/raspberrypi3_config
2022-11-18 17:43:11 [WARN] [mender-convert-package] The allocated boot part size 40 MiB is too small.
2022-11-18 17:43:11 [WARN] [mender-convert-package] The actual boot part size is 256 MiB
2022-11-18 17:43:11 [WARN] [mender-convert-package] Will adjust MENDER_BOOT_PART_SIZE_MB automatically
2022-11-18 17:43:11 [WARN] [mender-convert-package] Consider adjusting the configuration file to avoid this message
2022-11-18 17:43:12 [INFO] [mender-convert-package] Rootfs filesystem size will be 2791 MiB
2022-11-18 17:43:12 [INFO] [mender-convert-package] Creating a file-system image from: work/rootfs/data/
2022-11-18 17:43:12 [INFO] [mender-convert-package] Creating a file-system image from: work/rootfs/
2022-11-18 17:43:26 [INFO] [mender-convert-package] Copying root filesystem image to deploy directory
2022-11-18 17:43:28 [INFO] [mender-convert-package] Writing Mender artifact to: deploy/armhf_bullseye_20220922_updated_javafx11_8gb-raspberrypi3-mender.mender
2022-11-18 17:43:28 [INFO] [mender-convert-package] This can take up to 20 minutes depending on which compression method is used
2022-11-18 17:43:52 [INFO] [mender-convert-package] Creating Mender compatible disk-image
2022-11-18 17:43:52 [INFO] [mender-convert-package] Total disk size: 8192 MiB
2022-11-18 17:43:52 [INFO] [mender-convert-package]   Boot partition    256 MiB
2022-11-18 17:43:52 [INFO] [mender-convert-package]   RootFS partitions 3892 MiB x 2
2022-11-18 17:43:52 [INFO] [mender-convert-package]   Data partition    128 MiB
2022-11-18 17:43:52 [INFO] [mender-convert-package] Using input diskimage partition scheme (dos)
2022-11-18 17:43:52 [INFO] [mender-convert-package] Writing DOS (MBR) partition table
2022-11-18 17:43:54 [INFO] [mender-convert-package] Writing boot partition image
2022-11-18 17:43:55 [INFO] [mender-convert-package] Writing rootfsa partition image
2022-11-18 17:44:11 [INFO] [mender-convert-package] Writing rootfsb partition image
2022-11-18 17:44:32 [INFO] [mender-convert-package] Writing data partition image
2022-11-18 17:44:33 [INFO] [mender-convert-package] Performing platform specific package operations (if any)
2022-11-18 17:44:33 [INFO] [mender-convert-package] Running hook: platform_package
2022-11-18 17:44:33 [INFO] [mender-convert-package] Conversion has completed! \o/
mender-convert-package has finished. Cleaning up...
Output Artifacts and images can be found in the deploy directory:
deploy/armhf_bullseye_20220922_updated_javafx11_8gb-raspberrypi3-mender.cfg
deploy/armhf_bullseye_20220922_updated_javafx11_8gb-raspberrypi3-mender.ext4
deploy/armhf_bullseye_20220922_updated_javafx11_8gb-raspberrypi3-mender.img
deploy/armhf_bullseye_20220922_updated_javafx11_8gb-raspberrypi3-mender.mender

mender-convert$ ll input/
...
-rw-r--r--  1 root root 7973371904 Nov 18 18:33 armhf_bullseye_20220922_updated_javafx11_8gb.img

mender-convert$ ll deploy/
...
-rw-r--r--  1 user user 2927296512 Nov 18 18:43 armhf_bullseye_20220922_updated_javafx11_8gb-raspberrypi3-mender.ext4
-rw-r--r--  1 user user 8589934592 Nov 18 18:44 armhf_bullseye_20220922_updated_javafx11_8gb-raspberrypi3-mender.img
-rw-r--r--  1 user user  940161024 Nov 18 18:43 armhf_bullseye_20220922_updated_javafx11_8gb-raspberrypi3-mender.mender

Hi @_richard

I just ran a conversion like so:

➜  LH mender-convert git:(2758eec) ✗ cat configs/raspberrypi3_config
RASPBERRYPI_CONFIG="raspberrypi3"
RASPBERRYPI_KERNEL_IMAGE="kernel7.img"
MENDER_KERNEL_IMAGETYPE="zImage"
MENDER_DEVICE_TYPE="raspberrypi3"

source configs/raspberrypi_config

MENDER_BOOT_PART_SIZE_MB=256
MENDER_STORAGE_TOTAL_SIZE_MB=15000
➜  LH mender-convert git:(2758eec) ✗ MENDER_ARTIFACT_NAME=foo ./docker-mender-convert --disk-image ./input/2019-06-20-raspbian-buster-lite.img --config configs/raspberrypi3_config

And this is the output:

➜  LH mender-convert git:(2758eec) ✗ fdisk -l deploy/2019-06-20-raspbian-buster-lite-raspberrypi3-mender.img
Disk deploy/2019-06-20-raspbian-buster-lite-raspberrypi3-mender.img: 14.65 GiB, 15728640000 bytes, 30720000 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: 0xf97472d0

Device                                                          Boot    Start      End  Sectors  Size Id Type
deploy/2019-06-20-raspbian-buster-lite-raspberrypi3-mender.img1 *       24576   557055   532480  260M  c W95 FAT32 (LBA)
deploy/2019-06-20-raspbian-buster-lite-raspberrypi3-mender.img2        557056 15499263 14942208  7.1G 83 Linux
deploy/2019-06-20-raspbian-buster-lite-raspberrypi3-mender.img3      15499264 30441471 14942208  7.1G 83 Linux
deploy/2019-06-20-raspbian-buster-lite-raspberrypi3-mender.img4      30441472 30703615   262144  128M 83 Linux

Which looks about right to me.

Can you produce the same sort of output for me?