Bitbake recipe for adding new user

Hi,

We have a requirement where in we have to create a new user(non-root) on FX30S and run our application with the newly created user permission.

We have tried the bb recipe example from the following link.
https://git.yoctoproject.org/cgit/cgit.cgi/poky/tree/meta-skeleton/recipes-skeleton/useradd/useradd-example.bb?h=morty

We are able to compile the image and also able to see the files “yocto/build_bin/tmp/work/armv7a-vfp-neon-poky-linux-gnueabi/recipe/0.1-r1/packages”

We expected a user to be added to /etc/passwd and /etc/group files and a new folder /home/“username” to be created.
How ever we do not see any new users created. Attached a sample file we have used.

useradd_bb.txt (2.6 KB)
Please let us know if there are any additional steps that have to be executed to create a new user through image.

Thanks,
Gowtham

Hi Gowtham,
I recommend you add your recipe to a custom layer.

You can debug your recipe by examining the logs. They should be located in a folder something like:
“yocto/build_bin/tmp/work/armv7a-vfp-neon-poky-linux-gnueabi/recipe/0.1-r1/temp" based on what you wrote above.

You can also check the new user files that are generated in the target’s root file system:
““yocto/build_bin/tmp/work/swi_mdm9x28_wp-poky-linux-gnueabi/mdm9x28-image-minimal/1.0-r0.0/rootfs”

BR,
Chris

Hi chris,

Thanks for your reply.

we are able to see the files in “yocto/build_bin/tmp/work/swi_mdm9x28_wp-poky-linux-gnueabi/mdm9x28-image-minimal/1.0-r0.0/rootfs". We are able to see the user added in “/etc/passwd” and “/etc/group” in the above folder and on the board after flashing the image.

Also We are able to see the home directory for the user created i.e. “/home/user1” in “yocto/build_bin/tmp/work/swi_mdm9x28_wp-poky-linux-gnueabi/mdm9x28-image-minimal/1.0-r0.0/rootfs". But we are not able to see the home directory for the user in “/home” after flashing the image onto the board.

Should we add any more steps to the recipe for the home directory to be created in the FX30 board after flashing the image.

Thanks,
Gowtham Baddula