On Tue, 2022-09-20 at 23:05 +0200, Peter Bergin wrote:
> Hi,
> 
> I'm working on a recipe for libtraceevent 
> (https://git.kernel.org/pub/scm/libs/libtrace/libtraceevent.git) that is 
> needed for newer trace-cmd. I'm confused about an error I get during 
> do_package that I want some help with.
> 
> File: '<snip>/sources/poky/meta/lib/oe/sstatesig.py', lineno: 587, 
> function: process
>       0583:                    else:
>       0584:                        add_perm(stat.S_IXOTH, 'x')
>       0585:
>       0586:                    try:
>   *** 0587:                        update_hash(" %10s" % 
> pwd.getpwuid(s.st_uid).pw_name)
>       0588:                        update_hash(" %10s" % 
> grp.getgrgid(s.st_gid).gr_name)
>       0589:                    except KeyError as e:
>       0590:                        bb.warn("KeyError in %s" % path)
>       0591:                        msg = ("KeyError: %s\nPath %s is 
> owned by uid %d, gid %d, which doesn't match "
> Exception: Exception: KeyError: 'getpwuid(): uid not found: 1000'
> Path ./package/usr/lib/libtraceevent.a is owned by uid 1000, gid 1004, 
> which doesn't match any user/group on target. This may be due to host 
> contamination.
> 
> ERROR: Logfile of failure stored in: 
> <snip>/build/<machine>/tmp/work/cortexa53-crypto-poky-linux/libtraceevent/1.6.2-r0/temp/log.do_package.3574262
> ERROR: Task 
> (<snip>/sources/meta-openembedded/meta-oe/recipes-kernel/trace-cmd/libtraceevent_1.6.2.bb:do_package)
>  
> failed with exit code '1'
> 
> What happens is that during do_package the directory ${WORKDIR}/package 
> is moved to ${WORKDIR}/sstate-build-package and the sstate is 
> calculated. In that sequence in sstatesig.py the owner of the files are 
> checked and used in the hash calculations. By adding debug prints I have 
> seen that in normal case the s.st_uid in the code above evaluates to 0 
> for the files and directories. When looking in the file system my user 
> (1000/1004) owns them but I guess PSEUDO is involved here to fake root? 
> For some reason when checking the libraries build by libtraceevent in 
> ./usr/lib/ the files reports to be owned by uid 1000 and the exection 
> above is raised. It is valid for ./usr/lib/libtraceevent.a and also 
> other files in the ./usr/lib directory. Before the files in ./usr/lib is 
> checked files from /usr/include has been checked for libtraceevent and 
> they have s.st_uid=0.
> 
> I've spent some time trying to understand this. Give up now and try this 
> forum if I can get some ideas. I share the recipe below.

Have you tried putting a:

chown root.root ${D}<files>

into do_install and checking if you force the ownership, whether that
helps?

Cheers,

Richard

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#58106): https://lists.yoctoproject.org/g/yocto/message/58106
Mute This Topic: https://lists.yoctoproject.org/mt/93813735/21656
Group Owner: [email protected]
Unsubscribe: https://lists.yoctoproject.org/g/yocto/unsub 
[[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

Reply via email to