Updating files on readonly root with update module?

Hi,

We are using Podman and Quadlet files to start containers with SystemD. Inside those quadlet files are the image tag that the container runs. We are also using a readonly root.

What we’d like to be able to do is update this tag without redeploying a whole filesystem or requiring a reboot - is that possible with update modules?

We toyed with putting the Quadlet files on the /data partition but then they can’t be updated in a root update.

What is the best approach here? :slight_smile:

Hi @chriswiggins,

It’s definitely possible, but I don’t have a definite best practise here right now mainly due to my inexperience with containers.
An elaborate guess would be to use an overlayfs backed on /data, combined with a mechanism which wipes it if the root filesystem brings new content. State scripts or a specialised rootfs update module might be viable routes here. I’ll see if I can dig up some more details.

Greets,
Josef

Thanks @TheYoctoJester - lets ignore the fact that it has to do with containers.

Imagine I just want to update a file, lets call it /usr/share/yocto_is_cool

Can I use mender update modules to update /usr/share/yocto_is_cool if the root is RO?

Hi @chriswiggins,

I couldn’t reach the person whom I know to use overlayfs, sorry. So my explanation will have to suffice at the moment. :frowning:
When the root filesystem is read only, you can’t modify the files there, also not through an Update Module. Usually you want the filesystem to be unmodified, because this is a requirement for delta updates.
What you can do is to use overlayfs (see https://elinux.org/images/6/6c/OverlayFS_in_Yocto._Vyacheslav_Yurkov.pdf), which allows modifications to the root filesystem and stores them at an additional persistent place, like /data. If such a setup is in place, you can modify /usr/share/... through an Update Module. The only additional thing to take into consideration is how and when to reset the overlay storage if a root filesystem upgrade happens.

Hope this helps,
Josef

1 Like

Thanks Josef - good to know that is the approach to take :slight_smile:

1 Like

Just to comment, this is the approach we have taken and it is working well for us. We have overlays for both /etc and /var directories. The overlays are set up by initramfs (/sbin/preinint) which is set as an argument on the kernel command line (init=/sbin/preinit).

1 Like