Re: overlayfs-etc on top of dm-verity?

Michael Opdenacker <[email protected]> Thu, 26 Mar 2026 09:56:21 +0000 (UTC)
Newsgroups org.yoctoproject.lists.yocto
Message-ID <[email protected]>
Greetings,

On 3/25/26 10:20 PM, Michael Opdenacker wrote:
> Hi Slava and community,
>
> Do you know if overlayfs and in particular our overlayfs-etc class 
> works when /etc is on a dm-verity root filesystem?
>
> Without dm-verity (regular ext4 or erofs root filesystem), everything 
> looks all right:
> # mount | grep overlay
> /data/overlay-etc/upper on /etc type overlay 
> (rw,relatime,lowerdir=/etc,upperdir=/data/overlay-etc/upper,workdir=/data/overlay-etc/work,uuid=on)
>
> When /etc is on /dev/mapper/rootfs (dm-verity), everything seems 
> messed up:
> # mount | grep overlay
> overlay on /var/cache type overlay 
> (rw,relatime,lowerdir=/var/cache,upperdir=/var/volatile/cache,workdir=/var/volatile/.cache-work,uuid=on)
> overlay on /var/lib type overlay 
> (rw,relatime,lowerdir=/var/lib,upperdir=/var/volatile/lib,workdir=/var/volatile/.lib-work,uuid=on)
> overlay on /var/spool type overlay 
> (rw,relatime,lowerdir=/var/spool,upperdir=/var/volatile/spool,workdir=/var/volatile/.spool-work,uuid=on)
> overlay on /srv type overlay 
> (rw,relatime,lowerdir=/srv,upperdir=/var/volatile/srv,workdir=/var/volatile/.srv-work,uuid=on)
>
> Systemd may be messing up, as only in this case, it does:
>          Starting Bind mount volatile /var/cache...
>          Starting Bind mount volatile /var/lib...
>          Starting Bind mount volatile /var/spool...
>          Starting Bind mount volatile /srv...
>
> But these bind mounts show up as overlay mounts!
>
> Has anyone already encountered such an issue?

I eventually managed to get /etc mounted as an overlay. It seems that 
/sbin/init was started instead of /sbin/preinit as specified in the 
kernel command line.
I hardcoded the call to /sbin/preinit by customizing 
openembedded-core/meta/recipes-core/initrdscripts/initramfs-framework/finish 
(in a bbappend file, of course).

The code looks right though, I need to understand why this happens.

Another weirdness that remains is these volatile mounts for /var/cache/, 
/var/lib, /var/spool and /srv, which I didn't have with a regular 
read-only root filesystem.
I'll keep you posted.
Cheers
Michael.

-- 
Root Commit
Embedded Linux Training and Consulting
https://rootcommit.com