#3768·youki

[FEATURE]: support the tmpcopyup mount option (Podman --read-only containers fail)

Author: ItzExoticalCreated Sep 29, 2026Updated Oct 2, 2026

Background

tmpcopyup is a mount option that runc and crun both implement for tmpfs. crun's man page (crun.1.md, "tmpcopyup mount options") describes it: "the path that is shadowed by the tmpfs mount is recursively copied up to the tmpfs itself".

Podman adds it to the tmpfs mounts on /tmp, /var/tmp and /run of every container with a read-only rootfs (--read-only, or readOnlyRootFilesystem: true in podman kube play). From Podman 6.1.2's bundle for podman create --read-only alpine true:

/tmp ['rw', 'rprivate', 'nosuid', 'nodev', 'tmpcopyup']
/run ['rw', 'rprivate', 'nosuid', 'nodev', 'tmpcopyup']
/var/tmp ['rw', 'rprivate', 'nosuid', 'nodev', 'tmpcopyup']

Feature Request

Implement tmpcopyup for tmpfs mounts.

Is the request related to some problem running youki?

Yes. At eb07b60173fca880e4287d5bc0de2580edec2c91, parse_mount() (crates/libcontainer/src/rootfs/utils.rs:92) keeps any option it doesn't know as mount data (:201). mount_into_container() then passes it to fsconfig(FSCONFIG_SET_FLAG, "tmpcopyup") (crates/libcontainer/src/rootfs/mount.rs:718), and tmpfs refuses that with EINVAL. So every read-only Podman container fails:

ERROR libcontainer::rootfs::mount: failed to mount Mount { destination: "/run", typ: Some("tmpfs"), source: Some("tmpfs"), options: Some(["rw", "rprivate", "nosuid", "nodev", "tmpcopyup"]), uid_mappin
ERROR libcontainer::process::init::process: failed to prepare rootfs err=Mount(Syscall(Nix(EINVAL)))
ERROR youki: error in executing command: failed to create container: exec process failed with error failed to prepare rootfs
exit=255

podman --runtime youki run --rm --read-only alpine true fails with failed to prepare rootfs.

The runtime spec (config.md, "Mounts") allows it: "Runtimes MAY also implement custom option strings that are not listed in the table above."

Repro, no Podman needed. Put alpine-minirootfs-3.24.2-x86_64.tar.gz (sha256 c5ca053cfe1d85c5b96dff8b9bc57045f7f184a30ffb6b65776409ca90388677) next to the script and run ./repro.sh <runtime>:

bash
#!/bin/sh
# repro.sh <runtime> [workdir]: a read-only rootfs whose /run holds a directory, a file and a
# symlink, with a tmpfs over /run that asks for "tmpcopyup" (the mount Podman makes for
# --read-only). The container lists /run and writes to it.
set -eu
RT=$1; W=${2:-$(pwd)/work-$RT}
here=$(cd "$(dirname "$0")" && pwd)
rm -rf "$W"; mkdir -p "$W/bundle/rootfs"
tar -xzf "$here/alpine-minirootfs-3.24.2-x86_64.tar.gz" -C "$W/bundle/rootfs" 2>/dev/null
mkdir -p "$W/bundle/rootfs/run/sub"; echo hi > "$W/bundle/rootfs/run/sub/f"
ln -s sub/f "$W/bundle/rootfs/run/l"; chmod 0750 "$W/bundle/rootfs/run/sub"; chmod 0640 "$W/bundle/rootfs/run/sub/f"
cd "$W/bundle"
if [ "$(id -u)" = 0 ]; then "$RT" spec; else "$RT" spec --rootless; fi
python3 - <<'P'
import json
s = json.load(open('config.json'))
s['process']['terminal'] = False
s['root']['readonly'] = True
s['process']['args'] = ['sh', '-c', 'ls -ln /run /run/sub | grep -v "^total"; cat /run/l; touch /run/new && echo writable']
s['mounts'].append({'destination': '/run', 'type': 'tmpfs', 'source': 'tmpfs',
                    'options': ['rw', 'rprivate', 'nosuid', 'nodev', 'tmpcopyup']})
json.dump(s, open('config.json', 'w'), indent=2)
P
"$RT" --root "$W/state" run --bundle "$W/bundle" "repro-$$"

With crun:

/run:
lrwxrwxrwx    1 0        0                5 Sep 28 23:23 l -> sub/f
drwxr-xr-x    2 0        0               40 Sep 28 23:23 lock
drwxr-x---    2 0        0               60 Sep 28 23:23 sub

/run/sub:
-rw-r-----    1 0        0                3 Sep 28 23:23 f
hi
writable
exit=0
podman youki-stock --read-only: Error: failed to create container: exec process failed with error failed to prepare rootfs
podman youki-tmpcopyup --read-only: writable

Proposed Solution

Do what crun does:

  • keep tmpcopyup out of the mount data;
  • mount the tmpfs;
  • copy the directory it covers (files, directories, symlinks and nodes, with owners and modes) into it, as crun's copy_recursive_fd_to_fd() does (src/libcrun/utils.c);
  • refuse the option on anything but tmpfs, as crun does (src/libcrun/linux.c, "tmpcopyup can be used only with tmpfs").

With the fd-based mount flow this fits between fsmount() and move_mount(): the source is the O_PATH fd of the mount point, still the directory underneath, and the target is the detached tmpfs. A PR follows.

Considerations

  • runc (v1.4.1, libcontainer/rootfs_linux.go, doTmpfsCopyUp) mounts the tmpfs on a temporary host directory, copies, and moves it. The fd flow makes that step unnecessary.
  • crun also gives a tmpfs without mode= the mode of the directory it covers (append_tmpfs_mode_if_missing()), for every tmpfs, not only tmpcopyup ones. runc doesn't, and neither does this request.
  • xattrs are not copied (crun copies them; runc's copy doesn't).

Additional Context

youki version: 0.7.0
commit: 0.7.0-eb07b60173fca880e4287d5bc0de2580edec2c91
Kernel-Release    7.2.7-1-cachyos

Podman 6.1.2 rootless; crun 1.30.1. The only earlier mention I found is a comment in #2837 (the features subcommand), in a review comment comparing youki features with runc features.