Yocto: Common Yocto Build Errors

From Compulab Mediawiki
Revision as of 14:48, 28 August 2023 by Igor (talk | contribs) (Created page with " == Initial Build Times Can be Significant == Long initial build times are unfortunately unavoidable due to a large number of packages initially built from scratch for a fully...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Initial Build Times Can be Significant

Long initial build times are unfortunately unavoidable due to a large number of packages initially built from scratch for a fully functioning Linux system.
Be prepared for several hours of build time for headless Linux and up to several days of build time for full multimedia Linux with Chromium.
Once that initial build is completed, however, the shared-state (sstate) cache mechanism Yocto Project uses keeps the system from rebuilding packages that have not been “touched” since the last build.
The sstate mechanism significantly reduces the times for successive builds.

Hardware resources configuration

Yocto build works in threads. The number of threads is a function of the host system CPU and RAM memory.
Please note each thread require a dedicated amount of 3-4 Gb of RAM. It means the minimum memory for 1 thread build is 4 GB and the adequate amount of RAM memory for 8 thread build is 32 GB.
You can adjust the number of threads in the configuration file parameter BB_NUMBER_THREADS. As usual “PARALLEL_MAKE” parameter is equal to the number of threads.

Disk space requirements

Yocto build requires a lot of disk space since it is fetching all the resources from the repositories.
Yocto build can require from 50 GB for headless Linux up to 500 GB for full multimedia build with Chromium.
It’s advised to regularly monitor disk usage during the build process. Configured and available swap space during the build can help the system to continue working by utilizing disk space as virtual memory and prevent crashes or out-of-memory errors.
Once you run the BitBake utility, there are no warnings about low disk space in advance, the build just fails at certain times with specific messages:


  • "No space left on device": This is a general error. It can occur at different stages of the build process when temporary files or intermediate artifacts are being created.
  • "Error: failed to create symbolic link": Symbolic links are often used during the build process to manage files efficiently. Running out of space can cause BitBake to fail when attempting to create symbolic links.
  • "Error: failed to rename file": BitBake may encounter issues when renaming files during the build process, especially if there is not enough space to perform the operation.
  • "Error: File too large": This error can occur if the build process generates large files that exceed the available disk space.
  • "Error: could not extend file": When BitBake tries to extend a file (e.g., log files or intermediate build artifacts), it may fail if there is insufficient space to accommodate the extension.
  • "Error: unable to open file for writing": BitBake requires space to write and update various files during the build. Running out of space can cause BitBake to be unable to open files for writing.
  • "Error: Could not unpack": This error can occur if BitBake is unable to extract or unpack source code or package files due to insufficient disk space.
  • "Error: failed to copy file": During the build process, BitBake may encounter issues when copying files from one location to another, particularly when the destination location has limited space.
  • "Error: failed to remove directory": Cleaning up temporary directories or building artifacts may fail if there is not enough space to remove directories.
  • “Error: Worker process (N#) exited unexpectedly, shutting down...”
  • “Fatal error: Killed signal terminated program”
  • “Compilation terminated”.

Hardware stress

Yocto build requires a lot of system resources. Be prepared all the CPU cores will work with about 100% load for a long time (from hours to days) and take care to provide sufficient system cooling to prevent overheating.
Be prepared that all the available RAM memory will be used by the Yocto build and the system can be not responsive to the other tasks during the build.
Used RAM memory can be limited by BB_MEMORY_THRESHOLD parameter of the BitBake.
Once the Yocto build runs in the Docker container, there are Docker settings to limit the number of cores and RAM memory for specific containers.

Software compatibility

Yocto build requires a certain host OS, a specific Python version, and utilities installed. We strongly suggest running the Yocto build in the Docker containers prepared and tuned by CompuLab. (link)