ROOTFS_POSTPROCESS_COMMAND not working

Hi

I am trying to some modification in the rootfs by using ROOTFS_POSTPROCESS_COMMAND but it is failing.

Here is my recipe.

SECTION = "User"
SUMMARY = "Add new user to the image"
LICENSE = "CLOSED"

IMAGE_INSTALL_append = " sudo"

EXTRA_USERS_PARAMS = "usermod -P blabla root;"

PASSWORD = "blabla_demo_user"
USER = "demo_user"

inherit extrausers

EXTRA_USERS_PARAMS = "\
    useradd -p `openssl passwd ${PASSWORD}` ${USER}; \
    usermod -a -G sudo ${USER}; \
"

# Here we give sudo access to sudo members
update_sudoers(){
    sed -i 's/# %sudo/%sudo/' ${IMAGE_ROOTFS}/etc/sudoers
}

ROOTFS_POSTPROCESS_COMMAND += "update_sudoers;"

But I am getting error "ROOTFS_POSTPROCESS_COMMAND ‘update_sudoers’ not found !!

Any help will highly be appreciated!

Hi

I assume that the code you posted is not a recipe of its own but part of an image recipe, e.g. a recipe which does have the do_rootfs and friends tasks.

That because all three sections IMAGE_INSTALL*, extrausers, ROOTFS_POSTPROCESS_COMMAND make only sense in an image recipe but I do not see that you inherit image directly or indirectly.

If that assumptions is correct I do not see what would make ROOTFS_POSTPROCESS_COMMAND fail. Could you try the following:

  • Adding a space between the closing brace and the opening curly brace:
    update_sudoers() {
  • Running the bitbake command with -e and checking the output for anything strange in the update_sudoers and ROOTFS_POSTPROCESS_COMMAND definitions.
    bitbake your-image-recipe -e > image.txt

Max

Hi

What is the command line you use to build your image?

There is no mentioning of update_sudoers in the textfile. Your definitions must be part of the recipe which creates the image and not have it in a separate recipe. So either add to the image recipe or add it to conf/local.conf.

Max

You have to add the content of the recipe you posted above
either to
a new file angstrom-lxde-image.bbappend
or to
angstrom-lxde-image.bb
or to
conf/local.conf

Hi Max,

I am building the Tezi image from the source. The tag I am using is “Colibri-iMX7_LXDE-Image_2.8b6.184-20190401” . This recipe is part of our customization. Does this clarify your doubts?

I have added a space before the curly bracket. Also, I have noticed that the recipe does not add sudo command in the rootfs. Neither it adds the extra user.

Here is the build log link text

@max.tx

I use the following command

bitbake angstrom-lxde-image

Hi @max.tx

Thanks for your reply. I have already added this recipe to my local.conf in the “IMAGE_INSTALL_append” section. Isn’t this correct ? My recipe name is “add-custom-user.bb” .And I have added this recipe as follows.
But it does not have any effect.

IMAGE_INSTALL_append= "  add-custom-user "

Also I forgot to tell you that after adding the space before curly bracket in function name, the error was gone but still it seems that the "ROOTFS_POSTPROCESS_COMMAND ’ does not apply my function, ‘update_sudoers’

This is actually wrong.

The content of add-custom-user must be part of the image recipe, not a recipe of its own.

Max

@max.tx

Thanks a lot . I changed the recipe as image recipe and it worked.
You are awesome !!

BR

You are welcome. Thanks for the feedback.