Change file ownership in bitbake recipe

Hi,
I want to change the ownership of some files in my bitbake recipe (see below). When i look into the built .ipk package the corresponding file is owned by ‘www-data’. However after flashing the whole image the owner is root again. How can i change file permissions correctly? Thanks in advance.

[...]
inherit useradd
USERADD_PACKAGES = "${PN}"
GROUPADD_PARAM_${PN} = "--system www-data"
USERADD_PARAM_${PN} = "--system -U www-data"

do_install_append() {
	install -d ${D}/${localstatedir}/log/lighttpd
	chown -R www-data:www-data ${D}/${localstatedir}/log/lighttpd
}
[...]

hi @qojote

Did you try adding users to your recipe as described here?
Please also have a look here to debug the root cause of the issue.

Thanks and best regards,
Jaski

Hi,
I have added the user via “EXTRA_USERS_PARAMS” in my image recipe, however this does not solve my issue. When i reinstall the corresponding .ipk package at the running system everything is fine, the permissions are set and during installation the outputs says that the user already exist which is to be expected.

Ok, this means you have a workaround. Did you try to debug the root cause as described in the link above?

Its not a good workaround as several packages need to change permissions. It was working with older BSPs and i do not see the reason why it is not working right now. I have not found the time to dive in deeper into this problem…

hi @qojote.
Perfect that it works. Thanks for the feedback.

It turned out that the user rights were successfully set with the code snippet above (“useradd”). The problem was within our custom updater. Thanks for your help.

Hi

  1. USERADD is also used for nfs-utils-client. What is the user and group for /var/lib/nfs/statd on your module?
  2. What got written to the buildhistory during package creation?
    ‘build/buildhistory/packages/{arch}/{recipe}/{package}/files-in-package.txt’
  3. What got written to the buildhistory during image creation?
    ‘build/buildhistory/images/apalis_imx6/glibc/{image-name}/files-in-image.txt’
  4. What deployment do you use, ‘Toradex Easy Installer’ or the legacy update procedure?
  5. Did you do a ‘bitbake -c cleansstate {your recipe}; bitbake {image}’ and the effect stayed?
  6. On the module, what is the output of:
    grep www-data /etc/passwd /etc/group

Max