File .tar.gz is not extracted to my rootfs


I am trying to use Yocto to copy some files to my rootfs, and I managed successfully to do it.

The next step was to try to copy a file.tar.gz and have it extracted to my roofs, and I am having problems with.

This is the recipe I am using:

DESCRIPTION = “Copying files to the /work dir on target”

PR = “r0”

FILESEXTRAPATHS_prepend := “${THISDIR}/misa-files:”

SRC_URI += “file://test \

inherit bin_package

do_install() {
install -d ${D}/work

install -m 0755 ${WORKDIR}/test ${D}/work
install -m 0755 ${WORKDIR}/nico.tar.gz ${D}/work

FILES_${PN} += “/work”

The “test” file is copied successfully into the rootfs (under the folder /work) on my target, but the file nico.tar.gz gives me a problem: bitbake says the following error message:

Log data follows:
| DEBUG: Executing shell function do_install
| install: cannot stat ‘/work/apalis/oe-core-misa/build/tmp-glibc/work/armv7at2hf-neon-angstrom-linux-gnueabi/misa-files/1.0.1-r0/nico.tar.gz’: No such file or directory

If on the above recipe I specify not to unpack the file nico.tar.gz by setting:

SRC_URI += “file://test \

then the file is copied to the rootfs correctly.

Without “unpack=0” I was expecting bitbake to extract the tar.gz to the ${WORKDIR} and have the extracted file into my rootfs, but apparently it can’t find the nico.tar.gz file into the ${WORKDIR}.

Am I missing something ?

Thanks for your help.



Without “unpack=0” I was expecting bitbake to extract the tar.gz to the ${WORKDIR} and have the extracted file into my rootfs, but apparently it can’t find the nico.tar.gz file into the ${WORKDIR}.

That assumption is wrong. The fetcher by default unpacks into ${WORKDIR}.

I guess you have some options here:

  • Use unpack=0 in the SRC_URI and unpack the sources by hand in the do_install task. Possibly you have to chown ${D} recursively afterwards to get around some warnings:

| WARNING: QA Issue: qtbase: /qtbase-dev/usr/lib/libqtfreetype.prl is owned by
| uid 1000, which is the same as the user running bitbake. This may be due to
| host contamination [host-user-contaminated]

tar xf nico.tar.gz -C ${D}/work
  • Have the fetcher unpack the tar file and add an install line for each individual file.

  • Create the tar file with a toplevel directory and have the fetcher unpack the tar file. In do_unpack recursively copy it to ${D}.

    cp -r ${WORKDIR}toplevel/* ${D}/work/

  • Untested, might give a conflict: Trick the fetcher to unpack the tar file in the way to want it by creating your tar file with a directory structure so that it unpacked matches what you want to have.


I personally favour the 3rd option. For an unsuspecting reader of your bb file your intentions are clear.


Hello Max,

thank you for your answer.

Let me see if I understood it correctly.

If I do “install -m 0755 ${WORKDIR}/nico.tar.gz ${D}/work” inside do_install(), without using unpack=0, then the fetcher (inside do_fetch()) will first unpack the file into ${WORKDIR}, and then my install instruction will not work because it will not find the nico.tar.gz file under ${WORKDIR} to copy to ${D}/work/. This is the error I am seeing in bitbake.

By removing my instruction “install -m 0755 ${WORKDIR}/nico.tar.gz ${D}/work” from inside do_install(), the error will be gone, and the do_fetch() will unpack my tar.gz inside ${WORKDIR}.

The next thing to do is to recursively copy the unpacked tar.gz file into my ${D}/work. (your option 3).

Where should this copy take place ? Inside do_unpack, or do_install or somewhere else ? Is the order important ? I guess do_unpack is executed before do_install and my /work dir is only created inside do_install.

Thank you again.


Hi Nicola

You understood me correctly.

I’d expect that it does not matter were you would unpack your own tar.gz file.

However logically it belongs in the do_install task, so I would add it to do_install.


Thank you Max,

everything is working correctly (inside do_install).


Hi Nicola,
i wrote the same recipe to untar a file and copy the extracted file to roofs.

bitbake recipe is working fine but when i am doing bitbake-core-image-base i am getting following error.

ERROR: core-image-base-1.0-r0 do_rootfs: Could not invoke dnf. Command ‘/home/ajam/sabre_anew/imx_build/tmp/work/imx6qsabresd-poky-linux-gnueabi/core-image-base/1.0-r0/recipe-sysroot-native/usr/bin/dnf -y -c /home/ajam/sabre_anew/imx_build/tmp/work/imx6qsabresd-poky-linux-gnueabi/core-image-base/1.0-r0/rootfs/etc/dnf/dnf.conf --setopt=reposdir=/home/ajam/sabre_anew/imx_build/tmp/work/imx6qsabresd-poky-linux-gnueabi/core-image-base/1.0-r0/rootfs/etc/yum.repos.d --repofrompath=oe-repo,/home/ajam/sabre_anew/imx_build/tmp/work/imx6qsabresd-poky-linux-gnueabi/core-image-base/1.0-r0/oe-rootfs-repo --installroot=/home/ajam/sabre_anew/imx_build/tmp/work/imx6qsabresd-poky-linux-gnueabi/core-image-base/1.0-r0/rootfs --setopt=logdir=/home/ajam/sabre_anew/imx_build/tmp/work/imx6qsabresd-poky-linux-gnueabi/core-image-base/1.0-r0/temp --nogpgcheck install packagegroup-core-sdk shadow sqlite3 perl-module-data-dumper perl-module-base nodejs hostapd bridge-utils wmsapp psplash nodejs-npm packagegroup-core-tools-debug wpa-supplicant run-postinsts python-smbus docker perl dropbear perl-module-findbin packagegroup-base-extended e2fsprogs dhcp-server lua perl-module-digest-md5 perl-module-file-spec-functions mtd-utils ipsec-tools gstreamer1.0 kernel-modules apt base-passwd packagegroup-core-standalone-sdk-target openssl libsqlite0 i2c-tools perl-module-bytes perl-module-file-spec packagegroup-core-boot nginx libconfig dnf iptables rpm perl-module-getopt-long locale-base-en-us locale-base-en-gb’ returned 1:
Added oe-repo repo from /home/ajam/sabre_anew/imx_build/tmp/work/imx6qsabresd-poky-linux-gnueabi/core-image-base/1.0-r0/oe-rootfs-repo
Last metadata expiration check: 0:00:00 ago on Fri 24 May 2019 06:37:24 PM IST.
No package wmsapp available.
Error: Unable to find a match

ERROR: core-image-base-1.0-r0 do_rootfs: Function failed: do_rootfs
ERROR: Logfile of failure stored in: /home/ajam/sabre_anew/imx_build/tmp/work/imx6qsabresd-poky-linux-gnueabi/core-image-base/1.0-r0/temp/log.do_rootfs.19949
ERROR: Task (/home/ajam/sabre_anew/sources/poky/meta/recipes-core/images/ failed with exit code ‘1’

Could you ask a new question? Thanks.