Bug 16457

Summary: Creating sstate for images breaks
Product: [Build System, Metadata & Runtime] OE-Core Reporter: Denys Dmytriyenko <denis>
Component: coreAssignee: Unassigned <unassigned>
Status: NEW --- QA Contact:
Severity: normal    
Priority: Undecided CC: meta.mr.watcher, meta.watcher
Version: unspecified   
Target Milestone: 0.0.0   
Hardware: ARM   
OS: Multiple   
Whiteboard:
OS type for building Yocto: --- Type of Regression: ---
Verified: Documentation change: No (bug/feature does not impact docs)

Description Denys Dmytriyenko 2026-10-17 17:44:19 UTC
Force creating sstate for images by adding to local.conf:

SSTATE_SKIP_CREATION:task-image-complete:forcevariable = "0"
SSTATE_SKIP_CREATION:task-populate-sdk:forcevariable = "0"
SSTATE_SKIP_CREATION:task-populate-sdk-ext:forcevariable = "0"
SSTATE_SKIP_CREATION:task-create-image-spdx:forcevariable = "0"
SSTATE_SKIP_CREATION:task-create-image-sbom-spdx:forcevariable = "0"

$ bitbake core-image-minimal

ERROR: 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_report_unihash(d)
     0003:
File: '/OE/core-master/meta/classes-global/sstate.bbclass', lineno: 920, function: sstate_report_unihash
     0916:    report_unihash = getattr(bb.parse.siggen, 'report_unihash', None)
     0917:
     0918:    if report_unihash:
     0919:        ss = sstate_state_fromvars(d)
 *** 0920:        report_unihash(os.getcwd(), ss['task'], d)
     0921:}
     0922:
     0923:#
     0924:# Shell function to decompress and prepare a package for installation
File: '/OE/core-master/bitbake/lib/bb/siggen.py', lineno: 790, function: report_unihash
     0786:
     0787:            if "." in self.method:
     0788:                (module, method) = self.method.rsplit('.', 1)
     0789:                locs['method'] = getattr(importlib.import_module(module), method)
 *** 0790:                outhash = bb.utils.better_eval('method(path, sigfile, task, d)', locs)
     0791:            else:
     0792:                outhash = bb.utils.better_eval(self.method + '(path, sigfile, task, d)', locs)
     0793:
     0794:            try:
File: '/OE/core-master/bitbake/lib/bb/utils.py', lineno: 489, function: better_eval
     0485:    if extraglobals:
     0486:        ctx = copy.copy(ctx)
     0487:        for g in extraglobals:
     0488:            ctx[g] = extraglobals[g]
 *** 0489:    return eval(source, ctx, locals)
     0490:
     0491:@contextmanager
     0492:def fileslocked(files, *args, **kwargs):
     0493:    """Context manager for locking and unlocking file locks. Uses
File: '<string>', lineno: 1, function: <module>
  File "<string>", line 1, in <module>

File: '/OE/core-master/meta/lib/oe/sstatesig.py', lineno: 722, function: OEOuthashBasic
     0718:                update_hash("\n")
     0719:
     0720:            # Process this directory and all its child files
     0721:            if include_root or root != ".":
 *** 0722:                process(root)
     0723:            for f in files:
     0724:                if f == 'fixmepath':
     0725:                    continue
     0726:                process(os.path.join(root, f))
File: '/OE/core-master/meta/lib/oe/sstatesig.py', lineno: 661, function: process
     0657:                    except KeyError as e:
     0658:                        msg = ("KeyError: %s\nPath %s is owned by uid %d, gid %d, which doesn't match "
     0659:                            "any user/group on target. This may be due to host contamination." %
     0660:                            (e, os.path.abspath(path), s.st_uid, s.st_gid))
 *** 0661:                        raise Exception(msg).with_traceback(e.__traceback__)
     0662:
     0663:                if include_timestamps:
     0664:                    # Need to clamp to SOURCE_DATE_EPOCH
     0665:                    if s.st_mtime > source_date_epoch:
File: '/OE/core-master/meta/lib/oe/sstatesig.py', lineno: 655, function: process
     0651:                    else:
     0652:                        add_perm(stat.S_IXOTH, 'x')
     0653:
     0654:                    try:
 *** 0655:                        update_hash(" %10s" % pwd.getpwuid(s.st_uid).pw_name)
     0656:                        update_hash(" %10s" % grp.getgrgid(s.st_gid).gr_name)
     0657:                    except KeyError as e:
     0658:                        msg = ("KeyError: %s\nPath %s is owned by uid %d, gid %d, which doesn't match "
     0659:                            "any user/group on target. This may be due to host contamination." %
Exception: Exception: KeyError: 'getpwuid(): uid not found: 1000'
Path /OE/core-master/build/tmp/work/qemuarm-oe-linux-gnueabi/core-image-minimal/1.0/sstate-build-image_complete is owned by uid 1000, gid 1000, which doesn't match any user/group on target. This may be due to host contamination.
Comment 1 Denys Dmytriyenko 2026-10-17 17:48:51 UTC
BTW, this is with the default OEEquivHash:

BB_HASHSERVE = "auto"
BB_SIGNATURE_HANDLER = "OEEquivHash"

When switching to OEBasicHash, the sstate gets created fine, but the image always gets re-generated with do_rootfs() even when it exists in sstate.