[yocto] Can't build SDK while shrinking shadow tools

Jérémy Singy jeremy.singy at gmail.com
Fri Jun 14 02:15:13 PDT 2019


Hi,

I'm facing a problem by trying to shrink the size of our root filesystem.
To avoid installing some unneeded tools such as adduser, groupadd,
nologin, etc. I just created as usual a shadow_%.bbappend in our layer
which removes the content using do_install_append:

    # do not install alternatives
    ALTERNATIVE_${PN} = ""
    ALTERNATIVE_${PN}-base = ""

    # remove unwanted files on target
    do_install_append_class-target () {
      rm -r ${D}${base_bindir}
      rm -r ${D}${base_sbindir}
      rm -r ${D}${bindir}
      rm -r ${D}${sbindir}
    }

Building an image with this works well and I got rid of the unwanted
tools but I get an error whenever I try to build the SDK for this image
with do_populate_sdk:

    WARNING: ceres-image-1.0-r0 do_populate_sdk:
nativesdk-util-linux.postinst returned 1, marking as unpacked only,
configuration required on target.
    ERROR: ceres-image-1.0-r0 do_populate_sdk: Postinstall scriptlets
of ['nativesdk-util-linux'] have failed. If the intention is to defer
them to first boot,
    then please place them into pkg_postinst_ontarget_${PN} ().
    Deferring to first boot via 'exit 1' is no longer supported.
    Details of the failure are in
/home/chsingj/yocto-thud/tmp/work/ceres_con-oe-linux-gnueabi/ceres-image/1.0-r0/temp/log.do_populate_sdk.
    ERROR: ceres-image-1.0-r0 do_populate_sdk: Function failed: do_populate_sdk
    ERROR: Logfile of failure stored in:
/home/chsingj/yocto-thud/tmp/work/ceres_con-oe-linux-gnueabi/ceres-image/1.0-r0/temp/log.do_populate_sdk.28331
    ERROR: Task
(/home/chsingj/meta-delta/recipes-core/images/ceres-image.bb:do_populate_sdk)
failed with exit code '1'
    NOTE: Tasks Summary: Attempted 2730 tasks of which 2729 didn't
need to be rerun and 1 failed.

The log file shows an error with update-alternatives (probably a
failing ln call):

    update-alternatives: Error: not linking
[BUILDPATH]/tmp/work/ceres_con-oe-linux-gnueabi/ceres-image/1.0-r0/sdk/image/opt/ceres/sdk-2019.05-r1/sysroots/x86_64-delta-linux/sbin/nologin
to /opt/ceres/sdk-2019.05-r1/sysroots/x86_64-delta-linux/sbin/nologin.util-linux
since [BUILDPATH]/tmp/work/ceres_con-oe-linux-gnueabi/ceres-image/1.0-r0/sdk/image/opt/ceres/sdk-2019.05-r1/sysroots/x86_64-delta-linux/sbin/nologin
exists and is not a link

If I remove the bbappend, the SDK builds fine but of course my image
contains the unwanted files. I tried many other recipe tweaks but I
can't get over some build errors. I'd like to avoid a solution using
ROOTFS_POSTPROCESS_COMMAND in the image recipe as I would have to
explicitely list all shadow tools and it would blow up my recipe. Is
there any solution here? Is it maybe a bug that can be fixed? Thanks!

Regards,
Jeremy


More information about the yocto mailing list