On 29/01/2019 17:45, Fabrice D. wrote:
> Hi !
>
> I am stuck with a folder permissions problem, and I hope someone can
> help me :-)
> By default the folder (and files) created on the data persistent
> partition are owned by the root user (and root group)
> I want to set my own user:group to that folder but I am not able to do that.
>
> here my
example.bb file :
>
> |
> inherit useradd deploy
>
> APPLI_USER ?="user"
>
> USERADD_PACKAGES ="${PN}"
> USERADD_PARAM_${PN}=" \
> --system --no-create-home -g ${APPLI_USER} ${APPLI_USER} "
> GROUPADD_PARAM_${PN}="${APPLI_USER}"
>
>
> S ="${WORKDIR}"
>
> do_install(){
> install -d ${D}/opt
> install -m 0500${WORKDIR}/script.sh ${D}$/opt
>
> #set permissions => OK works well at this step
> chown ${APPLI_USER}:${APPLI_USER}-R ${D}/opt
> }
>
> do_deploy(){
>
> # create folder
> install -d -m 775${DEPLOYDIR}/persist/folder
>
> # Not possible to set permissions for user "user" => chown: invalid
> user: ‘user:user’ !
> chown ${APPLI_USER}:${APPLI_USER}-R ${DEPLOYDIR}/persist/folder
>
> }
> addtask do_deploy after do_compile before do_build
> |
>
> and the associated bitabke log :
>
> |
> ERROR: do_deploy:Functionfailed:do_deploy (log file islocated at ...)
> ERROR:Logfileof failure stored in:...
> Logdata follows:
> |DEBUG:Executingpython functionsstate_task_prefunc
> |DEBUG:Removingmanifest:/tmp/deploy/images/imx6-openrexmax/persist/folder/
> |DEBUG:Removingmanifest:/tmp/deploy/images/imx6-openrexmax/persist/
> |DEBUG:Pythonfunctionsstate_task_prefunc finished
> |DEBUG:Executingshell functiondo_deploy
> |chown:invalid user:‘user:user’
> |WARNING:exitcode 1froma shell command.
> |ERROR:Functionfailed:do_deploy (log file islocated at ...)
> |
>
> Is there a way to set the permissions of the folder ?
> I am using mender for yocto ROCKO
I think this is not possible with branches earlier than sumo. The
problem is that poky has a bug that permissions are not preserved in the
deploy stage, which is why that "chown" command is there, to force root
permissions. The whole thing was completely rewritten in sumo, and there
you can make it work, although the method is different [1].
[1]
https://docs.mender.io/1.7/devices/yocto-project/partition-layout#deploying-files-to-the-persistent-data-partition
--
Kristian