Unable to mount file filesystem as read only

I have enabled read only feature in local.conf file
by adding below feature
IMAGE_FEATURES = “read-only-rootfs”
then i start building image with
bitbake angstrom-lxde-image,
but the building ended with errors.

can anyone please suggest how to build correctly for read only root file system ??

The recommended way is to add read-only-rootfs to EXTRA_IMAGE_FEATURES, e.g.

EXTRA_IMAGE_FEATURES = "debug-tweaks package-management read-only-rootfs"

Can you retry with this setting? If build fails again, can you post more information? Which BSP version are you exactly using, what is your build host distribution and the log of the error.

stefan thanks for reply.

Can you retry with this setting? If build fails again, can you post more information?
You mean can start new build image with above feature ??
And any extra stuff has to be added (to bblayers,etc…) or only EXTRA_IMAGE_FEATURES = “debug-tweaks package-management read-only-rootfs” is enough for read only image ??

Our default conf/local.conf file already has EXTRA_IMAGE_FEATURES, the first two entires should be there by default:

EXTRA_IMAGE_FEATURES = "debug-tweaks package-management"

I recommend not edition too much at once, just step by step. So as a first step, adding read-only-rootfs to that list and rebuilding.

We verify read-only-rootfs builds from time to time, it should work, but in case you encounter an issue, please post the complete output.

The regular LXDE image is not really meant to be used as a read-only image. This is more like a desktop image which requires the rootfs to be writable. I recommend to use console-tdx-image and add missing packages using IMAGE_INSTALL_append in case needed.

That said, you can build an angstrom-lxde-image image with 2.7b5. There seem to be three packages which do not support read-only rootfs installation:

ERROR: angstrom-lxde-image-2.7b5-r0 do_rootfs: The following packages could not be configured offline and rootfs is read-only: ['angstrom-libc-fixup-hack', 'gpio-tool', 'lxde-common']
ERROR: angstrom-lxde-image-2.7b5-r0 do_rootfs: Function failed: do_rootfs
ERROR: Logfile of failure stored in: /build/ags/oe-core_2.7/build/tmp-glibc/work/apalis_imx6-angstrom-linux-gnueabi/angstrom-lxde-image/2.7b5-r0/temp/log.do_rootfs.61693
ERROR: Task (/build/ags/oe-core_2.7/build/../layers/meta-toradex-demos/recipes-images/images/angstrom-lxde-image.bb:do_rootfs) failed with exit code '1'

The Toradex GPIO tool is often not required on production images, it can be remove by using IMAGE_INSTALL_remove in conf/local.conf:

 IMAGE_INSTALL_remove = " gpio-tool"

So is the libc hack usually not required. It can be remove by using DISTRO_EXTRA_RDEPENDS_remove in conf/local.conf:

DISTRO_EXTRA_RDEPENDS_remove = " angstrom-libc-fixup-hack"

The LXDE common can be be fixed by replacing exit 1 with exit 0 in meta-toradex-demos/recipes-lxde/lxde-common/lxde-common_%.bbappend.

Thank you,

Our requirement is LXDE Desktop image with read only rootfs.
if we want to write something to directories(Or files) we will remount file system as read write.
after writing finishes,we will remount it to read only again.

So
we are going to build again angstrom-lxde-image and we have removed ‘angstrom-libc-fixup-hack’, ‘gpio-tool’, ‘lxde-common’.

below errors are occurred along with above errors.
we are unable to fix these error.

ERROR: When reparsing /home/shiva/oe-core/build/…/layers/meta-toradex-demos/recipes-images/images/angstrom-lxde-image.bb.do_image, the basehash value changed from 021b41f9f33f493b71d5ff5cb16a6fd5 to 3c3c901cc9eed3d418dd60e995aa061e. The metadata is not deterministic and this needs to be fixed.

ERROR: When reparsing /home/shiva/oe-core/build/…/layers/meta-toradex-demos/recipes-images/images/angstrom-lxde-image.bb.do_image_teziimg, the basehash value changed from f15e6c23a3f44625e65b57bd891b7c78 to d9bc41a09dd869c222a91e1e57c260f6. The metadata is not deterministic and this needs to be fixed.

ERROR: When reparsing /home/shiva/oe-core/build/…/layers/meta-toradex-demos/recipes-images/images/angstrom-lxde-image.bb.do_image, the basehash value changed from 021b41f9f33f493b71d5ff5cb16a6fd5 to 3c3c901cc9eed3d418dd60e995aa061e. The metadata is not deterministic and this needs to be fixed.

ERROR: When reparsing /home/shiva/oe-core/build/…/layers/meta-toradex-demos/recipes-images/images/angstrom-lxde-image.bb.do_image_teziimg, the basehash value changed from f15e6c23a3f44625e65b57bd891b7c78 to d9bc41a09dd869c222a91e1e57c260f6. The metadata is not deterministic and this needs to be fixed

How can i fix these errors on next (new) build ??
If i remove angstrom-libc-fixup-hack,gpio-tool,lxde-common these, is there any effect to image build process(like build fails) ??

The build should succeed despite those errors.

Ok.
i will start build now.

one more question is
How can check post_initscripts all are succeded or not?
Becasue in Yocto development manual they have mentioned
Yocto Project Development Manual .

so for read only rootfs is there any post initscripts requried?

thanks
siva

This is actually exactly what you encountered: The 3 packages above used to had Post-Installation scripts which were not prepared for read-only rootfs. So bitbake really fails in that case. With the three fixed/worked-around, all others seem to be ok.

so
now no need to add any post installation scripts for read only rootfs right ?

i have removed above three packages.
so can i continue with build process ??

Yes, build process should go through.

Stefan,
For example while building, because of one package if build fails, at that movement can i remove that particular package from the local.conf file ?

if above assumption is correct, is it possible to resume the build process(from last fail point)?
Or
I have to do entire rebuild(from Initial) ??

hi siva, you should find out why the build is failing. If you add or remove a packet, then it is better to a clean build.

jaski,

We build image, but it appered as normal image
read-only feature was not enabled in that.

we have set the parameter in uboot,but still it is not enaled.
sdargs=ip=off root=/dev/mmcblk1p2 rw rootfstype=ext4 rootwait
emmcargs=ip=off root=/dev/mmcblk0p2 rw rootfstype=ext4 rootwait

For read-only-rootfs, read_only_rootfs_hook () function is requried to add in /meta/class/image.bbclass??

If you add or remove a packet, then it is better to a clean build.

In general just adding or removing packages does not really require doing a clean build. However if changing fundamental things like distro/image features doing a clean build is recommend to avoid any issues.