Uploaded image for project: 'Mender'
  1. Mender
  2. MEN-2749

Large file in /data produces `set_image_size` errors on various images

    XMLWordPrintable

    Details

    • Days in progress:
      0

      Description

      This started as a thread on Mender Hub and you can read more about it there.

      To reproduce you can add the following to 'local.conf':

      MENDER_STORAGE_TOTAL_SIZE_MB = "2048"
      MENDER_DATA_PART_SIZE_MB = "1024"
      

      And then apply the following diff on meta-mender-demo to install a "large file" on the data partition:

      diff --git a/meta-mender-demo/recipes-mender/hello-mender/hello-mender.bb b/meta-mender-demo/recipes-mender/hello-mender/hello-mender.bb
      index 2223712..bce76fd 100644
      --- a/meta-mender-demo/recipes-mender/hello-mender/hello-mender.bb
      +++ b/meta-mender-demo/recipes-mender/hello-mender/hello-mender.bb
      @@ -1,7 +1,7 @@
       DESCRIPTION = "Mender test recipe for persistent data files"
       LICENSE = "Apache-2.0"
       
      -FILES_${PN} += "/data/persistent.txt"
      +FILES_${PN} += "/data/persistent.txt /data/1gb.file"
       
       do_compile() {
           echo 'Hello Mender config file' > hello-mender.cfg
      @@ -14,4 +14,6 @@ do_install() {
       
           install -d ${D}/data/
           install -m 0644 persistent.txt ${D}/data/
      +
      +     dd if=/dev/zero of=${D}/data/1gb.file count=800 bs=1M
       }
      

      Depending a bit on the content of 'IMAGE_FSTYPES' you will start seeing errors such as these:

      ERROR: core-image-base-1.0-r0 do_image_tar: The rootfs size 1138240(K) overrides IMAGE_ROOTFS_MAXSIZE: 507904(K)
      ERROR: core-image-base-1.0-r0 do_image_tar: Function failed: set_image_size
      

      And this is because the clean up of '/data' is not applied to all image types, for one the current logic only adds pre/post steps to what is is in IMAGE_FSTYPES, e.g if you have 'tar.bz2' in IMAGE_FSTYPES the pre/post funcs will not be added to 'tar' image (hence the error above).

      Most of this inconsistencies can be solved by updating the IMAGE_FSTYPE variable, but there are additional two errors that are not solvable this way,

      ERROR: core-image-base-1.0-r0 do_image_dataimg: The rootfs size 908872(K) overrides IMAGE_ROOTFS_MAXSIZE: 507904(K)
      ERROR: core-image-base-1.0-r0 do_image_dataimg: Function failed: set_image_size
      ERROR: Logfile of failure stored in: /home/admin/mender-beaglebone/build/tmp/work/beaglebone_yocto-poky-linux-gnueabi/core-image-base/1.0-r0/temp/log.do_image_dataimg.29064
      ERROR: Task (/home/admin/mender-beaglebone/build/../sources/poky/meta/recipes-core/images/core-image-base.bb:do_image_dataimg) failed with exit code '1'
      

      Above case is particularity tricky, because it relies on that we preserver the '/data' directory in the rootfs to generate 'dataimg' but it will also call the 'set_image_size' which does a sanity check of the rootfs size, including the /data directory (hence the error).

      Another failure is,

      ERROR: core-image-base-1.0-r0 do_rootfs_wicenv: The rootfs size 908872(K) overrides IMAGE_ROOTFS_MAXSIZE: 507904(K)
      ERROR: core-image-base-1.0-r0 do_rootfs_wicenv: Function failed: set_image_size
      ERROR: Logfile of failure stored in: /home/admin/mender-beaglebone/build/tmp/work/beaglebone_yocto-poky-linux-gnueabi/core-image-base/1.0-r0/temp/log.do_rootfs_wicenv.29278
      ERROR: Task (/home/admin/mender-beaglebone/build/../sources/poky/meta/recipes-core/images/core-image-base.bb:do_rootfs_wicenv) failed with exit code '1'
      

      Above image is not added trough 'IMAGE_FSTYPES' and hence never inherits the clean-up functions. This I could work around by adding the following to 'mender-part-images.bbclass:

      do_rootfs_wicenv[prefuncs] += 'prepare_excluded_directories'
      do_rootfs_wicenv[postfuncs] += 'cleanup_excluded_directories'
      

      I do not know if there is a better way of doing it.

        Attachments

          Activity

            People

            • Assignee:
              mirzak Mirza Krak
              Reporter:
              mirzak Mirza Krak
            • Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Summary Panel