Skip to main content

overlay_transient

Function overlay_transient 

Source
pub fn overlay_transient(
    base: impl AsFd,
    source: &str,
    mount_attr_flags: Option<MountAttrFlags>,
) -> Result<OwnedFd>
Expand description

Creates a transient overlayfs with the passed-in fd as the lowerdir.

Returns a detached (not yet attached) OwnedFd for the overlay mount. The caller is responsible for attaching it to the filesystem tree.

source is used verbatim as the overlay’s source fsconfig option and appears in /proc/self/mountinfo. For the composefs root, pass "transient:composefs=<digest_hex>" so that composefs_booted() can recover the verity digest from the mount source after switch-root. For non-root transient mounts (e.g. /usr, /var) pass "transient".

The SELinux label on / is fixed after boot by bootc-early-overlay-relabel.service; no initramfs-side xattr write is needed (kernel fs_use_trans tmpfs relabeling at policy-load time would overwrite anything written here).