Search code examples
embedded-linuxyoctobitbake

How to manage disk space while working with Yocto?


I am using Yocto for one of my project. I know that Yocto needs a good amount of disk space for build activities. And also I am working as non-root user in Ubuntu 20.04. But I often run into space issues during build.

WARNING: The free space of [...]/tmp-glibc (overlay) is running low (0.555GB left)
ERROR: No new tasks can be executed since the disk space monitor action is "STOPTASKS"!
WARNING: The free space of [...]/downloads (overlay) is running low (0.555GB left)
ERROR: No new tasks can be executed since the disk space monitor action is "STOPTASKS"!
WARNING: The free space of [...]/sstate-cache (overlay) is running low (0.555GB left)
ERROR: No new tasks can be executed since the disk space monitor action is "STOPTASKS"!

I have tried deleting $TMPDIR (build/tmp), $SSTATE_DIR (build/sstate-cache), $DL_DIR (build/downloads). But these things didn't help me.

Is there any way to allocate more space to user in Ubuntu? And also what is the best practice for space usage while working with Yocto?

Can anyone please let me know how to resolve this issue?

Your help will be much appreciated.

Thanks in advance.

P.S: I working with Yocto "Honister" release. Please let me know if any info is missing here.


Solution

  • It is known to all Yocto users/developers that it needs lot of space, and it has 3 parts that are huge:

    • TMP
    • DOWNLOADS
    • SSTATE CACHE

    My advice is the following (based on my experience):

    Before starting to work on any Yocto build, create one directory for the three components mentioned above.

    Example:

    mkdir -p /home/user/yocto_shared/{tmp,downloads,sstate-cache}
    

    After that, any build you create you share those with it:

    • In local.conf:
    DL_DIR ?= "/home/user/yocto_shared/downloads"
    SSTATE_DIR ?= "/home/user/yocto_shared/sstate-cache"
    TMPDIR = "/home/user/yocto_shared/tmp"
    

    This will save you lot of space and save you time for new builds.

    Also, you can inherit rm_work which removes tmp output files for every recipe after it bitbake:

    INHERIT += "rm_work"
    

    NOTE

    After you remove something on Ubuntu, specially Yocto tmp, downloads and sstate-cache, do not forget to empty the Trash.