containers / composefs

a file system for mounting container images
GNU General Public License v2.0
421 stars 29 forks source link

ostree integration: erofs mount missing? #264

Closed ldts closed 5 months ago

ldts commented 5 months ago

I recently integrated composefs with OStree in our meta-lmp releases at Foundries.io; this is still work in progress in a private repository until we do more verifications but very likely to be released to all the platforms that we support in a couple of months

root@intel-corei7-64:/# findmnt /
TARGET SOURCE  FSTYPE  OPTIONS
/      overlay overlay ro,relatime,lowerdir=/run/ostree/.private/cfsroot-lower::/sysroot/ostree/repo/objects,redirect_dir=on,metacopy=on

root@intel-corei7-64:/# cat /proc/cmdline 
initrd=\ostree\lmp-8c283ddf8b305aa9ebff637f21d57d5cef8887bd99a37f986741c978121ea6bf\initramfs-6.6.21-lmp-standard.img console=ttyS0,115200 root=LABEL=otaroot rootfstype=ext4 ostree=/ostree/boot.1/lmp/8c283ddf8b305aa9ebff637f21d57d5cef8887bd99a37f986741c978121ea6bf/0

root@intel-corei7-64:/# mount | grep overlay  
overlay on / type overlay (ro,relatime,lowerdir=/run/ostree/.private/cfsroot-lower::/sysroot/ostree/repo/objects,redirect_dir=on,metacopy=on)

root@intel-corei7-64:/# mount | grep ero 

One thing I am missing is where the erofs mount is happening. Is this not visible as a mounted partition somewhere?

cgwalters commented 5 months ago

The mount is happening as part of ostree-prepare-root.service from ostree, which just calls into the composefs libraries to do the mount.

The answer to your question (btw, this seems better as a discussion e.g.) is that the erofs mount is unmounted from the global namespace here: https://github.com/containers/composefs/blob/fc9a526d921c2edd68cb66d8a82d4443083ed277/libcomposefs/lcfs-mount.c#L629 because it's an implementation detail. The overlayfs mounted on top holds a reference.

ldts commented 5 months ago

ahh, thanks a lot for the information @cgwalters

cgwalters commented 5 months ago

That said at least for debugging/introspection I could see it being useful to have an option to not unmount the erofs and leave it mounted somewhere. Or maybe it's even possible to somehow get access to the hidden mount from userspace, but AFAIK it's not currently.