Bug 15034

Summary: When using USERADDEXTENSION = "useradd-staticids" swtpm recipe cause troubles on parsing
Product: [Build System, Metadata & Runtime] Other YP Layers Reporter: Piotr Łobacz <p.lobacz>
Component: meta-securityAssignee: akuster <akuster808>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: Undecided CC: a.abfattah
Version: 4.1.4   
Target Milestone: ---   
Hardware: x86   
OS: Multiple   
Whiteboard:
OS type for building Yocto: --- Type of Regression: ---
Verified: Documentation change: No (bug/feature does not impact docs)

Description Piotr Łobacz 2023-02-16 12:46:32 UTC
As in subject when I'm having useradd-staticids enabled I'm getting error from swtpm recipe during parsing which looks like that:

ERROR: /work/build/yocto/meta-security/meta-tpm/recipes-tpm/swtpm/swtpm_0.7.1.bb: argument -d/--home-dir: expected one argument

Temporary solution is to remove swtpm from recipes-tpm, which solves the issue.
Comment 1 Ahmed Abdelfattah 2023-06-04 20:49:56 UTC
Hi Piotr

I am trying to investigate  so more info will be helpful from your side, i can suggest from the error message that there is possibly a typo as the error message suggests

A solution could be to pass a home-dir arg (e.g. /)

USERADD_PARAM:${PN} = "--system -g ${TSS_GROUP} --home-dir / \
    --no-create-home  --shell /bin/false ${BPN}"

instead of

USERADD_PARAM:${PN} = "--system -g ${TSS_GROUP} --home-dir  \
    --no-create-home  --shell /bin/false ${BPN}"


but I am not able to reproduce your compilation issue , i built both the security-build-image and security-tpm-image with both of the variants for useradd above



Here is my build configuration 

Build Configuration:
--------------------
BB_VERSION           = "2.2.0"
BUILD_SYS            = "x86_64-linux"
NATIVELSBSTRING      = "ubuntu-22.04"
TARGET_SYS           = "x86_64-poky-linux"
MACHINE              = "qemux86-64"
DISTRO               = "poky"
DISTRO_VERSION       = "4.1.4"
TUNE_FEATURES        = "m64 core2"
TARGET_FPU           = ""
meta                 
meta-poky            
meta-yocto-bsp       = "HEAD:3e95f268ce04b49ba6731fd4bbc53b1693c21963"
meta-oe              = "langdale:cbbaa82238cd60f08c9b9cb58dde59d5f9318c7b"
meta-security        = "langdale:a4562b19126ab655869da6db40e8eff49f84c490"
Comment 2 Piotr Łobacz 2023-06-07 08:04:54 UTC
OK that fixed the problem for me
Comment 3 Piotr Łobacz 2023-06-07 08:07:17 UTC
Question shall I make a patch for that?
Comment 4 Ahmed Abdelfattah 2023-06-08 02:28:52 UTC
I will try to send a patch this weekend.
Comment 5 Ahmed Abdelfattah 2023-06-08 04:34:33 UTC
Actually I have just sent it out.