yoctobitbakeyocto-layer

Build Yocto project with bitbake


I've been trying to build the Yocto project with bitbake for a long time ('core-image-minimal' exactly), and I'm always reaching pretty same errors, like:


WARNING: linux-yocto-6.6.43+git-r0 do_fetch: Failed to fetch URL git://git.yoctoproject.org/linux-yocto.git;name=machine;branch=v6.6/standard/base;protocol=https, attempting MIRRORS if available
ERROR: netbase-1_6.4-r0 do_package: Error executing a python function in exec_func_python() autogenerated:

The stack trace of python calls that resulted in this exception/failure was:
File: 'exec_func_python() autogenerated', lineno: 2, function: <module>
0001:
*** 0002:sstate_task_postfunc(d)
0003:
File: '/root/yocto/poky/meta/classes-global/sstate.bbclass', lineno: 795, function: sstate_task_postfunc
0791:
0792: omask = os.umask(0o002)
0793: if omask != 0o002:
0794: bb.note("Using umask 0o002 (not %0o) for sstate packaging" % omask)
*** 0795: sstate_package(shared_state, d)
0796: os.umask(omask)
0797:
0798: sstateinst = d.getVar("SSTATE_INSTDIR")
0799: d.setVar('SSTATE_FIXMEDIR', shared_state['fixmedir'])
File: '/root/yocto/poky/meta/classes-global/sstate.bbclass', lineno: 692, function: sstate_package
0688: if sharedworkdir in plain:
0689: pdir = plain.replace(sharedworkdir, sstatebuild)
0690: bb.utils.mkdirhier(plain)
0691: bb.utils.mkdirhier(pdir)
*** 0692: bb.utils.rename(plain, pdir)
0693: if fixtime:
0694: fixtimestamp(pdir, "")
0695: for walkroot, dirs, files in os.walk(pdir):
0696: for file in files + dirs:
File: '/root/yocto/poky/bitbake/lib/bb/utils.py', lineno: 1781, function: rename
1777: if err.errno == 18:
1778: # Invalid cross-device link error
1779: shutil.move(src, dst)
1780: else:
*** 1781: raise err
1782:
1783:@contextmanager
1784:def environment(**envvars):
1785: """
File: '/root/yocto/poky/bitbake/lib/bb/utils.py', lineno: 1775, function: rename
1771:# Wrapper around os.rename which can handle cross device problems
1772:# e.g. from container filesystems
1773:def rename(src, dst):
1774: try:
*** 1775: os.rename(src, dst)
1776: except OSError as err:
1777: if err.errno == 18:
1778: # Invalid cross-device link error
1779: shutil.move(src, dst)
Exception: PermissionError: [Errno 13] Permission denied: '/root/yocto/poky/build/tmp/work/all-poky-linux/netbase/6.4/package' -> '/root/yocto/poky/build/tmp/work/all-poky-linux/netbase/6.4/sstate-build-package//package'

ERROR: Logfile of failure stored in: /root/yocto/poky/build/tmp/work/all-poky-linux/netbase/6.4/temp/log.do_package.13831
ERROR: Task (/root/yocto/poky/meta/recipes-core/netbase/netbase_6.4.bb:do_package) failed with exit code '1'
ERROR: update-rc.d-0.8+git-r0 do_package: Error executing a python function in exec_func_python() autogenerated:

The stack trace of python calls that resulted in this exception/failure was:
File: 'exec_func_python() autogenerated', lineno: 2, function: <module>
0001:
*** 0002:sstate_task_postfunc(d)
0003:
File: '/root/yocto/poky/meta/classes-global/sstate.bbclass', lineno: 801, function: sstate_task_postfunc
0797:
0798: sstateinst = d.getVar("SSTATE_INSTDIR")
0799: d.setVar('SSTATE_FIXMEDIR', shared_state['fixmedir'])
0800:
*** 0801: sstate_installpkgdir(shared_state, d)
0802:
0803: bb.utils.remove(d.getVar("SSTATE_BUILDDIR"), recurse=True)
0804:}
0805:sstate_task_postfunc[dirs] = "${WORKDIR}"
File: '/root/yocto/poky/meta/classes-global/sstate.bbclass', lineno: 416, function: sstate_installpkgdir
0412: for f in (d.getVar('SSTATEPOSTUNPACKFUNCS') or '').split():
0413: # All hooks should run in the SSTATE_INSTDIR
0414: bb.build.exec_func(f, d, (sstateinst,))
0415:
*** 0416: sstate_install(ss, d)
0417:
0418: return True
0419:
0420:python sstate_hardcode_path_unpack () {
File: '/root/yocto/poky/meta/classes-global/sstate.bbclass', lineno: 350, function: sstate_install
0346: src = sstateinst + "/" + plain.replace(sharedworkdir, '')
0347: dest = plain
0348: bb.utils.mkdirhier(src)
0349: prepdir(dest)
*** 0350: bb.utils.rename(src, dest)
0351:
0352: for postinst in (d.getVar('SSTATEPOSTINSTFUNCS') or '').split():
0353: # All hooks should run in the SSTATE_INSTDIR
0354: bb.build.exec_func(postinst, d, (sstateinst,))
File: '/root/yocto/poky/bitbake/lib/bb/utils.py', lineno: 1781, function: rename
1777: if err.errno == 18:
1778: # Invalid cross-device link error
1779: shutil.move(src, dst)
1780: else:
*** 1781: raise err
1782:
1783:@contextmanager
1784:def environment(**envvars):
1785: """
File: '/root/yocto/poky/bitbake/lib/bb/utils.py', lineno: 1775, function: rename
1771:# Wrapper around os.rename which can handle cross device problems
1772:# e.g. from container filesystems
1773:def rename(src, dst):
1774: try:
*** 1775: os.rename(src, dst)
1776: except OSError as err:
1777: if err.errno == 18:
1778: # Invalid cross-device link error
1779: shutil.move(src, dst)
Exception: PermissionError: [Errno 13] Permission denied: '/root/yocto/poky/build/tmp/work/all-poky-linux/update-rc.d/0.8+git/sstate-build-package///package' -> '/root/yocto/poky/build/tmp/work/all-poky-linux/update-rc.d/0.8+git/package'

ERROR: Logfile of failure stored in: /root/yocto/poky/build/tmp/work/all-poky-linux/update-rc.d/0.8+git/temp/log.do_package.13830
ERROR: Task (/root/yocto/poky/meta/recipes-core/update-rc.d/update-rc.d_0.8.bb:do_package) failed with exit code '1'
ERROR: base-files-3.0.14-r0 do_package: Error executing a python function in exec_func_python() autogenerated:

The stack trace of python calls that resulted in this exception/failure was:
File: 'exec_func_python() autogenerated', lineno: 2, function: <module>
0001:
*** 0002:sstate_task_postfunc(d)
0003:
File: '/root/yocto/poky/meta/classes-global/sstate.bbclass', lineno: 795, function: sstate_task_postfunc
0791:
0792: omask = os.umask(0o002)
0793: if omask != 0o002:
0794: bb.note("Using umask 0o002 (not %0o) for sstate packaging" % omask)
*** 0795: sstate_package(shared_state, d)
0796: os.umask(omask)
0797:
0798: sstateinst = d.getVar("SSTATE_INSTDIR")
0799: d.setVar('SSTATE_FIXMEDIR', shared_state['fixmedir'])
File: '/root/yocto/poky/meta/classes-global/sstate.bbclass', lineno: 692, function: sstate_package
0688: if sharedworkdir in plain:
0689: pdir = plain.replace(sharedworkdir, sstatebuild)
0690: bb.utils.mkdirhier(plain)
0691: bb.utils.mkdirhier(pdir)
*** 0692: bb.utils.rename(plain, pdir)
0693: if fixtime:
0694: fixtimestamp(pdir, "")
0695: for walkroot, dirs, files in os.walk(pdir):
0696: for file in files + dirs:
File: '/root/yocto/poky/bitbake/lib/bb/utils.py', lineno: 1781, function: rename
1777: if err.errno == 18:
1778: # Invalid cross-device link error
1779: shutil.move(src, dst)
1780: else:
*** 1781: raise err
1782:
1783:@contextmanager
1784:def environment(**envvars):
1785: """
File: '/root/yocto/poky/bitbake/lib/bb/utils.py', lineno: 1775, function: rename
1771:# Wrapper around os.rename which can handle cross device problems
1772:# e.g. from container filesystems
1773:def rename(src, dst):
1774: try:
*** 1775: os.rename(src, dst)
1776: except OSError as err:
1777: if err.errno == 18:
1778: # Invalid cross-device link error
1779: shutil.move(src, dst)
Exception: PermissionError: [Errno 13] Permission denied: '/root/yocto/poky/build/tmp/work/qemux86_64-poky-linux/base-files/3.0.14/package' -> '/root/yocto/poky/build/tmp/work/qemux86_64-poky-linux/base-files/3.0.14/sstate-build-package//package'

ERROR: Logfile of failure stored in: /root/yocto/poky/build/tmp/work/qemux86_64-poky-linux/base-files/3.0.14/temp/log.do_package.13826
ERROR: Task (/root/yocto/poky/meta/recipes-core/base-files/base-files_3.0.14.bb:do_package) failed with exit code '1'
ERROR: initscripts-1.0-r0 do_package: Error executing a python function in exec_func_python() autogenerated:

The stack trace of python calls that resulted in this exception/failure was:
File: 'exec_func_python() autogenerated', lineno: 2, function: <module>
0001:
*** 0002:sstate_task_postfunc(d)
0003:
File: '/root/yocto/poky/meta/classes-global/sstate.bbclass', lineno: 795, function: sstate_task_postfunc
0791:
0792: omask = os.umask(0o002)
0793: if omask != 0o002:
0794: bb.note("Using umask 0o002 (not %0o) for sstate packaging" % omask)
*** 0795: sstate_package(shared_state, d)
0796: os.umask(omask)
0797:
0798: sstateinst = d.getVar("SSTATE_INSTDIR")
0799: d.setVar('SSTATE_FIXMEDIR', shared_state['fixmedir'])
File: '/root/yocto/poky/meta/classes-global/sstate.bbclass', lineno: 692, function: sstate_package
0688: if sharedworkdir in plain:
0689: pdir = plain.replace(sharedworkdir, sstatebuild)
0690: bb.utils.mkdirhier(plain)
0691: bb.utils.mkdirhier(pdir)
*** 0692: bb.utils.rename(plain, pdir)
0693: if fixtime:
0694: fixtimestamp(pdir, "")
0695: for walkroot, dirs, files in os.walk(pdir):
0696: for file in files + dirs:
File: '/root/yocto/poky/bitbake/lib/bb/utils.py', lineno: 1781, function: rename
1777: if err.errno == 18:
1778: # Invalid cross-device link error
1779: shutil.move(src, dst)
1780: else:
*** 1781: raise err
1782:
1783:@contextmanager
1784:def environment(**envvars):
1785: """
File: '/root/yocto/poky/bitbake/lib/bb/utils.py', lineno: 1775, function: rename
1771:# Wrapper around os.rename which can handle cross device problems
1772:# e.g. from container filesystems
1773:def rename(src, dst):
1774: try:
*** 1775: os.rename(src, dst)
1776: except OSError as err:
1777: if err.errno == 18:
1778: # Invalid cross-device link error
1779: shutil.move(src, dst)
Exception: PermissionError: [Errno 13] Permission denied: '/root/yocto/poky/build/tmp/work/core2-64-poky-linux/initscripts/1.0/package' -> '/root/yocto/poky/build/tmp/work/core2-64-poky-linux/initscripts/1.0/sstate-build-package//package'

ERROR: Logfile of failure stored in: /root/yocto/poky/build/tmp/work/core2-64-poky-linux/initscripts/1.0/temp/log.do_package.13827
ERROR: Task (/root/yocto/poky/meta/recipes-core/initscripts/initscripts_1.0.bb:do_package) failed with exit code '1'
ERROR: ca-certificates-20240203-r0 do_package: Error executing a python function in exec_func_python() autogenerated:

The stack trace of python calls that resulted in this exception/failure was:
File: 'exec_func_python() autogenerated', lineno: 2, function: <module>
0001:
*** 0002:sstate_task_postfunc(d)
0003:
File: '/root/yocto/poky/meta/classes-global/sstate.bbclass', lineno: 795, function: sstate_task_postfunc
0791:
0792: omask = os.umask(0o002)
0793: if omask != 0o002:
0794: bb.note("Using umask 0o002 (not %0o) for sstate packaging" % omask)
*** 0795: sstate_package(shared_state, d)
0796: os.umask(omask)
0797:
0798: sstateinst = d.getVar("SSTATE_INSTDIR")
0799: d.setVar('SSTATE_FIXMEDIR', shared_state['fixmedir'])
File: '/root/yocto/poky/meta/classes-global/sstate.bbclass', lineno: 692, function: sstate_package
0688: if sharedworkdir in plain:
0689: pdir = plain.replace(sharedworkdir, sstatebuild)
0690: bb.utils.mkdirhier(plain)
0691: bb.utils.mkdirhier(pdir)
*** 0692: bb.utils.rename(plain, pdir)
0693: if fixtime:
0694: fixtimestamp(pdir, "")
0695: for walkroot, dirs, files in os.walk(pdir):
0696: for file in files + dirs:
File: '/root/yocto/poky/bitbake/lib/bb/utils.py', lineno: 1781, function: rename
1777: if err.errno == 18:
1778: # Invalid cross-device link error
1779: shutil.move(src, dst)
1780: else:
*** 1781: raise err
1782:
1783:@contextmanager
1784:def environment(**envvars):
1785: """
File: '/root/yocto/poky/bitbake/lib/bb/utils.py', lineno: 1775, function: rename
1771:# Wrapper around os.rename which can handle cross device problems
1772:# e.g. from container filesystems
1773:def rename(src, dst):
1774: try:
*** 1775: os.rename(src, dst)
1776: except OSError as err:
1777: if err.errno == 18:
1778: # Invalid cross-device link error
1779: shutil.move(src, dst)
Exception: PermissionError: [Errno 13] Permission denied: '/root/yocto/poky/build/tmp/work/all-poky-linux/ca-certificates/20240203/package' -> '/root/yocto/poky/build/tmp/work/all-poky-linux/ca-certificates/20240203/sstate-build-package//package'

ERROR: Logfile of failure stored in: /root/yocto/poky/build/tmp/work/all-poky-linux/ca-certificates/20240203/temp/log.do_package.14556
ERROR: Task (/root/yocto/poky/meta/recipes-support/ca-certificates/ca-certificates_20240203.bb:do_package) failed with exit code '1'
ERROR: linux-libc-headers-6.10-r0 do_package: Error executing a python function in exec_func_python() autogenerated:

The stack trace of python calls that resulted in this exception/failure was:
File: 'exec_func_python() autogenerated', lineno: 2, function: <module>
0001:
*** 0002:sstate_task_postfunc(d)
0003:
File: '/root/yocto/poky/meta/classes-global/sstate.bbclass', lineno: 795, function: sstate_task_postfunc
0791:
0792: omask = os.umask(0o002)
0793: if omask != 0o002:
0794: bb.note("Using umask 0o002 (not %0o) for sstate packaging" % omask)
*** 0795: sstate_package(shared_state, d)
0796: os.umask(omask)
0797:
0798: sstateinst = d.getVar("SSTATE_INSTDIR")
0799: d.setVar('SSTATE_FIXMEDIR', shared_state['fixmedir'])
File: '/root/yocto/poky/meta/classes-global/sstate.bbclass', lineno: 692, function: sstate_package
0688: if sharedworkdir in plain:
0689: pdir = plain.replace(sharedworkdir, sstatebuild)
0690: bb.utils.mkdirhier(plain)
0691: bb.utils.mkdirhier(pdir)
*** 0692: bb.utils.rename(plain, pdir)
0693: if fixtime:
0694: fixtimestamp(pdir, "")
0695: for walkroot, dirs, files in os.walk(pdir):
0696: for file in files + dirs:
File: '/root/yocto/poky/bitbake/lib/bb/utils.py', lineno: 1781, function: rename
1777: if err.errno == 18:
1778: # Invalid cross-device link error
1779: shutil.move(src, dst)
1780: else:
*** 1781: raise err
1782:
1783:@contextmanager
1784:def environment(**envvars):
1785: """
File: '/root/yocto/poky/bitbake/lib/bb/utils.py', lineno: 1775, function: rename
1771:# Wrapper around os.rename which can handle cross device problems
1772:# e.g. from container filesystems
1773:def rename(src, dst):
1774: try:
*** 1775: os.rename(src, dst)
1776: except OSError as err:
1777: if err.errno == 18:
1778: # Invalid cross-device link error
1779: shutil.move(src, dst)
Exception: PermissionError: [Errno 13] Permission denied: '/root/yocto/poky/build/tmp/work/core2-64-poky-linux/linux-libc-headers/6.10/package' -> '/root/yocto/poky/build/tmp/work/core2-64-poky-linux/linux-libc-headers/6.10/sstate-build-package//package'

ERROR: Logfile of failure stored in: /root/yocto/poky/build/tmp/work/core2-64-poky-linux/linux-libc-headers/6.10/temp/log.do_package.13822

I literally have no ideas about this problem, the forums I've already explored cannot help me. What can be done with it?

I've tried do 'chmod' to the project directory, add some mirrors and hash servers, as follow the guides, but it gives a result none.


Solution

  • Well, I have built it somehow. I hope my advices will be helpful as I've seen a lot of people with pretty same troubles.

    1. If you use wsl just like me update it to wsl 2

    Follow to Katu's advice I created a new user, tried to bitbake the image and got a new error I've never seen: OpenEmbedded doesn't work under wslv1, please upgrade to wslv2 if you want to run builds on windows. You can find some guides, it's not hard, but individually, for example I was compelled to reinstall my Ubuntu

    2. Create a new user

    adduser <yourusername>
    usermod -aG sudo <yourusername>
    sudo - <yourusername>
    

    3. Check your memory and sources

    It may be not enought memory and sources of your machine. When the build falls type free -h to see available memory. If swap is zero then you should increase it by creating a swap file:

    sudo fallocate -l 8G /swapfile #for ex
    sudo chmod 600 /swapfile
    sudo mkswap /swapfile
    sudo swapon /swapfile
    echo '/swapfile none swap sw 0 0' | sudo tee -a /etc/fstab #do not sure about this step
    

    Also you can set lesser value of BB_NUMBER_THREADS and PARALLEL_MAKE in /build/conf/local.conf and use less aggressive processor optimisation like O2: CXXFLAGS="-O2" bitbake <target>

    4. Build separately

    There are very large and expensive tasks that can load your system off. In this case you should know which task caused the fall (in my expirience it's often something like do_compile), then find the exact recipe (using bitbake-layers show-recipes) was doing by the task and set it as a simple target for bitbake. In my case there was a problem with llvm-native, so I did bitbake llvm-native. Before this you can make a clean set: bitbake -c cleanall llvm-native to be sure you have right llvm-native files. This action may be requested several times, as many as large tasks fall.

    I hope it would be helpful for those who is beginner in this stuff.

    P.S. Also set the mirror in /build/conf/local.conf:

    SSTATE_MIRRORS ?= "file://.* http://sstate.yoctoproject.org/all/PATH;downloadfilename=PATH"
    

    and beware of the Yocto version called Scarthgap: till the spring some layers like meta-python are not compatible with it; use another version of Yocto or find a fitting branch of the layer you need.