Add an overlayfs on /etc for read-only root filesystems
Get series with b4
b4 am [email protected]Versions newest first
- v1 Latest3 patches 0 repliesNew
Patches in v1 No applies recorded yet
| # | Subject and files | Size | Replies | Applied |
|---|---|---|---|---|
| 1/3 | package/skeleton-init-common: add option to mount an overlayfs on /etcpackage/ package/ system/ | +164 | 0 replies | |
| 2/3 | docs/manual: document the /etc overlayfsdocs/ | +32 | 0 replies | |
| 3/3 | support/testing: add runtime tests for the /etc overlayfsDEVELOPERS support/ support/ | +131 | 0 replies |
Reviews trailers per patch
No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.
Cover letter [Buildroot] [PATCH 0/3] Add an overlayfs on /etc for read-only root filesystems
This series adds BR2_ROOTFS_OVERLAYFS_ETC, which mounts an overlayfs on /etc, with its upper layer on a persistent device, before the init system starts. It works with busybox init, sysvinit and systemd.
It is modeled after the overlayfs-etc image feature of openembedded-core (meta/classes-recipe/overlayfs-etc.bbclass and meta/files/overlayfs-etc-preinit.sh.in), which works the same way, independently of the init system:
- the original init is moved aside, and a pre-init script is installed as /sbin/init;
- at boot, the pre-init mounts the persistent device on a mount point (/data by default), mounts the overlayfs on /etc, with its upper and work directories in <mount point>/overlay-etc/, and optionally exposes the original /etc read-only in <mount point>/overlay-etc/lower;
- it then execs the original init, which starts with a writable /etc.
The pre-init script is adapted from the openembedded-core one, and the options mirror its variables (OVERLAYFS_ETC_DEVICE, _FSTYPE, _MOUNT_OPTIONS, _MOUNT_POINT, _EXPOSE_LOWER). It differs on a few points:
- the original init is moved to /usr/libexec/overlayfs-etc/init rather than renamed to /sbin/init.orig, as busybox selects its applet from the name it is called with;
- the mount point is created at build time, so the pre-init does not need to remount the root filesystem read-write (OVERLAYFS_ETC_CREATE_MOUNT_DIRS);
- the overlayfs options are passed in a single -o, as expected by the busybox mount.
As for the /var overlayfs, the options are in the system menu, and the implementation, including the kernel config fixup enabling overlayfs, is in the skeleton, here skeleton-init-common, as the pre-init does not depend on the init system. Only /etc is handled: /var keeps the existing handling.
The persistent device must exist and be formatted, which is left to the integration. If it cannot be mounted, the system boots with the read-only /etc.
Angelo Compagnucci (3):
package/skeleton-init-common: add option to mount an overlayfs on /etc docs/manual: document the /etc overlayfs
support/testing: add runtime tests for the /etc overlayfs
DEVELOPERS | 1 + docs/manual/configure.adoc | 32 +++++ .../overlayfs-etc-preinit.sh | 39 ++++++ .../skeleton-init-common.mk | 63 +++++++++ .../testing/tests/init/test_overlayfs_etc.py | 128 ++++++++++++++++++ .../linux-no-overlayfs.fragment | 2 + system/Config.in | 62 +++++++++ 7 files changed, 327 insertions(+) create mode 100644 package/skeleton-init-common/overlayfs-etc-preinit.sh create mode 100644 support/testing/tests/init/test_overlayfs_etc.py create mode 100644 support/testing/tests/init/test_overlayfs_etc/linux-no-overlayfs.fragment
Signature · 6 lines
2.34.1 _______________________________________________ buildroot mailing list [email protected] https://lists.buildroot.org/mailman/listinfo/buildroot