Support read-only filesystem
It is often desirable to make the rootfs of a Yocto based image read-only. However for snapd to work "correctly" there are certain paths that must be read-write. In our approach we use OverlayFS for a few mount points, so that the newly installed snaps and their systemd units get written to a persistent "data" partition transparently.
Is that approach "correct" does UbuntuCore use a similar technique as well ?
I think meta-snappy should have a recipe to enable that as well.
FWIW, we achieved this stuff by editing the /sbin/init symlink to be a full-fledged shell script that in the end does exec /lib/systemd/systemd. The script then creates all the required directories (mkdir) and then mounts both overlays and binds. Most of the paths were inspired by writable-paths file in UbuntuCore.
That approach allowed us to not change initramfs at all. Some environments like RaspberryPi Yocto doesn't use initramfs by default and I believe same is the case of Qemu yocto image.