Skip to main content
Visitor II
Jul 8, 2026 1:14 PM UTC
Solved

Error on SDK build for stm32mp21-disco for scarthgap (and possibly others)

https://github.com/STMicroelectronics/meta-st-stm32mp/blob/scarthgap/recipes-bsp/trusted-firmware-m/tf-m-stm32mp.inc#L263 and the following cp commands preserve the ownership of the file which is a problem for yocto.

When I build the sdk, I am getting the following error:

Exception: Exception: KeyError: 'getpwuid(): uid not found: <my-uid-here>'
Path <path-to-build-folder>/tmp/work/x86_64-nativesdk-<distro-sdk-name>-linux/nativesdk-tf-m-stm32mp-scripts/v2.1.4-stm32mp-r2.1/sstate-build-package/package/usr/local/oe-sdk-hardcoded-buildpath/sysroots/x86_64-<distro-sdk-name>-linux/usr/share/tf-m/scripts/wrapper/imgtool/__init__.py is owned by uid <my-uid-here>, gid <my-gid-here>, which doesn't match any user/group on target. This may be due to host contamination.

The fix is quite easy, any instance of “cp -a” needs to be replaced by “cp -a --no-preserve=ownership”. So you copy every other attribute but the ownership.

I fixed it in a .bbappend but that would be nice to fix it in the source code directly: https://github.com/STMicroelectronics/meta-st-stm32mp/blob/scarthgap/recipes-bsp/trusted-firmware-m/tf-m-stm32mp.inc#L263

Bernard PUEL
Bernard PUELBest answer
ST Technical Moderator
Jul 21, 2026 6:50 AM UTC

Final Solution is what you proposed and it will be integrated in next releases (first on v7.0.0).

Thanks a lot for your contribution !!

4 replies

Erwan SZYMANSKI
ST Technical Moderator
Jul 13, 2026 11:58 AM UTC

Hello ​@mathieu.jadin ,
Could you please precise which OpenSTLinux version you build, as well as your host machine OS setup (Ubuntu version ?).

Kind regards,
Erwan.

In order to give better visibility on the answered topics, please click on 'Accept as Solution' on the reply which solved your issue or answered your question.
Bernard PUEL
ST Technical Moderator
Jul 16, 2026 9:36 AM UTC
Bernard PUEL
ST Technical Moderator
Jul 17, 2026 10:05 AM UTC

I could not reproduce on my side the issue but your proposal makes sens anyway (whatever the root cause is) and we may also propose another better (more generic) solution. Our integration team is looking at it ... stay tuned.

Bernard PUEL
Bernard PUELBest answer
ST Technical Moderator
Jul 21, 2026 6:50 AM UTC

Final Solution is what you proposed and it will be integrated in next releases (first on v7.0.0).

Thanks a lot for your contribution !!