Build fails Apalis IMX8

I encounter the following build error:

ERROR: File system image of partition None is larger (3297201 kB) than its allowed size 950272 kB

If I revert the meta-mender-community layer to something before commit 475f3f8c “toradex: Support both 5.3.0 and 5.4.0 BSPs in Dunfell.”, then I do not get the error. I tried defining TORADEX_BSP_VERSION to 5.3.0 and 5.4.0, but get the error in either case.

Here is the error:

| + outimgname=/home/pagi/manus-linux/toradex-apalis-imx8/build/tmp/work/apalis_imx8-tdx-linux/tdx-reference-minimal-image/1.0-r0/deploy-tdx-reference-minimal-image-image-complete/Apalis-iMX8_Reference-Minimal-Image.sdimg
| + wicout=/home/pagi/manus-linux/toradex-apalis-imx8/build/tmp/work/apalis_imx8-tdx-linux/tdx-reference-minimal-image/1.0-r0/deploy-tdx-reference-minimal-image-image-complete/Apalis-iMX8_Reference-Minimal-Image-sdimg
| + BUILDDIR=/home/pagi/manus-linux/toradex-apalis-imx8/build wic create /home/pagi/manus-linux/toradex-apalis-imx8/build/tmp/work/apalis_imx8-tdx-linux/tdx-reference-minimal-image/1.0-r0/mender-sdimg.wks --vars /home/pagi/manus-linux/toradex-apalis-imx8/build/tmp/sysroots/apalis-imx8/imgdata/ -e Reference-Minimal-Image -o /home/pagi/manus-linux/toradex-apalis-imx8/build/tmp/work/apalis_imx8-tdx-linux/tdx-reference-minimal-image/1.0-r0/deploy-tdx-reference-minimal-image-image-complete/Apalis-iMX8_Reference-Minimal-Image-sdimg/ --no-fstab-update
| INFO: Creating image(s)...
| 
| ERROR: File system image of partition None is larger (3297201 kB) than its allowed size 950272 kB
| 
| + bb_exit_handler
| + ret=1
| + echo WARNING: exit code 1 from a shell command.
| WARNING: exit code 1 from a shell command.
| + exit 1
| 
ERROR: Task (/home/pagi/manus-linux/toradex-apalis-imx8/build/../layers/meta-toradex-demos/recipes-images/images/tdx-reference-minimal-image.bb:do_image_sdimg) failed with exit code '1'
ERROR: tdx-reference-minimal-image-1.0-r0 do_image_mender: Size of rootfs is greater than the calculated partition space (3376333824 > 973078528). This image won't fit on a device with the current storage configuration. Try reducing IMAGE_OVERHEAD_FACTOR if it is higher than 1.0, or raise MENDER_STORAGE_TOTAL_SIZE_MB if the device in fact has more storage.
ERROR: tdx-reference-minimal-image-1.0-r0 do_image_mender: Execution of '/home/pagi/manus-linux/toradex-apalis-imx8/build/tmp/work/apalis_imx8-tdx-linux/tdx-reference-minimal-image/1.0-r0/temp/run.do_image_mender.1142806' failed with exit code 1:
+ [ -z manus-linux-apalis-imx8-release-0.0.16 ]
+ stat -Lc %s /home/pagi/manus-linux/toradex-apalis-imx8/build/tmp/work/apalis_imx8-tdx-linux/tdx-reference-minimal-image/1.0-r0/deploy-tdx-reference-minimal-image-image-complete/Reference-Minimal-Image-apalis-imx8.ext4
+ rootfs_size=3376333824
+ expr 950272 * 1024
+ calc_rootfs_size=973078528
+ [ 3376333824 -gt 973078528 ]
+ bbfatal Size of rootfs is greater than the calculated partition space (3376333824 > 973078528). This image won't fit on a device with the current storage configuration. Try reducing IMAGE_OVERHEAD_FACTOR if it is higher than 1.0, or raise MENDER_STORAGE_TOTAL_SIZE_MB if the device in fact has more storage.
+ [ -p /home/pagi/manus-linux/toradex-apalis-imx8/build/tmp/work/apalis_imx8-tdx-linux/tdx-reference-minimal-image/1.0-r0/temp/fifo.1142806 ]
+ printf %b\0 bbfatal Size of rootfs is greater than the calculated partition space (3376333824 > 973078528). This image won't fit on a device with the current storage configuration. Try reducing IMAGE_OVERHEAD_FACTOR if it is higher than 1.0, or raise MENDER_STORAGE_TOTAL_SIZE_MB if the device in fact has more storage.
+ exit 1
+ bb_exit_handler
+ ret=1
+ echo WARNING: exit code 1 from a shell command.
WARNING: exit code 1 from a shell command.
+ exit 1

ERROR: Logfile of failure stored in: /home/pagi/manus-linux/toradex-apalis-imx8/build/tmp/work/apalis_imx8-tdx-linux/tdx-reference-minimal-image/1.0-r0/temp/log.do_image_mender.1142806
ERROR: Task (/home/pagi/manus-linux/toradex-apalis-imx8/build/../layers/meta-toradex-demos/recipes-images/images/tdx-reference-minimal-image.bb:do_image_mender) failed with exit code '1'
NOTE: Tasks Summary: Attempted 8158 tasks of which 5 didn't need to be rerun and 2 failed.
NOTE: Writing buildhistory
NOTE: Writing buildhistory took: 5 seconds

Summary: 2 tasks failed:
  /home/pagi/manus-linux/toradex-apalis-imx8/build/../layers/meta-toradex-demos/recipes-images/images/tdx-reference-minimal-image.bb:do_image_sdimg
  /home/pagi/manus-linux/toradex-apalis-imx8/build/../layers/meta-toradex-demos/recipes-images/images/tdx-reference-minimal-image.bb:do_image_mender
Summary: There was 1 WARNING message shown.
Summary: There were 3 ERROR messages shown, returning a non-zero exit code.

What does the following show for you:

$ bitbake -e tdx-reference-minimal-image | grep ^MENDER_STORAGE_TOTAL_SIZE_MB=

That command produces:

MENDER_STORAGE_TOTAL_SIZE_MB=“2048”

And do you get the same value when you revert to the older commit? That error generally means that you need to increase MENDER_STORAGE_TOTAL_SIZE_MB. I have not see this building locally. Do you have any extra packages or anything that you have installed in local.conf?

Same value when I revert to the older commit. Yes, I do have extra packages. But I do not understand why it builds with the older meta-mender-community commit.

Yeah me either. Unfortunately, I’m not able to reproduce your issue so I don’t really have anything to suggest. Let me know if you uncover anything interesting.
Drew

Thanks, Drew. I will investigate and document the findings here.

One thing that confuses me is what MENDER_STORAGE_TOTAL_SIZE_MB actually means.

I have 16 GB of flash. When I set MENDER_STORAGE_TOTAL_SIZE_MB to 2048, I used to get partitions like below (now, of course, the build fails, as described in this ticket):

Device         Boot    Start      End  Sectors  Size Id Type
/dev/mmcblk0p1 *       49152   114687    65536   32M  c W95 FAT32 (LBA)
/dev/mmcblk0p2        114688 12500991 12386304  5.9G 83 Linux
/dev/mmcblk0p3      12500992 24887295 12386304  5.9G 83 Linux
/dev/mmcblk0p4      24887296 31080447  6193152    3G 83 Linux

Could you clarify what this variable actually means and how a value of “2048” results in 6 GB for rootfs?

It specifies the total disk size to be allocated to all 4 partitions. You explicitly also set the size for the data and boot partitions, and the sdimg bbclass calculates the rootfs size based on the splitting the remaining in half.

I don’t know how you would get a 6G partition if the total size is only 2048. My best guess is that variable is somehow modified.

Drew

Thanks, I don’t know how it worked either. I have increased MENDER_STORAGE_TOTAL_SIZE_MB to 16 GB, which is the amount of flash in the Apalis. This works fine.

Shouldn’t this variable be set to 16GB in the meta-mender-community config files? According to the mender documentation, this variable is:

Total size of the physical storage medium that mender partitioned images will be written to, expressed in MiB.

The physical storage medium on the Apalis IMX8 is 16GB eMMC on all variants.

https://www.toradex.com/computer-on-modules/apalis-arm-family/nxp-imx-8#features

Usually we set it to a smaller value to make for smaller artifacts and install times. The data partition can extend to fill the drive using the mender-growfs-data MENDER_FEATURE so that usually is a better approach.

I do not see any large artifacts. I have MENDER_STORAGE_TOTAL_SIZE_MB = 16000 and the following artifacts:

4,5M	Apalis-iMX8_Reference-Minimal-Image.dataimg
2,4G	Apalis-iMX8_Reference-Minimal-Image.ext4
88K	Apalis-iMX8_Reference-Minimal-Image.manifest
774M	Apalis-iMX8_Reference-Minimal-Image.mender
4,0K	Apalis-iMX8_Reference-Minimal-Image.mender.bmap
1,3G	Apalis-iMX8_Reference-Minimal-Image.mender_tezi.tar
4,8G	Apalis-iMX8_Reference-Minimal-Image.sdimg
8,0K	Apalis-iMX8_Reference-Minimal-Image.sdimg.bmap
1,3G	Apalis-iMX8_Reference-Minimal-Image.sdimg.bz2
584K	Apalis-iMX8_Reference-Minimal-Image.testdata.json

That is strange. I made a build with your setting and see a file of the appropriate size:

<dmoseley@aruba> {/work/dmoseley/scratch/mender-toradex/build}
$ ls -l deploy/images/apalis-imx8/Apalis-iMX8_Reference-Minimal-Image.*
.rw-r--r-- 134M dmoseley 10 Nov 11:47 deploy/images/apalis-imx8/Apalis-iMX8_Reference-Minimal-Image.dataimg
.rw-r--r-- 8.3G dmoseley 10 Nov 11:47 deploy/images/apalis-imx8/Apalis-iMX8_Reference-Minimal-Image.ext4
.rw-r--r--  47k dmoseley 10 Nov 11:47 deploy/images/apalis-imx8/Apalis-iMX8_Reference-Minimal-Image.manifest
.rw-rw-r--  99M dmoseley 10 Nov 11:48 deploy/images/apalis-imx8/Apalis-iMX8_Reference-Minimal-Image.mender
.rw-r--r-- 2.3k dmoseley 10 Nov 11:48 deploy/images/apalis-imx8/Apalis-iMX8_Reference-Minimal-Image.mender.bmap
.rw-rw-r-- 149M dmoseley 10 Nov 11:48 deploy/images/apalis-imx8/Apalis-iMX8_Reference-Minimal-Image.mender_tezi.tar
.rw-r--r--  17G dmoseley 10 Nov 11:48 deploy/images/apalis-imx8/Apalis-iMX8_Reference-Minimal-Image.sdimg
.rw-r--r-- 6.6k dmoseley 10 Nov 11:48 deploy/images/apalis-imx8/Apalis-iMX8_Reference-Minimal-Image.sdimg.bmap
.rw-r--r-- 130M dmoseley 10 Nov 11:48 deploy/images/apalis-imx8/Apalis-iMX8_Reference-Minimal-Image.sdimg.bz2
.rw-r--r-- 606k dmoseley 10 Nov 11:47 deploy/images/apalis-imx8/Apalis-iMX8_Reference-Minimal-Image.testdata.json

This is strange. It seems that my artifact size may change over time. Will this cause problems with mender updates? For example, if I have a system with a rootfs size of 6.1 GB, and I try to update it with one that increases to 6.3 GB, will the update fail?

How do I limit the rootfs size?