简体   繁体   中英

Bitbake not updating user and group entry in /etc/passwd and /etc/group of target rootfs

In my project, I have to introduce a new 'non-root' user. I referred standard yocto recipe model mentioned in below link for creating user and group entry in /etc/passwd and /etc/group files.

https://git.yoctoproject.org/cgit.cgi/poky/tree/meta-skeleton/recipes-skeleton/useradd/useradd-example.bb

I also tried the same way in my recipe file.

Recipe file path : recipes-connectivity/dibbler/dibbler_%.bbappend

FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:"

#dibbler process non-root user
SRC_URI += "file://dibbler-nonroot-changes.patch"

inherit useradd

USERADD_PACKAGES = "${PN}"
GROUPADD_PARAM_${PN} = "--system dibbler"
USERADD_PARAM_${PN} = "--system --gid dibbler --no-user-group \
                       --home /var/lib/dibbler --no-create-home \
                       --shell /bin/false dibbler"

After building the component, entry for user 'dibbler' and group 'dibbler' are not found in the target rootfs which is ' tmp/work/brcm-linux-gnueabi/generic-dev-image/1.0-r0/rootfs/etc/passwd '

But I found the entry present in sysroot path which is 'tmp/sysroots/brcm/etc/passwd' and 'tmp/sysroots/brcm/etc/group'

tmp/sysroots/brcm/etc/group-
tmp/sysroots/brcm/etc/group
dibbler:x:983:

tmp/sysroots/brcm/etc/passwd-
tmp/sysroots/brcm/etc/passwd
dibbler:!:988:983::/var/lib/dibbler:/bin/false

Even I checked logs and run scripts from bitbake tasks like do_install, do_populate_package, ... I didn't get any clue to proceed further.

Bitbake install logs after clean rebuild:

Install outputs from file : tmp/work/cortexa15hf-neon-vfpv4-rdk-linux-gnueabi/dibbler/1.0.1-r0/temp/log.do_install
DEBUG: Executing shell function useradd_sysroot
NOTE: dibbler: Performing groupadd with [--root /home/vre/dmz/build-tch_broadband_93390smwvg2/tmp/sysroots/brcm93390smwvg2 --system dibbler]
NOTE: dibbler: Performing useradd with [--root /home/vre/dmz/build-tch_broadband_93390smwvg2/tmp/sysroots/brcm93390smwvg2 --system --gid dibbler --no-user-group                        --home /var/lib/dibbler --no-create-home                        --shell /bin/false dibbler]
Running groupadd commands...
Running useradd commands...

It would be helpful if anyone points what I missed or anything extraneous/unnecessary.

After analysing the rootfs logs( dev-image/1.0-r0/temp/log.do_rootfs ), found that dibbler is installed as two different packages with the package names as below:

  1. dibbler-client and
  2. dibbler-server.

After changing 'USERADD_PARAM_${PN}' to 'USERADD_PARAM_dibbler-client' , the entries for user 'dibbler' got added in rootfs also.

Below are the changes in bb recipe file:

USERADD_PACKAGES = "dibbler-client"
GROUPADD_PARAM_dibbler-client = "--system dibbler"
USERADD_PARAM_dibbler-client = "--system --gid dibbler --no-user-group \ 
                                --home /var/lib/dibbler --no-create-home \
                                --shell /bin/false dibbler"

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM