# Updating files on readonly root with update module?

**URL:** <https://hub.mender.io/t/updating-files-on-readonly-root-with-update-module/6753>\
**Category:** General Discussions\
**Created:** [April 24, 2024, 12:40am UTC](https://hub.mender.io/t/updating-files-on-readonly-root-with-update-module/6753 "2024-04-24T00:40:54Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![chriswiggins](https://yyz2.discourse-cdn.com/flex036/user_avatar/hub.mender.io/chriswiggins/32/2170_2.png) [@chriswiggins](https://hub.mender.io/u/chriswiggins)\
**Post date:** [April 24, 2024, 12:40am UTC](https://hub.mender.io/t/updating-files-on-readonly-root-with-update-module/6753/1 "2024-04-24T00:40:54Z")

</div>

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? 🙂

---

<div class="post-metadata">

**Author:** ![TheYoctoJester](https://yyz2.discourse-cdn.com/flex036/user_avatar/hub.mender.io/theyoctojester/32/1444_2.png) [@TheYoctoJester](https://hub.mender.io/u/TheYoctoJester)\
**Post date:** [April 24, 2024, 7:26pm UTC](https://hub.mender.io/t/updating-files-on-readonly-root-with-update-module/6753/2 "2024-04-24T19:26:21Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![chriswiggins](https://yyz2.discourse-cdn.com/flex036/user_avatar/hub.mender.io/chriswiggins/32/2170_2.png) [@chriswiggins](https://hub.mender.io/u/chriswiggins)\
**Post date:** [April 25, 2024, 10:12pm UTC](https://hub.mender.io/t/updating-files-on-readonly-root-with-update-module/6753/3 "2024-04-25T22:12:39Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![TheYoctoJester](https://yyz2.discourse-cdn.com/flex036/user_avatar/hub.mender.io/theyoctojester/32/1444_2.png) [@TheYoctoJester](https://hub.mender.io/u/TheYoctoJester)\
**Post date:** [April 29, 2024, 2:35pm UTC](https://hub.mender.io/t/updating-files-on-readonly-root-with-update-module/6753/4 "2024-04-29T14:35:35Z")

</div>

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. ☹  
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](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

---

<div class="post-metadata">

**Author:** ![chriswiggins](https://yyz2.discourse-cdn.com/flex036/user_avatar/hub.mender.io/chriswiggins/32/2170_2.png) [@chriswiggins](https://hub.mender.io/u/chriswiggins)\
**Post date:** [April 29, 2024, 9:20pm UTC](https://hub.mender.io/t/updating-files-on-readonly-root-with-update-module/6753/5 "2024-04-29T21:20:14Z")

</div>

Thanks Josef - good to know that is the approach to take 🙂

---

<div class="post-metadata">

**Author:** ![smartin](https://avatars.discourse-cdn.com/v4/letter/s/54ee81/32.png) [@smartin](https://hub.mender.io/u/smartin)\
**Post date:** [May 2, 2024, 11:25pm UTC](https://hub.mender.io/t/updating-files-on-readonly-root-with-update-module/6753/6 "2024-05-02T23:25:28Z")

</div>

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).
