Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

overlay-mode containerization breaks apt: Invalid cross-device link #13123

Closed
Hi-Angel opened this issue Feb 2, 2022 · 15 comments · Fixed by containers/storage#1156 or #13375
Closed
Labels
kind/bug Categorizes issue or PR as related to a bug. locked - please file new issue/PR Assist humans wanting to comment on an old issue or PR with locked comments.

Comments

@Hi-Angel
Copy link

Hi-Angel commented Feb 2, 2022

Is this a BUG REPORT or FEATURE REQUEST?

/kind bug

Description

Running apt install libreadline-dev in certain container results in apt bailing out with error:

unable to install new version of './usr/include/readline': Invalid cross-device link

This is not reproducible with fuse-overlayfs, it is only reproducible with overlay. Image/container required to reproduce it is docker.io/kkharlamov/bugreport-enomem image.

Steps to reproduce the issue:

  1. Make sure you're in overlay mode, e.g. run podman info --debug | grep fuse-overlayfs and check that there's no output. overlay requires kernel 5.16.0 or higher
  2. Run podman run --rm -it docker.io/kkharlamov/bugreport-enomem /bin/zsh
  3. In container, execute apt install libreadline-dev

Describe the results you received:

Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages were automatically installed and are no longer required:
  gyp javascript-common libasan6:i386 libatomic1:i386 libboost-dev libboost1.65-dev libc-ares2 libc6-dev:i386 libgomp1:i386 libhttp-parser2.7.1 libitm1:i386 libjs-async libjs-inherits libjs-jquery libjs-node-uuid libjs-underscore libquadmath0:i386 libstdc++6:i386
  libubsan1:i386 libuv1-dev libyaml-cpp0.5v5 linux-libc-dev:i386 nodejs-doc python-chardet python-pkg-resources
Use 'apt autoremove' to remove them.
Suggested packages:
  readline-doc
The following NEW packages will be installed:
  libreadline-dev
0 upgraded, 1 newly installed, 0 to remove and 148 not upgraded.
Need to get 133 kB of archives.
After this operation, 728 kB of additional disk space will be used.
Get:1 http://archive.ubuntu.com/ubuntu bionic/main amd64 libreadline-dev amd64 7.0-3 [133 kB]
Fetched 133 kB in 1s (190 kB/s)
debconf: delaying package configuration, since apt-utils is not installed
Selecting previously unselected package libreadline-dev:amd64.
(Reading database ... 156394 files and directories currently installed.)
Preparing to unpack .../libreadline-dev_7.0-3_amd64.deb ...
Unpacking libreadline-dev:amd64 (7.0-3) ...
dpkg: error processing archive /var/cache/apt/archives/libreadline-dev_7.0-3_amd64.deb (--unpack):
 unable to install new version of './usr/include/readline': Invalid cross-device link
dpkg-deb: error: paste subprocess was killed by signal (Broken pipe)
Errors were encountered while processing:
 /var/cache/apt/archives/libreadline-dev_7.0-3_amd64.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)

Describe the results you expected:

No errors

Workarounds:

  1. Create ~/.config/containers/storage.conf with content:

    [storage]
    
    [storage.options]
    mount_program = "/usr/bin/fuse-overlayfs"
    
  2. (WARNING: this step will remove all images) execute podman system reset -f

Output of podman version:

Version:      3.4.4
API Version:  3.4.4
Go Version:   go1.17.4
Git Commit:   f6526ada1025c2e3f88745ba83b8b461ca659933
Built:        Thu Dec  9 21:30:40 2021
OS/Arch:      linux/amd64

Output of podman info --debug:

host:
  arch: amd64
  buildahVersion: 1.23.1
  cgroupControllers:
  - memory
  - pids
  cgroupManager: systemd
  cgroupVersion: v2
  conmon:
    package: /usr/bin/conmon is owned by conmon 1:2.0.32-2
    path: /usr/bin/conmon
    version: 'conmon version 2.0.32, commit: 436b460d1586c2e4ab4e845448449ddd9136767a'
  cpus: 4
  distribution:
    distribution: arch
    version: unknown
  eventLogger: journald
  hostname: constantine-N61Ja
  idMappings:
    gidmap:
    - container_id: 0
      host_id: 1000
      size: 1
    - container_id: 1
      host_id: 165536
      size: 65536
    uidmap:
    - container_id: 0
      host_id: 1000
      size: 1
    - container_id: 1
      host_id: 165536
      size: 65536
  kernel: 5.16.0-zen1-1-zen
  linkmode: dynamic
  logDriver: journald
  memFree: 374030336
  memTotal: 8228016128
  ociRuntime:
    name: crun
    package: /usr/bin/crun is owned by crun 1.4-1
    path: /usr/bin/crun
    version: |-
      crun version 1.4
      commit: 3daded072ef008ef0840e8eccb0b52a7efbd165d
      spec: 1.0.0
      +SYSTEMD +SELINUX +APPARMOR +CAP +SECCOMP +EBPF +CRIU +YAJL
  os: linux
  remoteSocket:
    path: /run/user/1000/podman/podman.sock
  security:
    apparmorEnabled: false
    capabilities: CAP_CHOWN,CAP_DAC_OVERRIDE,CAP_FOWNER,CAP_FSETID,CAP_KILL,CAP_NET_BIND_SERVICE,CAP_SETFCAP,CAP_SETGID,CAP_SETPCAP,CAP_SETUID,CAP_SYS_CHROOT
    rootless: true
    seccompEnabled: true
    seccompProfilePath: /etc/containers/seccomp.json
    selinuxEnabled: false
  serviceIsRemote: false
  slirp4netns:
    executable: /usr/bin/slirp4netns
    package: /usr/bin/slirp4netns is owned by slirp4netns 1.1.12-1
    version: |-
      slirp4netns version 1.1.12
      commit: 7a104a101aa3278a2152351a082a6df71f57c9a3
      libslirp: 4.6.1
      SLIRP_CONFIG_VERSION_MAX: 3
      libseccomp: 2.5.3
  swapFree: 6222995456
  swapTotal: 8053059584
  uptime: 91h 40m 56.28s (Approximately 3.79 days)
plugins:
  log:
  - k8s-file
  - none
  - journald
  network:
  - bridge
  - macvlan
  volume:
  - local
registries:
  search:
  - docker.io
  - registry.fedoraproject.org
  - quay.io
  - registry.access.redhat.com
  - registry.centos.org
store:
  configFile: /home/constantine/.config/containers/storage.conf
  containerStore:
    number: 0
    paused: 0
    running: 0
    stopped: 0
  graphDriverName: overlay
  graphOptions: {}
  graphRoot: /home/constantine/.local/share/containers/storage
  graphStatus:
    Backing Filesystem: btrfs
    Native Overlay Diff: "true"
    Supports d_type: "true"
    Using metacopy: "false"
  imageStore:
    number: 0
  runRoot: /run/user/1000/containers
  volumePath: /home/constantine/.local/share/containers/storage/volumes
version:
  APIVersion: 3.4.4
  Built: 1639074640
  BuiltTime: Thu Dec  9 21:30:40 2021
  GitCommit: f6526ada1025c2e3f88745ba83b8b461ca659933
  GoVersion: go1.17.4
  OsArch: linux/amd64
  Version: 3.4.4

Package info (e.g. output of rpm -q podman or apt list podman):

Name            : podman
Version         : 3.4.4-1
Description     : Tool and library for running OCI-based containers in pods
Architecture    : x86_64
URL             : https://github.com/containers/podman
Licenses        : Apache
Groups          : None
Provides        : None
Depends On      : cni-plugins  conmon  containers-common  crun  fuse-overlayfs  iptables  libdevmapper.so=1.02-64  libgpgme.so=11-64  libseccomp.so=2-64  slirp4netns
Optional Deps   : apparmor: for AppArmor support
                  btrfs-progs: support btrfs backend devices [installed]
                  catatonit: --init flag support
                  podman-docker: for Docker-compatible CLI
Required By     : None
Optional For    : None
Conflicts With  : None
Replaces        : None
Installed Size  : 72.79 MiB
Packager        : David Runge <dvzrv@archlinux.org>
Build Date      : Чт 09 дек 2021 21:30:40
Install Date    : Пт 17 дек 2021 23:29:19
Install Reason  : Explicitly installed
Install Script  : No
Validated By    : Signature

Have you tested with the latest version of Podman and have you checked the Podman Troubleshooting Guide? (https://github.com/containers/podman/blob/main/troubleshooting.md)

Yes

@openshift-ci openshift-ci bot added the kind/bug Categorizes issue or PR as related to a bug. label Feb 2, 2022
@rhatdan
Copy link
Member

rhatdan commented Feb 2, 2022

@giuseppe PTAL

@giuseppe
Copy link
Member

giuseppe commented Feb 3, 2022

that error is reported by overlay:

[pid 915952] rmdir("/usr/include/readline.dpkg-new") = -1 ENOENT (No such file or directory)
[pid 915952] rmdir("/usr/include/readline.dpkg-tmp") = -1 ENOENT (No such file or directory)
[pid 915952] mkdir("/usr/include/readline.dpkg-new", 000) = 0
[pid 915952] chown("/usr/include/readline.dpkg-new", 0, 0) = 0
[pid 915952] chmod("/usr/include/readline.dpkg-new", 0755) = 0
[pid 915952] utimes("/usr/include/readline.dpkg-new", [{tv_sec=1643879410, tv_usec=0} /* 2022-02-03T10:10:10+0100 */, {tv_sec=1494878423, tv_usec=0} /* 2017-05-15T22:00:23+0200 */]) = 0
[pid 915952] rename("/usr/include/readline.dpkg-new", "/usr/include/readline") = -1 EXDEV (Invalid cross-device link)

You can more easily reproduce it with something like:

# mkdir foo; mv foo bar; rmdir foo bar

and you get:

[pid 920695] stat("bar", 0x7fffc53df490) = -1 ENOENT (No such file or directory)
[pid 920695] lstat("foo", {st_dev=makedev(0, 0x6e), st_ino=87055074, st_mode=S_IFDIR|0755, st_nlink=2, st_uid=0, st_gid=0, st_blksize=4096, st_blocks=0, st_size=6, st_atime=1643880550 /* 2022-02-03T10:29:10.157666615+0100 */, st_atime_nsec=157666615, st_mtime=1643880550 /* 2022-02-03T10:29:10.157666615+0100 */, st_mtime_nsec=157666615, st_ctime=1643880550 /* 2022-02-03T10:29:10.157666615+0100 */, st_ctime_nsec=157666615}) = 0
[pid 920695] lstat("bar", 0x7fffc53df170) = -1 ENOENT (No such file or directory)
[pid 920695] rename("foo", "bar")       = -1 EXDEV (Invalid cross-device link)
[pid 920695] rmdir("bar")               = -1 ENOENT (No such file or directory)
[pid 920695] mkdir("bar", 0700)         = 0
[pid 920695] lstat("bar", {st_dev=makedev(0, 0x6e), st_ino=339106825, st_mode=S_IFDIR|0700, st_nlink=2, st_uid=0, st_gid=0, st_blksize=4096, st_blocks=0, st_size=6, st_atime=1643880550 /* 2022-02-03T10:29:10.178666740+0100 */, st_atime_nsec=178666740, st_mtime=1643880550 /* 2022-02-03T10:29:10.178666740+0100 */, st_mtime_nsec=178666740, st_ctime=1643880550 /* 2022-02-03T10:29:10.178666740+0100 */, st_ctime_nsec=178666740}) = 0
[pid 920695] openat(AT_FDCWD, "foo", O_RDONLY|O_NONBLOCK|O_CLOEXEC|O_DIRECTORY) = 3
[pid 920695] fstat(3, {st_dev=makedev(0, 0x6e), st_ino=87055074, st_mode=S_IFDIR|0755, st_nlink=2, st_uid=0, st_gid=0, st_blksize=4096, st_blocks=0, st_size=6, st_atime=1643880550 /* 2022-02-03T10:29:10.157666615+0100 */, st_atime_nsec=157666615, st_mtime=1643880550 /* 2022-02-03T10:29:10.157666615+0100 */, st_mtime_nsec=157666615, st_ctime=1643880550 /* 2022-02-03T10:29:10.157666615+0100 */, st_ctime_nsec=157666615}) = 0
[pid 920695] getdents(3, [{d_ino=87055074, d_off=10, d_reclen=24, d_name=".", d_type=DT_DIR}, {d_ino=313268465, d_off=512, d_reclen=24, d_name="..", d_type=DT_DIR}], 32768) = 48
[pid 920695] getdents(3, [], 32768)     = 0
[pid 920695] close(3)                   = 0
[pid 920695] utimensat(AT_FDCWD, "bar", [{tv_sec=1643880550, tv_nsec=157666615} /* 2022-02-03T10:29:10.157666615+0100 */, {tv_sec=1643880550, tv_nsec=157666615} /* 2022-02-03T10:29:10.157666615+0100 */], 0) = 0
[pid 920695] lchown("bar", 0, 0)        = 0
[pid 920695] llistxattr("foo", NULL, 0) = 17
[pid 920695] llistxattr("foo", "security.selinux\0", 17) = 17
[pid 920695] openat(AT_FDCWD, "/etc/xattr.conf", O_RDONLY) = -1 ENOENT (No such file or directory)
[pid 920695] lgetxattr("foo", "security.selinux", NULL, 0) = 48
[pid 920695] lgetxattr("foo", "security.selinux", "system_u:object_r:container_file_t:s0:c326,c390", 48) = 48
[pid 920695] lsetxattr("bar", "security.selinux", "system_u:object_r:container_file_t:s0:c326,c390", 48, 0) = -1 EOPNOTSUPP (Operation not supported)

apt lacks the fallback code that coreutils has to handle EXDEV.

in fuse-overlayfs I've added the check slightly different, and if the source directory is not present in the lower layers, it still succeeds.

There is nothing we can do in Podman, it has either to be changed in the linux kernel, or better in apt so to handle EXDEV.

Could you try with a newer apt though?

@rhvgoyal FYI

@giuseppe giuseppe closed this as completed Feb 3, 2022
@Hi-Angel
Copy link
Author

Hi-Angel commented Feb 3, 2022

Could you try with a newer apt though?

Be it my will, I would use Fedora instead of Ubuntu :-) But I need exactly the old Ubuntu for work. I guess my best bet currently is to use fuse-overlayfs.

@kousu
Copy link
Contributor

kousu commented Feb 22, 2022

Hiya, I think there's something worth taking a second look at here. I'm also getting stumped trying to build Ubuntu containers (for work 🙄) with Invalid cross-device link. I'm also on Arch like @Hi-Angel so probably the reason this is showing up for us and evidently no one else is that we both have the very latest kernel 5.16.x.

I've written a reproduction script based on the very helpful clues from both @Hi-Angel and @giuseppe above. Thanks a lot for them! This was pretty arcane and I would have had no idea where to start without getting to stand on your shoulders.

repro.sh
#!/bin/sh
#
# reproduce https://github.com/containers/podman/issues/13123
# wherein podman in rootless + overlayfs mode triggers EXDEV errors
# for no good reason.
# 
# Since the bug turns on what podman uses for its storage driver,
# you should know this is configured with (by order of priority):
#
# * flag --storage-driver
# * env $STORAGE_DRIVER.
# * ~/.config/containers/storage.conf (if rootless)
# * /etc/containers/storage.conf
# 
# There are basically three modes that podman supports:
#
# 1. legacy vfs
#
#   export STORAGE_DRIVER=vfs STORAGE_OPTS=""
#
# 2. modern kernel
#
#   export STORAGE_DRIVER=overlay STORAGE_OPTS=""
#
# 3. modern overlayfs, but with a FUSE helper
#    (this is only needed for rootless mode)
#
#    export STORAGE_DRIVER=overlay STORAGE_OPTS="overlay.mount_program=/usr/bin/fuse-overlayfs"
#
# I recommend you pick a mode using these env vars. For example: 
#
#    STORAGE_DRIVER=overlay STORAGE_OPTS="overlay.mount_program=/usr/bin/fuse-overlayfs" sh repro.sh
#
# To use root mode, just use sudo:
#
#    sudo STORAGE_DRIVER=vfs STORAGE_OPTS="" sh repro.sh


set -eu

# verify configured driver is actually active: if you switch the driver you 
# have to erase the entire cache of containers/images/cached config. And sometimes even twice before it will stick?
if podman info --debug 2>&1 | grep -q 'delete libpod local files to resolve'; then
  echo "In order to switch graph drivers, you must erase your existing containers/images/cache."
  podman system reset
  if podman info --debug 2>&1 | grep -q 'delete libpod local files to resolve'; then
    echo "You chose to keep your existing containers. This reproduction script cannot work. Exiting."
    exit 1
  fi
  podman system reset -f # XXX dangerous
fi

cat >rename.c <<EOF
// rename.c: a direct interface to rename(2) without all that coreutils junk in the way
// compile with: gcc -static rename.c -o rename

#include <stdio.h>
#include <errno.h>

int main(int argc, char* argv[]) {
  if(argc != 3) { errno = EINVAL; perror("argv"); return 1; }
  if(rename(argv[1], argv[2]) != 0) { perror("rename"); return 2; }
  return 0;
}
EOF
gcc -static rename.c -o rename

# platform:
(
set -x

podman version

podman info --debug
)


GRAPHROOT=$(podman info --format={{".Store.GraphRoot"}})
RUNROOT=$(podman info --format={{".Store.RunRoot"}})
DRIVER=$(podman info --format={{".Store.GraphDriverName"}})
ROOTLESS=$(podman info --format={{".Host.Security.Rootless"}})

if podman info --debug | grep -q fuse-overlayfs; then
  MOUNT_PROGRAM="fuse-overlayfs";
else
  MOUNT_PROGRAM="(kernel)";
fi

(set -x
findmnt --target="$GRAPHROOT"
)
echo
(set -x
df -h "$GRAPHROOT"
)
echo
(set -x
findmnt --target="$RUNROOT"
)
echo
(set -x
df -h "$RUNROOT"
)
echo

# make a small container image
# because the bug is triggered by trying to manipulate directories
# in a *base* image from a container overlay'd on top
cat >Dockerfile <<EOF
FROM ubuntu:20.04

RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y strace

COPY rename /usr/bin/

# embed some known paths in the container image
RUN mkdir -p /home/dir_lower
RUN touch /home/file_lower
EOF
(set -x
podman build -t lower_layer .
)
echo

echo "Run the built container image, on $DRIVER (via $MOUNT_PROGRAM) (rootless: $ROOTLESS):"
podman run --cap-add=SYS_PTRACE --rm -it lower_layer sh -c '
  set -x
  mkdir /home/dir_upper &&
  touch /home/file_upper &&
  ls -l /home &&
  strace -e rename rename /home/file_upper /home/file_upper.bak &&
  strace -e rename rename /home/dir_upper /home/dir_upper.bak &&
  strace -e rename rename /home/file_lower /home/file_lower.bak &&
  strace -e rename rename /home/dir_lower /home/dir_lower.bak &&
  ls /home
'

and I've learned:

  • rename(2) always succeeds for renaming files

  • rename(2) always succeeds for renaming a freshly created directory

    • I wasn't able to get the example given by @giuseppe of mkdir foo; mv foo bar; rmdir foo bar to reproduce the EXDEV in any context.
  • rename(2) sometimes fails when trying to rename a directory previously created in a lower container image layer.

    This seems to be the root of the problem: a lower level in an overlayfs is being considered a different device than the upper layer. But for some reason this rule only applies to directories. Renames work for files so I don't know what its problem is 😖

    • this is reproducible with or without fuse-overlayfs.

      • The difference that stands out to me between @Hi-Angel's system and mine is

        he has

        Backing Filesystem: btrfs
        Native Overlay Diff: "true"
        

        and I have

        Backing Filesystem: extfs
        Native Overlay Diff: "false"
        

        So maybe on btrfs, fuse-overlayfs works better?

    • Therefore the workaround of export STORAGE_OPTS="overlay.mount_program=/usr/bin/fuse-overlayfs" didn't work for me

  • downgrading to vfs via export STORAGE_DRIVER=vfs STORAGE_OPTS= did succeed

Here's the results of my experiments (showing what rename("/home/dir_lower", "/home/dir_lower.bak") reported):

STORAGE_DRIVER=vfs STORAGE_DRIVER=overlay STORAGE_DRIVER=overlay + fuse-overlayfs
rootless 🟢 0 🔴 EXDEV 🔴 EXDEV
rootful 🟢 0 🟢 0 🔴 EXDEV
Full logs
rootless, vfs
$ STORAGE_DRIVER=vfs STORAGE_OPTS="" sh repro.sh
+ podman version
Version:      3.4.4
API Version:  3.4.4
Go Version:   go1.17.4
Git Commit:   f6526ada1025c2e3f88745ba83b8b461ca659933
Built:        Thu Dec  9 13:30:40 2021
OS/Arch:      linux/amd64
+ podman info --debug
host:
  arch: amd64
  buildahVersion: 1.23.1
  cgroupControllers:
  - memory
  - pids
  cgroupManager: systemd
  cgroupVersion: v2
  conmon:
    package: /usr/bin/conmon is owned by conmon 1:2.1.0-1
    path: /usr/bin/conmon
    version: 'conmon version 2.1.0, commit: bdb4f6e56cd193d40b75ffc9725d4b74a18cb33c'
  cpus: 4
  distribution:
    distribution: arch
    version: unknown
  eventLogger: journald
  hostname: requiem
  idMappings:
    gidmap:
    - container_id: 0
      host_id: 1001
      size: 1
    - container_id: 1
      host_id: 100000
      size: 65537
    uidmap:
    - container_id: 0
      host_id: 1001
      size: 1
    - container_id: 1
      host_id: 100000
      size: 65537
  kernel: 5.16.10-arch1-1
  linkmode: dynamic
  logDriver: journald
  memFree: 9490178048
  memTotal: 16446435328
  ociRuntime:
    name: crun
    package: /usr/bin/crun is owned by crun 1.4.2-1
    path: /usr/bin/crun
    version: |-
      crun version 1.4.2
      commit: f6fbc8f840df1a414f31a60953ae514fa497c748
      spec: 1.0.0
      +SYSTEMD +SELINUX +APPARMOR +CAP +SECCOMP +EBPF +CRIU +YAJL
  os: linux
  remoteSocket:
    path: /run/user/1001/podman/podman.sock
  security:
    apparmorEnabled: false
    capabilities: CAP_CHOWN,CAP_DAC_OVERRIDE,CAP_FOWNER,CAP_FSETID,CAP_KILL,CAP_NET_BIND_SERVICE,CAP_SETFCAP,CAP_SETGID,CAP_SETPCAP,CAP_SETUID,CAP_SYS_CHROOT
    rootless: true
    seccompEnabled: true
    seccompProfilePath: /etc/containers/seccomp.json
    selinuxEnabled: false
  serviceIsRemote: false
  slirp4netns:
    executable: /usr/bin/slirp4netns
    package: /usr/bin/slirp4netns is owned by slirp4netns 1.1.12-1
    version: |-
      slirp4netns version 1.1.12
      commit: 7a104a101aa3278a2152351a082a6df71f57c9a3
      libslirp: 4.6.1
      SLIRP_CONFIG_VERSION_MAX: 3
      libseccomp: 2.5.3
  swapFree: 0
  swapTotal: 0
  uptime: 15h 37m 21.55s (Approximately 0.62 days)
plugins:
  log:
  - k8s-file
  - none
  - journald
  network:
  - bridge
  - macvlan
  volume:
  - local
registries: {}
store:
  configFile: /home/kousu/.config/containers/storage.conf
  containerStore:
    number: 0
    paused: 0
    running: 0
    stopped: 0
  graphDriverName: vfs
  graphOptions: {}
  graphRoot: /home/kousu/.local/share/containers/storage
  graphStatus: {}
  imageStore:
    number: 1
  runRoot: /run/user/1001/containers
  volumePath: /home/kousu/.local/share/containers/storage/volumes
version:
  APIVersion: 3.4.4
  Built: 1639074640
  BuiltTime: Thu Dec  9 13:30:40 2021
  GitCommit: f6526ada1025c2e3f88745ba83b8b461ca659933
  GoVersion: go1.17.4
  OsArch: linux/amd64
  Version: 3.4.4

+ findmnt --target=/home/kousu/.local/share/containers/storage
TARGET SOURCE    FSTYPE OPTIONS
/home  /dev/sda9 ext2   rw,relatime

+ df -h /home/kousu/.local/share/containers/storage
Filesystem      Size  Used Avail Use% Mounted on
/dev/sda9       391G  333G   38G  90% /home

+ findmnt --target=/run/user/1001/containers
TARGET         SOURCE FSTYPE OPTIONS
/run/user/1001 tmpfs  tmpfs  rw,nosuid,nodev,relatime,size=14454876k,nr_inodes=401524,mode=700,uid=1001,gid=1001,inode64

+ df -h /run/user/1001/containers
Filesystem      Size  Used Avail Use% Mounted on
tmpfs            14G  1.4M   14G   1% /run/user/1001

+ podman build -t lower_layer .
STEP 1/5: FROM ubuntu:20.04
STEP 2/5: RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y strace
Get:1 http://archive.ubuntu.com/ubuntu focal InRelease [265 kB]
Get:2 http://security.ubuntu.com/ubuntu focal-security InRelease [114 kB]
Get:3 http://archive.ubuntu.com/ubuntu focal-updates InRelease [114 kB]
Get:4 http://archive.ubuntu.com/ubuntu focal-backports InRelease [108 kB]
Get:5 http://security.ubuntu.com/ubuntu focal-security/multiverse amd64 Packages [25.8 kB]
Get:6 http://archive.ubuntu.com/ubuntu focal/universe amd64 Packages [11.3 MB]
Get:7 http://security.ubuntu.com/ubuntu focal-security/main amd64 Packages [1577 kB]
Get:8 http://security.ubuntu.com/ubuntu focal-security/restricted amd64 Packages [982 kB]
Get:9 http://security.ubuntu.com/ubuntu focal-security/universe amd64 Packages [841 kB]
Get:10 http://archive.ubuntu.com/ubuntu focal/main amd64 Packages [1275 kB]
Get:11 http://archive.ubuntu.com/ubuntu focal/multiverse amd64 Packages [177 kB]
Get:12 http://archive.ubuntu.com/ubuntu focal/restricted amd64 Packages [33.4 kB]
Get:13 http://archive.ubuntu.com/ubuntu focal-updates/universe amd64 Packages [1134 kB]
Get:14 http://archive.ubuntu.com/ubuntu focal-updates/multiverse amd64 Packages [29.4 kB]
Get:15 http://archive.ubuntu.com/ubuntu focal-updates/restricted amd64 Packages [1052 kB]
Get:16 http://archive.ubuntu.com/ubuntu focal-updates/main amd64 Packages [2006 kB]
Get:17 http://archive.ubuntu.com/ubuntu focal-backports/universe amd64 Packages [24.8 kB]
Get:18 http://archive.ubuntu.com/ubuntu focal-backports/main amd64 Packages [50.8 kB]
Fetched 21.2 MB in 9s (2482 kB/s)
Reading package lists...
Reading package lists...
Building dependency tree...
Reading state information...
The following additional packages will be installed:
  libunwind8
The following NEW packages will be installed:
  libunwind8 strace
0 upgraded, 2 newly installed, 0 to remove and 10 not upgraded.
Need to get 428 kB of archives.
After this operation, 1844 kB of additional disk space will be used.
Get:1 http://archive.ubuntu.com/ubuntu focal/main amd64 libunwind8 amd64 1.2.1-9build1 [47.6 kB]
Get:2 http://archive.ubuntu.com/ubuntu focal-updates/main amd64 strace amd64 5.5-3ubuntu1 [380 kB]
debconf: delaying package configuration, since apt-utils is not installed
Fetched 428 kB in 2s (227 kB/s)
Selecting previously unselected package libunwind8:amd64.
(Reading database ... 4127 files and directories currently installed.)
Preparing to unpack .../libunwind8_1.2.1-9build1_amd64.deb ...
Unpacking libunwind8:amd64 (1.2.1-9build1) ...
Selecting previously unselected package strace.
Preparing to unpack .../strace_5.5-3ubuntu1_amd64.deb ...
Unpacking strace (5.5-3ubuntu1) ...
Setting up libunwind8:amd64 (1.2.1-9build1) ...
Setting up strace (5.5-3ubuntu1) ...
Processing triggers for libc-bin (2.31-0ubuntu9.2) ...
--> df1731ea9d6
STEP 3/5: COPY rename /usr/bin/
--> 9c9d15b26ec
STEP 4/5: RUN mkdir -p /home/dir_lower
--> 6664e7d13e3
STEP 5/5: RUN touch /home/file_lower
COMMIT lower_layer
--> ffdadd2440f
Successfully tagged localhost/lower_layer:latest
ffdadd2440f0af24719c27d2efb02b333056c2c05be901260afd3c69ffa128c3

Run the built container image, on vfs (via (kernel)) (rootless: true):
+ mkdir /home/dir_upper
+ touch /home/file_upper
+ ls -l /home
total 8
drwxr-xr-x 2 root root 4096 Feb 22 09:13 dir_lower
drwxr-xr-x 2 root root 4096 Feb 22 09:13 dir_upper
-rw-r--r-- 1 root root    0 Feb 22 09:13 file_lower
-rw-r--r-- 1 root root    0 Feb 22 09:13 file_upper
+ strace -e rename rename /home/file_upper /home/file_upper.bak
rename("/home/file_upper", "/home/file_upper.bak") = 0
+++ exited with 0 +++
+ strace -e rename rename /home/dir_upper /home/dir_upper.bak
rename("/home/dir_upper", "/home/dir_upper.bak") = 0
+++ exited with 0 +++
+ strace -e rename rename /home/file_lower /home/file_lower.bak
rename("/home/file_lower", "/home/file_lower.bak") = 0
+++ exited with 0 +++
+ strace -e rename rename /home/dir_lower /home/dir_lower.bak
rename("/home/dir_lower", "/home/dir_lower.bak") = 0
+++ exited with 0 +++
+ ls /home
dir_lower.bak  dir_upper.bak  file_lower.bak  file_upper.bak
rootful, vfs
$ sudo STORAGE_DRIVER=vfs STORAGE_OPTS="" sh repro.sh
[sudo] password for kousu: 
+ podman version
Version:      3.4.4
API Version:  3.4.4
Go Version:   go1.17.4
Git Commit:   f6526ada1025c2e3f88745ba83b8b461ca659933
Built:        Thu Dec  9 13:30:40 2021
OS/Arch:      linux/amd64
+ podman info --debug
host:
  arch: amd64
  buildahVersion: 1.23.1
  cgroupControllers:
  - cpuset
  - cpu
  - io
  - memory
  - hugetlb
  - pids
  - rdma
  - misc
  cgroupManager: systemd
  cgroupVersion: v2
  conmon:
    package: /usr/bin/conmon is owned by conmon 1:2.1.0-1
    path: /usr/bin/conmon
    version: 'conmon version 2.1.0, commit: bdb4f6e56cd193d40b75ffc9725d4b74a18cb33c'
  cpus: 4
  distribution:
    distribution: arch
    version: unknown
  eventLogger: journald
  hostname: requiem
  idMappings:
    gidmap: null
    uidmap: null
  kernel: 5.16.10-arch1-1
  linkmode: dynamic
  logDriver: journald
  memFree: 9070465024
  memTotal: 16446435328
  ociRuntime:
    name: crun
    package: /usr/bin/crun is owned by crun 1.4.2-1
    path: /usr/bin/crun
    version: |-
      crun version 1.4.2
      commit: f6fbc8f840df1a414f31a60953ae514fa497c748
      spec: 1.0.0
      +SYSTEMD +SELINUX +APPARMOR +CAP +SECCOMP +EBPF +CRIU +YAJL
  os: linux
  remoteSocket:
    path: /run/podman/podman.sock
  security:
    apparmorEnabled: false
    capabilities: CAP_CHOWN,CAP_DAC_OVERRIDE,CAP_FOWNER,CAP_FSETID,CAP_KILL,CAP_NET_BIND_SERVICE,CAP_SETFCAP,CAP_SETGID,CAP_SETPCAP,CAP_SETUID,CAP_SYS_CHROOT
    rootless: false
    seccompEnabled: true
    seccompProfilePath: /etc/containers/seccomp.json
    selinuxEnabled: false
  serviceIsRemote: false
  slirp4netns:
    executable: /usr/bin/slirp4netns
    package: /usr/bin/slirp4netns is owned by slirp4netns 1.1.12-1
    version: |-
      slirp4netns version 1.1.12
      commit: 7a104a101aa3278a2152351a082a6df71f57c9a3
      libslirp: 4.6.1
      SLIRP_CONFIG_VERSION_MAX: 3
      libseccomp: 2.5.3
  swapFree: 0
  swapTotal: 0
  uptime: 15h 38m 10.27s (Approximately 0.62 days)
plugins:
  log:
  - k8s-file
  - none
  - journald
  network:
  - bridge
  - macvlan
  volume:
  - local
registries: {}
store:
  configFile: /etc/containers/storage.conf
  containerStore:
    number: 0
    paused: 0
    running: 0
    stopped: 0
  graphDriverName: vfs
  graphOptions: {}
  graphRoot: /var/lib/containers/storage
  graphStatus: {}
  imageStore:
    number: 0
  runRoot: /run/containers/storage
  volumePath: /var/lib/containers/storage/volumes
version:
  APIVersion: 3.4.4
  Built: 1639074640
  BuiltTime: Thu Dec  9 13:30:40 2021
  GitCommit: f6526ada1025c2e3f88745ba83b8b461ca659933
  GoVersion: go1.17.4
  OsArch: linux/amd64
  Version: 3.4.4

+ findmnt --target=/var/lib/containers/storage
TARGET SOURCE    FSTYPE OPTIONS
/      /dev/sda7 ext4   rw,relatime

+ df -h /var/lib/containers/storage
Filesystem      Size  Used Avail Use% Mounted on
/dev/sda7        30G   25G  3.1G  89% /

+ findmnt --target=/run/containers/storage
TARGET SOURCE FSTYPE OPTIONS
/run   run    tmpfs  rw,nosuid,nodev,relatime,mode=755,inode64

+ df -h /run/containers/storage
Filesystem      Size  Used Avail Use% Mounted on
run             7.7G  1.3M  7.7G   1% /run

+ podman build -t lower_layer .
STEP 1/5: FROM ubuntu:20.04
Resolved "ubuntu" as an alias (/etc/containers/registries.conf.d/00-shortnames.conf)
Trying to pull docker.io/library/ubuntu:20.04...
Getting image source signatures
Copying blob 08c01a0ec47e done  
Copying config 54c9d81cbb done  
Writing manifest to image destination
Storing signatures
STEP 2/5: RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y strace
Get:1 http://security.ubuntu.com/ubuntu focal-security InRelease [114 kB]
Get:2 http://archive.ubuntu.com/ubuntu focal InRelease [265 kB]
Get:3 http://security.ubuntu.com/ubuntu focal-security/multiverse amd64 Packages [25.8 kB]
Get:4 http://security.ubuntu.com/ubuntu focal-security/universe amd64 Packages [841 kB]
Get:5 http://security.ubuntu.com/ubuntu focal-security/restricted amd64 Packages [982 kB]
Get:6 http://security.ubuntu.com/ubuntu focal-security/main amd64 Packages [1577 kB]
Get:7 http://archive.ubuntu.com/ubuntu focal-updates InRelease [114 kB]
Get:8 http://archive.ubuntu.com/ubuntu focal-backports InRelease [108 kB]
Get:9 http://archive.ubuntu.com/ubuntu focal/restricted amd64 Packages [33.4 kB]
Get:10 http://archive.ubuntu.com/ubuntu focal/main amd64 Packages [1275 kB]
Get:11 http://archive.ubuntu.com/ubuntu focal/universe amd64 Packages [11.3 MB]
Get:12 http://archive.ubuntu.com/ubuntu focal/multiverse amd64 Packages [177 kB]
Get:13 http://archive.ubuntu.com/ubuntu focal-updates/restricted amd64 Packages [1052 kB]
Get:14 http://archive.ubuntu.com/ubuntu focal-updates/universe amd64 Packages [1134 kB]
Get:15 http://archive.ubuntu.com/ubuntu focal-updates/multiverse amd64 Packages [29.4 kB]
Get:16 http://archive.ubuntu.com/ubuntu focal-updates/main amd64 Packages [2006 kB]
Get:17 http://archive.ubuntu.com/ubuntu focal-backports/main amd64 Packages [50.8 kB]
Get:18 http://archive.ubuntu.com/ubuntu focal-backports/universe amd64 Packages [24.8 kB]
Fetched 21.2 MB in 7s (2994 kB/s)
Reading package lists...
Reading package lists...
Building dependency tree...
Reading state information...
The following additional packages will be installed:
  libunwind8
The following NEW packages will be installed:
  libunwind8 strace
0 upgraded, 2 newly installed, 0 to remove and 10 not upgraded.
Need to get 428 kB of archives.
After this operation, 1844 kB of additional disk space will be used.
Get:1 http://archive.ubuntu.com/ubuntu focal/main amd64 libunwind8 amd64 1.2.1-9build1 [47.6 kB]
Get:2 http://archive.ubuntu.com/ubuntu focal-updates/main amd64 strace amd64 5.5-3ubuntu1 [380 kB]
debconf: delaying package configuration, since apt-utils is not installed
Fetched 428 kB in 2s (177 kB/s)
Selecting previously unselected package libunwind8:amd64.
(Reading database ... 4127 files and directories currently installed.)
Preparing to unpack .../libunwind8_1.2.1-9build1_amd64.deb ...
Unpacking libunwind8:amd64 (1.2.1-9build1) ...
Selecting previously unselected package strace.
Preparing to unpack .../strace_5.5-3ubuntu1_amd64.deb ...
Unpacking strace (5.5-3ubuntu1) ...
Setting up libunwind8:amd64 (1.2.1-9build1) ...
Setting up strace (5.5-3ubuntu1) ...
Processing triggers for libc-bin (2.31-0ubuntu9.2) ...
--> d7b7dadf630
STEP 3/5: COPY rename /usr/bin/
--> 80b2e2fd9d4
STEP 4/5: RUN mkdir -p /home/dir_lower
--> c76af0afca3
STEP 5/5: RUN touch /home/file_lower
COMMIT lower_layer
--> 0b177c2620c
Successfully tagged localhost/lower_layer:latest
0b177c2620c8c51ab2b541b6759c71798ddf4cbd5b7e1a54319dbe301f2b1f18

Run the built container image, on vfs (via (kernel)) (rootless: false):
+ mkdir /home/dir_upper
+ touch /home/file_upper
+ ls -l /home
total 8
drwxr-xr-x 2 root root 4096 Feb 22 09:14 dir_lower
drwxr-xr-x 2 root root 4096 Feb 22 09:14 dir_upper
-rw-r--r-- 1 root root    0 Feb 22 09:14 file_lower
-rw-r--r-- 1 root root    0 Feb 22 09:14 file_upper
+ strace -e rename rename /home/file_upper /home/file_upper.bak
rename("/home/file_upper", "/home/file_upper.bak") = 0
+++ exited with 0 +++
+ strace -e rename rename /home/dir_upper /home/dir_upper.bak
rename("/home/dir_upper", "/home/dir_upper.bak") = 0
+++ exited with 0 +++
+ strace -e rename rename /home/file_lower /home/file_lower.bak
rename("/home/file_lower", "/home/file_lower.bak") = 0
+++ exited with 0 +++
+ strace -e rename rename /home/dir_lower /home/dir_lower.bak
rename("/home/dir_lower", "/home/dir_lower.bak") = 0
+++ exited with 0 +++
+ ls /home
dir_lower.bak  dir_upper.bak  file_lower.bak  file_upper.bak
rootless, overlay (pure kernel)
$ STORAGE_DRIVER=overlay STORAGE_OPTS="" sh repro.sh
ERRO[0000] User-selected graph driver "overlay" overwritten by graph driver "vfs" from database - delete libpod local files to resolve 
In order to switch graph drivers, you must erase your existing containers/images/cache.
ERRO[0000] User-selected graph driver "overlay" overwritten by graph driver "vfs" from database - delete libpod local files to resolve 
ERRO[0000] User-selected graph driver "overlay" overwritten by graph driver "vfs" from database - delete libpod local files to resolve 

WARNING! This will remove:
        - all containers
        - all pods
        - all images
        - all build cache
WARNING! The following external containers will be purged:
	- d0918f48dec5 (ubuntu-working-container)
Are you sure you want to continue? [y/N] y
ERRO[0005] User-selected graph driver "overlay" overwritten by graph driver "vfs" from database - delete libpod local files to resolve 
+ podman version
Version:      3.4.4
API Version:  3.4.4
Go Version:   go1.17.4
Git Commit:   f6526ada1025c2e3f88745ba83b8b461ca659933
Built:        Thu Dec  9 13:30:40 2021
OS/Arch:      linux/amd64
+ podman info --debug
host:
  arch: amd64
  buildahVersion: 1.23.1
  cgroupControllers:
  - memory
  - pids
  cgroupManager: systemd
  cgroupVersion: v2
  conmon:
    package: /usr/bin/conmon is owned by conmon 1:2.1.0-1
    path: /usr/bin/conmon
    version: 'conmon version 2.1.0, commit: bdb4f6e56cd193d40b75ffc9725d4b74a18cb33c'
  cpus: 4
  distribution:
    distribution: arch
    version: unknown
  eventLogger: journald
  hostname: requiem
  idMappings:
    gidmap:
    - container_id: 0
      host_id: 1001
      size: 1
    - container_id: 1
      host_id: 100000
      size: 65537
    uidmap:
    - container_id: 0
      host_id: 1001
      size: 1
    - container_id: 1
      host_id: 100000
      size: 65537
  kernel: 5.16.10-arch1-1
  linkmode: dynamic
  logDriver: journald
  memFree: 9199210496
  memTotal: 16446435328
  ociRuntime:
    name: crun
    package: /usr/bin/crun is owned by crun 1.4.2-1
    path: /usr/bin/crun
    version: |-
      crun version 1.4.2
      commit: f6fbc8f840df1a414f31a60953ae514fa497c748
      spec: 1.0.0
      +SYSTEMD +SELINUX +APPARMOR +CAP +SECCOMP +EBPF +CRIU +YAJL
  os: linux
  remoteSocket:
    path: /run/user/1001/podman/podman.sock
  security:
    apparmorEnabled: false
    capabilities: CAP_CHOWN,CAP_DAC_OVERRIDE,CAP_FOWNER,CAP_FSETID,CAP_KILL,CAP_NET_BIND_SERVICE,CAP_SETFCAP,CAP_SETGID,CAP_SETPCAP,CAP_SETUID,CAP_SYS_CHROOT
    rootless: true
    seccompEnabled: true
    seccompProfilePath: /etc/containers/seccomp.json
    selinuxEnabled: false
  serviceIsRemote: false
  slirp4netns:
    executable: /usr/bin/slirp4netns
    package: /usr/bin/slirp4netns is owned by slirp4netns 1.1.12-1
    version: |-
      slirp4netns version 1.1.12
      commit: 7a104a101aa3278a2152351a082a6df71f57c9a3
      libslirp: 4.6.1
      SLIRP_CONFIG_VERSION_MAX: 3
      libseccomp: 2.5.3
  swapFree: 0
  swapTotal: 0
  uptime: 15h 39m 33.39s (Approximately 0.62 days)
plugins:
  log:
  - k8s-file
  - none
  - journald
  network:
  - bridge
  - macvlan
  volume:
  - local
registries: {}
store:
  configFile: /home/kousu/.config/containers/storage.conf
  containerStore:
    number: 0
    paused: 0
    running: 0
    stopped: 0
  graphDriverName: overlay
  graphOptions: {}
  graphRoot: /home/kousu/.local/share/containers/storage
  graphStatus:
    Backing Filesystem: extfs
    Native Overlay Diff: "true"
    Supports d_type: "true"
    Using metacopy: "false"
  imageStore:
    number: 0
  runRoot: /run/user/1001/containers
  volumePath: /home/kousu/.local/share/containers/storage/volumes
version:
  APIVersion: 3.4.4
  Built: 1639074640
  BuiltTime: Thu Dec  9 13:30:40 2021
  GitCommit: f6526ada1025c2e3f88745ba83b8b461ca659933
  GoVersion: go1.17.4
  OsArch: linux/amd64
  Version: 3.4.4

+ findmnt --target=/home/kousu/.local/share/containers/storage
TARGET SOURCE    FSTYPE OPTIONS
/home  /dev/sda9 ext2   rw,relatime

+ df -h /home/kousu/.local/share/containers/storage
Filesystem      Size  Used Avail Use% Mounted on
/dev/sda9       391G  333G   38G  90% /home

+ findmnt --target=/run/user/1001/containers
TARGET         SOURCE FSTYPE OPTIONS
/run/user/1001 tmpfs  tmpfs  rw,nosuid,nodev,relatime,size=14454876k,nr_inodes=401524,mode=700,uid=1001,gid=1001,inode64

+ df -h /run/user/1001/containers
Filesystem      Size  Used Avail Use% Mounted on
tmpfs            14G  1.4M   14G   1% /run/user/1001

+ podman build -t lower_layer .
STEP 1/5: FROM ubuntu:20.04
Resolved "ubuntu" as an alias (/etc/containers/registries.conf.d/00-shortnames.conf)
Trying to pull docker.io/library/ubuntu:20.04...
Getting image source signatures
Copying blob 08c01a0ec47e done  
Copying config 54c9d81cbb done  
Writing manifest to image destination
Storing signatures
STEP 2/5: RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y strace
Get:1 http://security.ubuntu.com/ubuntu focal-security InRelease [114 kB]
Get:2 http://archive.ubuntu.com/ubuntu focal InRelease [265 kB]
Get:3 http://security.ubuntu.com/ubuntu focal-security/universe amd64 Packages [841 kB]
Get:4 http://security.ubuntu.com/ubuntu focal-security/main amd64 Packages [1577 kB]
Get:5 http://archive.ubuntu.com/ubuntu focal-updates InRelease [114 kB]
Get:6 http://security.ubuntu.com/ubuntu focal-security/restricted amd64 Packages [982 kB]
Get:7 http://archive.ubuntu.com/ubuntu focal-backports InRelease [108 kB]
Get:8 http://security.ubuntu.com/ubuntu focal-security/multiverse amd64 Packages [25.8 kB]
Get:9 http://archive.ubuntu.com/ubuntu focal/main amd64 Packages [1275 kB]
Get:10 http://archive.ubuntu.com/ubuntu focal/universe amd64 Packages [11.3 MB]
Get:11 http://archive.ubuntu.com/ubuntu focal/restricted amd64 Packages [33.4 kB]
Get:12 http://archive.ubuntu.com/ubuntu focal/multiverse amd64 Packages [177 kB]
Get:13 http://archive.ubuntu.com/ubuntu focal-updates/restricted amd64 Packages [1052 kB]
Get:14 http://archive.ubuntu.com/ubuntu focal-updates/multiverse amd64 Packages [29.4 kB]
Get:15 http://archive.ubuntu.com/ubuntu focal-updates/universe amd64 Packages [1134 kB]
Get:16 http://archive.ubuntu.com/ubuntu focal-updates/main amd64 Packages [2006 kB]
Get:17 http://archive.ubuntu.com/ubuntu focal-backports/universe amd64 Packages [24.8 kB]
Get:18 http://archive.ubuntu.com/ubuntu focal-backports/main amd64 Packages [50.8 kB]
Fetched 21.2 MB in 1min 5s (328 kB/s)
Reading package lists...
Reading package lists...
Building dependency tree...
Reading state information...
The following additional packages will be installed:
  libunwind8
The following NEW packages will be installed:
  libunwind8 strace
0 upgraded, 2 newly installed, 0 to remove and 10 not upgraded.
Need to get 428 kB of archives.
After this operation, 1844 kB of additional disk space will be used.
Get:1 http://archive.ubuntu.com/ubuntu focal/main amd64 libunwind8 amd64 1.2.1-9build1 [47.6 kB]
Get:2 http://archive.ubuntu.com/ubuntu focal-updates/main amd64 strace amd64 5.5-3ubuntu1 [380 kB]
debconf: delaying package configuration, since apt-utils is not installed
Fetched 428 kB in 2s (184 kB/s)
Selecting previously unselected package libunwind8:amd64.
(Reading database ... 4127 files and directories currently installed.)
Preparing to unpack .../libunwind8_1.2.1-9build1_amd64.deb ...
Unpacking libunwind8:amd64 (1.2.1-9build1) ...
Selecting previously unselected package strace.
Preparing to unpack .../strace_5.5-3ubuntu1_amd64.deb ...
Unpacking strace (5.5-3ubuntu1) ...
Setting up libunwind8:amd64 (1.2.1-9build1) ...
Setting up strace (5.5-3ubuntu1) ...
Processing triggers for libc-bin (2.31-0ubuntu9.2) ...
--> 5aa8fdfdccf
STEP 3/5: COPY rename /usr/bin/
--> aa7df45abce
STEP 4/5: RUN mkdir -p /home/dir_lower
--> 9aa09ffa23e
STEP 5/5: RUN touch /home/file_lower
COMMIT lower_layer
--> 6bbcc23768b
Successfully tagged localhost/lower_layer:latest
6bbcc23768bf52369b2339e4e5c7ed0df0fefb26530bc98978f3eaa3e296b6b5

Run the built container image, on overlay (via (kernel)) (rootless: true):
+ mkdir /home/dir_upper
+ touch /home/file_upper
+ ls -l /home
total 8
drwxr-xr-x 2 root root 4096 Feb 22 09:17 dir_lower
drwxr-xr-x 2 root root 4096 Feb 22 09:17 dir_upper
-rw-r--r-- 1 root root    0 Feb 22 09:17 file_lower
-rw-r--r-- 1 root root    0 Feb 22 09:17 file_upper
+ strace -e rename rename /home/file_upper /home/file_upper.bak
rename("/home/file_upper", "/home/file_upper.bak") = 0
+++ exited with 0 +++
+ strace -e rename rename /home/dir_upper /home/dir_upper.bak
rename("/home/dir_upper", "/home/dir_upper.bak") = 0
+++ exited with 0 +++
+ strace -e rename rename /home/file_lower /home/file_lower.bak
rename("/home/file_lower", "/home/file_lower.bak") = 0
+++ exited with 0 +++
+ strace -e rename rename /home/dir_lower /home/dir_lower.bak
rename("/home/dir_lower", "/home/dir_lower.bak") = -1 EXDEV (Invalid cross-device link)
rename: Invalid cross-device link
+++ exited with 2 +++
rootful, overlay (pure kernel)
$ sudo STORAGE_DRIVER=overlay STORAGE_OPTS="" sh repro.sh
ERRO[0000] User-selected graph driver "overlay" overwritten by graph driver "vfs" from database - delete libpod local files to resolve 
In order to switch graph drivers, you must erase your existing containers/images/cache.
ERRO[0000] User-selected graph driver "overlay" overwritten by graph driver "vfs" from database - delete libpod local files to resolve 

WARNING! This will remove:
        - all containers
        - all pods
        - all images
        - all build cache
Are you sure you want to continue? [y/N] y
ERRO[0001] User-selected graph driver "overlay" overwritten by graph driver "vfs" from database - delete libpod local files to resolve 
A storage.conf file exists at /etc/containers/storage.conf
You should remove this file if you did not modified the configuration.
A storage.conf file exists at /etc/containers/storage.conf
You should remove this file if you did not modified the configuration.
+ podman version
Version:      3.4.4
API Version:  3.4.4
Go Version:   go1.17.4
Git Commit:   f6526ada1025c2e3f88745ba83b8b461ca659933
Built:        Thu Dec  9 13:30:40 2021
OS/Arch:      linux/amd64
+ podman info --debug
host:
  arch: amd64
  buildahVersion: 1.23.1
  cgroupControllers:
  - cpuset
  - cpu
  - io
  - memory
  - hugetlb
  - pids
  - rdma
  - misc
  cgroupManager: systemd
  cgroupVersion: v2
  conmon:
    package: /usr/bin/conmon is owned by conmon 1:2.1.0-1
    path: /usr/bin/conmon
    version: 'conmon version 2.1.0, commit: bdb4f6e56cd193d40b75ffc9725d4b74a18cb33c'
  cpus: 4
  distribution:
    distribution: arch
    version: unknown
  eventLogger: journald
  hostname: requiem
  idMappings:
    gidmap: null
    uidmap: null
  kernel: 5.16.10-arch1-1
  linkmode: dynamic
  logDriver: journald
  memFree: 9665216512
  memTotal: 16446435328
  ociRuntime:
    name: crun
    package: /usr/bin/crun is owned by crun 1.4.2-1
    path: /usr/bin/crun
    version: |-
      crun version 1.4.2
      commit: f6fbc8f840df1a414f31a60953ae514fa497c748
      spec: 1.0.0
      +SYSTEMD +SELINUX +APPARMOR +CAP +SECCOMP +EBPF +CRIU +YAJL
  os: linux
  remoteSocket:
    path: /run/podman/podman.sock
  security:
    apparmorEnabled: false
    capabilities: CAP_CHOWN,CAP_DAC_OVERRIDE,CAP_FOWNER,CAP_FSETID,CAP_KILL,CAP_NET_BIND_SERVICE,CAP_SETFCAP,CAP_SETGID,CAP_SETPCAP,CAP_SETUID,CAP_SYS_CHROOT
    rootless: false
    seccompEnabled: true
    seccompProfilePath: /etc/containers/seccomp.json
    selinuxEnabled: false
  serviceIsRemote: false
  slirp4netns:
    executable: /usr/bin/slirp4netns
    package: /usr/bin/slirp4netns is owned by slirp4netns 1.1.12-1
    version: |-
      slirp4netns version 1.1.12
      commit: 7a104a101aa3278a2152351a082a6df71f57c9a3
      libslirp: 4.6.1
      SLIRP_CONFIG_VERSION_MAX: 3
      libseccomp: 2.5.3
  swapFree: 0
  swapTotal: 0
  uptime: 15h 41m 33.6s (Approximately 0.62 days)
plugins:
  log:
  - k8s-file
  - none
  - journald
  network:
  - bridge
  - macvlan
  volume:
  - local
registries: {}
store:
  configFile: /etc/containers/storage.conf
  containerStore:
    number: 0
    paused: 0
    running: 0
    stopped: 0
  graphDriverName: overlay
  graphOptions: {}
  graphRoot: /var/lib/containers/storage
  graphStatus:
    Backing Filesystem: extfs
    Native Overlay Diff: "false"
    Supports d_type: "true"
    Using metacopy: "true"
  imageStore:
    number: 0
  runRoot: /run/containers/storage
  volumePath: /var/lib/containers/storage/volumes
version:
  APIVersion: 3.4.4
  Built: 1639074640
  BuiltTime: Thu Dec  9 13:30:40 2021
  GitCommit: f6526ada1025c2e3f88745ba83b8b461ca659933
  GoVersion: go1.17.4
  OsArch: linux/amd64
  Version: 3.4.4

+ findmnt --target=/var/lib/containers/storage
TARGET SOURCE    FSTYPE OPTIONS
/      /dev/sda7 ext4   rw,relatime

+ df -h /var/lib/containers/storage
Filesystem      Size  Used Avail Use% Mounted on
/dev/sda7        30G   25G  3.1G  89% /

+ findmnt --target=/run/containers/storage
TARGET SOURCE FSTYPE OPTIONS
/run   run    tmpfs  rw,nosuid,nodev,relatime,mode=755,inode64

+ df -h /run/containers/storage
Filesystem      Size  Used Avail Use% Mounted on
run             7.7G  1.3M  7.7G   1% /run

+ podman build -t lower_layer .
STEP 1/5: FROM ubuntu:20.04
Resolved "ubuntu" as an alias (/etc/containers/registries.conf.d/00-shortnames.conf)
Trying to pull docker.io/library/ubuntu:20.04...
Getting image source signatures
Copying blob 08c01a0ec47e done  
Copying config 54c9d81cbb done  
Writing manifest to image destination
Storing signatures
STEP 2/5: RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y strace
Get:1 http://archive.ubuntu.com/ubuntu focal InRelease [265 kB]
Get:2 http://security.ubuntu.com/ubuntu focal-security InRelease [114 kB]
Get:3 http://archive.ubuntu.com/ubuntu focal-updates InRelease [114 kB]
Get:4 http://security.ubuntu.com/ubuntu focal-security/multiverse amd64 Packages [25.8 kB]
Get:5 http://archive.ubuntu.com/ubuntu focal-backports InRelease [108 kB]
Get:6 http://security.ubuntu.com/ubuntu focal-security/universe amd64 Packages [841 kB]
Get:7 http://archive.ubuntu.com/ubuntu focal/restricted amd64 Packages [33.4 kB]
Get:8 http://archive.ubuntu.com/ubuntu focal/main amd64 Packages [1275 kB]
Get:9 http://archive.ubuntu.com/ubuntu focal/multiverse amd64 Packages [177 kB]
Get:10 http://archive.ubuntu.com/ubuntu focal/universe amd64 Packages [11.3 MB]
Get:11 http://security.ubuntu.com/ubuntu focal-security/restricted amd64 Packages [982 kB]
Get:12 http://archive.ubuntu.com/ubuntu focal-updates/main amd64 Packages [2006 kB]
Get:13 http://archive.ubuntu.com/ubuntu focal-updates/universe amd64 Packages [1134 kB]
Get:14 http://security.ubuntu.com/ubuntu focal-security/main amd64 Packages [1577 kB]
Get:15 http://archive.ubuntu.com/ubuntu focal-updates/restricted amd64 Packages [1052 kB]
Get:16 http://archive.ubuntu.com/ubuntu focal-updates/multiverse amd64 Packages [29.4 kB]
Get:17 http://archive.ubuntu.com/ubuntu focal-backports/main amd64 Packages [50.8 kB]
Get:18 http://archive.ubuntu.com/ubuntu focal-backports/universe amd64 Packages [24.8 kB]
Fetched 21.2 MB in 7s (3184 kB/s)
Reading package lists...
Reading package lists...
Building dependency tree...
Reading state information...
The following additional packages will be installed:
  libunwind8
The following NEW packages will be installed:
  libunwind8 strace
0 upgraded, 2 newly installed, 0 to remove and 10 not upgraded.
Need to get 428 kB of archives.
After this operation, 1844 kB of additional disk space will be used.
Get:1 http://archive.ubuntu.com/ubuntu focal/main amd64 libunwind8 amd64 1.2.1-9build1 [47.6 kB]
Get:2 http://archive.ubuntu.com/ubuntu focal-updates/main amd64 strace amd64 5.5-3ubuntu1 [380 kB]
debconf: delaying package configuration, since apt-utils is not installed
Fetched 428 kB in 1s (400 kB/s)
Selecting previously unselected package libunwind8:amd64.
(Reading database ... 4127 files and directories currently installed.)
Preparing to unpack .../libunwind8_1.2.1-9build1_amd64.deb ...
Unpacking libunwind8:amd64 (1.2.1-9build1) ...
Selecting previously unselected package strace.
Preparing to unpack .../strace_5.5-3ubuntu1_amd64.deb ...
Unpacking strace (5.5-3ubuntu1) ...
Setting up libunwind8:amd64 (1.2.1-9build1) ...
Setting up strace (5.5-3ubuntu1) ...
Processing triggers for libc-bin (2.31-0ubuntu9.2) ...
--> 1d1d8231dc8
STEP 3/5: COPY rename /usr/bin/
--> dcbe579fc68
STEP 4/5: RUN mkdir -p /home/dir_lower
--> 0ed6e090c37
STEP 5/5: RUN touch /home/file_lower
COMMIT lower_layer
--> a8c1a0981e7
Successfully tagged localhost/lower_layer:latest
a8c1a0981e75312e9b8689cb75eeda62625cbd28924707b1e3b354aac4be4db8

Run the built container image, on overlay (via (kernel)) (rootless: false):
+ mkdir /home/dir_upper
+ touch /home/file_upper
+ ls -l /home
total 8
drwxr-xr-x 2 root root 4096 Feb 22 09:18 dir_lower
drwxr-xr-x 2 root root 4096 Feb 22 09:18 dir_upper
-rw-r--r-- 1 root root    0 Feb 22 09:18 file_lower
-rw-r--r-- 1 root root    0 Feb 22 09:18 file_upper
+ strace -e rename rename /home/file_upper /home/file_upper.bak
rename("/home/file_upper", "/home/file_upper.bak") = 0
+++ exited with 0 +++
+ strace -e rename rename /home/dir_upper /home/dir_upper.bak
rename("/home/dir_upper", "/home/dir_upper.bak") = 0
+++ exited with 0 +++
+ strace -e rename rename /home/file_lower /home/file_lower.bak
rename("/home/file_lower", "/home/file_lower.bak") = 0
+++ exited with 0 +++
+ strace -e rename rename /home/dir_lower /home/dir_lower.bak
rename("/home/dir_lower", "/home/dir_lower.bak") = 0
+++ exited with 0 +++
+ ls /home
dir_lower.bak  dir_upper.bak  file_lower.bak  file_upper.bak
rootless, overlay (w/ FUSE)
$ STORAGE_DRIVER=overlay STORAGE_OPTS="overlay.mount_program=/usr/bin/fuse-overlayfs" sh repro.sh 
+ podman version
Version:      3.4.4
API Version:  3.4.4
Go Version:   go1.17.4
Git Commit:   f6526ada1025c2e3f88745ba83b8b461ca659933
Built:        Thu Dec  9 13:30:40 2021
OS/Arch:      linux/amd64
+ podman info --debug
host:
  arch: amd64
  buildahVersion: 1.23.1
  cgroupControllers:
  - memory
  - pids
  cgroupManager: systemd
  cgroupVersion: v2
  conmon:
    package: /usr/bin/conmon is owned by conmon 1:2.1.0-1
    path: /usr/bin/conmon
    version: 'conmon version 2.1.0, commit: bdb4f6e56cd193d40b75ffc9725d4b74a18cb33c'
  cpus: 4
  distribution:
    distribution: arch
    version: unknown
  eventLogger: journald
  hostname: requiem
  idMappings:
    gidmap:
    - container_id: 0
      host_id: 1001
      size: 1
    - container_id: 1
      host_id: 100000
      size: 65537
    uidmap:
    - container_id: 0
      host_id: 1001
      size: 1
    - container_id: 1
      host_id: 100000
      size: 65537
  kernel: 5.16.10-arch1-1
  linkmode: dynamic
  logDriver: journald
  memFree: 9578074112
  memTotal: 16446435328
  ociRuntime:
    name: crun
    package: /usr/bin/crun is owned by crun 1.4.2-1
    path: /usr/bin/crun
    version: |-
      crun version 1.4.2
      commit: f6fbc8f840df1a414f31a60953ae514fa497c748
      spec: 1.0.0
      +SYSTEMD +SELINUX +APPARMOR +CAP +SECCOMP +EBPF +CRIU +YAJL
  os: linux
  remoteSocket:
    path: /run/user/1001/podman/podman.sock
  security:
    apparmorEnabled: false
    capabilities: CAP_CHOWN,CAP_DAC_OVERRIDE,CAP_FOWNER,CAP_FSETID,CAP_KILL,CAP_NET_BIND_SERVICE,CAP_SETFCAP,CAP_SETGID,CAP_SETPCAP,CAP_SETUID,CAP_SYS_CHROOT
    rootless: true
    seccompEnabled: true
    seccompProfilePath: /etc/containers/seccomp.json
    selinuxEnabled: false
  serviceIsRemote: false
  slirp4netns:
    executable: /usr/bin/slirp4netns
    package: /usr/bin/slirp4netns is owned by slirp4netns 1.1.12-1
    version: |-
      slirp4netns version 1.1.12
      commit: 7a104a101aa3278a2152351a082a6df71f57c9a3
      libslirp: 4.6.1
      SLIRP_CONFIG_VERSION_MAX: 3
      libseccomp: 2.5.3
  swapFree: 0
  swapTotal: 0
  uptime: 15h 42m 36.29s (Approximately 0.62 days)
plugins:
  log:
  - k8s-file
  - none
  - journald
  network:
  - bridge
  - macvlan
  volume:
  - local
registries: {}
store:
  configFile: /home/kousu/.config/containers/storage.conf
  containerStore:
    number: 0
    paused: 0
    running: 0
    stopped: 0
  graphDriverName: overlay
  graphOptions:
    overlay.mount_program:
      Executable: /usr/bin/fuse-overlayfs
      Package: /usr/bin/fuse-overlayfs is owned by fuse-overlayfs 1.8.2-1
      Version: |-
        fusermount3 version: 3.10.5
        fuse-overlayfs: version 1.8.2
        FUSE library version 3.10.5
        using FUSE kernel interface version 7.31
  graphRoot: /home/kousu/.local/share/containers/storage
  graphStatus:
    Backing Filesystem: extfs
    Native Overlay Diff: "false"
    Supports d_type: "true"
    Using metacopy: "false"
  imageStore:
    number: 5
  runRoot: /run/user/1001/containers
  volumePath: /home/kousu/.local/share/containers/storage/volumes
version:
  APIVersion: 3.4.4
  Built: 1639074640
  BuiltTime: Thu Dec  9 13:30:40 2021
  GitCommit: f6526ada1025c2e3f88745ba83b8b461ca659933
  GoVersion: go1.17.4
  OsArch: linux/amd64
  Version: 3.4.4

+ findmnt --target=/home/kousu/.local/share/containers/storage
TARGET SOURCE    FSTYPE OPTIONS
/home  /dev/sda9 ext2   rw,relatime

+ df -h /home/kousu/.local/share/containers/storage
Filesystem      Size  Used Avail Use% Mounted on
/dev/sda9       391G  333G   38G  90% /home

+ findmnt --target=/run/user/1001/containers
TARGET         SOURCE FSTYPE OPTIONS
/run/user/1001 tmpfs  tmpfs  rw,nosuid,nodev,relatime,size=14454876k,nr_inodes=401524,mode=700,uid=1001,gid=1001,inode64

+ df -h /run/user/1001/containers
Filesystem      Size  Used Avail Use% Mounted on
tmpfs            14G  1.4M   14G   1% /run/user/1001

+ podman build -t lower_layer .
STEP 1/5: FROM ubuntu:20.04
STEP 2/5: RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y strace
--> Using cache 5aa8fdfdccf979dd68ec92ded415d56c7a6fea72a29a6523bcdb18750f5266d7
--> 5aa8fdfdccf
STEP 3/5: COPY rename /usr/bin/
--> Using cache aa7df45abceb9727efa5a87ea7a1ebbae8cbc4f8ea96fceda4f9a05bad543803
--> aa7df45abce
STEP 4/5: RUN mkdir -p /home/dir_lower
--> Using cache 9aa09ffa23e3b7ebe9aae02a959a601e1362c420d07fcb9a454e29065e7560d4
--> 9aa09ffa23e
STEP 5/5: RUN touch /home/file_lower
--> Using cache 6bbcc23768bf52369b2339e4e5c7ed0df0fefb26530bc98978f3eaa3e296b6b5
COMMIT lower_layer
--> 6bbcc23768b
Successfully tagged localhost/lower_layer:latest
6bbcc23768bf52369b2339e4e5c7ed0df0fefb26530bc98978f3eaa3e296b6b5

Run the built container image, on overlay (via fuse-overlayfs) (rootless: true):
+ mkdir /home/dir_upper
+ touch /home/file_upper
+ ls -l /home
total 8
drwxr-xr-x 2 root root 4096 Feb 22 09:17 dir_lower
drwxr-xr-x 2 root root 4096 Feb 22 09:18 dir_upper
-rw-r--r-- 1 root root    0 Feb 22 09:17 file_lower
-rw-r--r-- 1 root root    0 Feb 22 09:18 file_upper
+ strace -e rename rename /home/file_upper /home/file_upper.bak
rename("/home/file_upper", "/home/file_upper.bak") = 0
+++ exited with 0 +++
+ strace -e rename rename /home/dir_upper /home/dir_upper.bak
rename("/home/dir_upper", "/home/dir_upper.bak") = 0
+++ exited with 0 +++
+ strace -e rename rename /home/file_lower /home/file_lower.bak
rename("/home/file_lower", "/home/file_lower.bak") = 0
+++ exited with 0 +++
+ strace -e rename rename /home/dir_lower /home/dir_lower.bak
rename("/home/dir_lower", "/home/dir_lower.bak") = -1 EXDEV (Invalid cross-device link)
rename: Invalid cross-device link
+++ exited with 2 +++
rootful, overlay (w/ FUSE)
$ sudo STORAGE_DRIVER=overlay STORAGE_OPTS="overlay.mount_program=/usr/bin/fuse-overlayfs" sh repro.sh 
+ podman version
Version:      3.4.4
API Version:  3.4.4
Go Version:   go1.17.4
Git Commit:   f6526ada1025c2e3f88745ba83b8b461ca659933
Built:        Thu Dec  9 13:30:40 2021
OS/Arch:      linux/amd64
+ podman info --debug
host:
  arch: amd64
  buildahVersion: 1.23.1
  cgroupControllers:
  - cpuset
  - cpu
  - io
  - memory
  - hugetlb
  - pids
  - rdma
  - misc
  cgroupManager: systemd
  cgroupVersion: v2
  conmon:
    package: /usr/bin/conmon is owned by conmon 1:2.1.0-1
    path: /usr/bin/conmon
    version: 'conmon version 2.1.0, commit: bdb4f6e56cd193d40b75ffc9725d4b74a18cb33c'
  cpus: 4
  distribution:
    distribution: arch
    version: unknown
  eventLogger: journald
  hostname: requiem
  idMappings:
    gidmap: null
    uidmap: null
  kernel: 5.16.10-arch1-1
  linkmode: dynamic
  logDriver: journald
  memFree: 9590231040
  memTotal: 16446435328
  ociRuntime:
    name: crun
    package: /usr/bin/crun is owned by crun 1.4.2-1
    path: /usr/bin/crun
    version: |-
      crun version 1.4.2
      commit: f6fbc8f840df1a414f31a60953ae514fa497c748
      spec: 1.0.0
      +SYSTEMD +SELINUX +APPARMOR +CAP +SECCOMP +EBPF +CRIU +YAJL
  os: linux
  remoteSocket:
    path: /run/podman/podman.sock
  security:
    apparmorEnabled: false
    capabilities: CAP_CHOWN,CAP_DAC_OVERRIDE,CAP_FOWNER,CAP_FSETID,CAP_KILL,CAP_NET_BIND_SERVICE,CAP_SETFCAP,CAP_SETGID,CAP_SETPCAP,CAP_SETUID,CAP_SYS_CHROOT
    rootless: false
    seccompEnabled: true
    seccompProfilePath: /etc/containers/seccomp.json
    selinuxEnabled: false
  serviceIsRemote: false
  slirp4netns:
    executable: /usr/bin/slirp4netns
    package: /usr/bin/slirp4netns is owned by slirp4netns 1.1.12-1
    version: |-
      slirp4netns version 1.1.12
      commit: 7a104a101aa3278a2152351a082a6df71f57c9a3
      libslirp: 4.6.1
      SLIRP_CONFIG_VERSION_MAX: 3
      libseccomp: 2.5.3
  swapFree: 0
  swapTotal: 0
  uptime: 15h 43m 1.04s (Approximately 0.62 days)
plugins:
  log:
  - k8s-file
  - none
  - journald
  network:
  - bridge
  - macvlan
  volume:
  - local
registries: {}
store:
  configFile: /etc/containers/storage.conf
  containerStore:
    number: 0
    paused: 0
    running: 0
    stopped: 0
  graphDriverName: overlay
  graphOptions:
    overlay.mount_program:
      Executable: /usr/bin/fuse-overlayfs
      Package: /usr/bin/fuse-overlayfs is owned by fuse-overlayfs 1.8.2-1
      Version: |-
        fusermount3 version: 3.10.5
        fuse-overlayfs: version 1.8.2
        FUSE library version 3.10.5
        using FUSE kernel interface version 7.31
  graphRoot: /var/lib/containers/storage
  graphStatus:
    Backing Filesystem: extfs
    Native Overlay Diff: "false"
    Supports d_type: "true"
    Using metacopy: "false"
  imageStore:
    number: 5
  runRoot: /run/containers/storage
  volumePath: /var/lib/containers/storage/volumes
version:
  APIVersion: 3.4.4
  Built: 1639074640
  BuiltTime: Thu Dec  9 13:30:40 2021
  GitCommit: f6526ada1025c2e3f88745ba83b8b461ca659933
  GoVersion: go1.17.4
  OsArch: linux/amd64
  Version: 3.4.4

+ findmnt --target=/var/lib/containers/storage
TARGET SOURCE    FSTYPE OPTIONS
/      /dev/sda7 ext4   rw,relatime

+ df -h /var/lib/containers/storage
Filesystem      Size  Used Avail Use% Mounted on
/dev/sda7        30G   25G  3.0G  90% /

+ findmnt --target=/run/containers/storage
TARGET SOURCE FSTYPE OPTIONS
/run   run    tmpfs  rw,nosuid,nodev,relatime,mode=755,inode64

+ df -h /run/containers/storage
Filesystem      Size  Used Avail Use% Mounted on
run             7.7G  1.4M  7.7G   1% /run

+ podman build -t lower_layer .
STEP 1/5: FROM ubuntu:20.04
STEP 2/5: RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y strace
--> Using cache 1d1d8231dc86b776c476cb472ebed709fe8eeaadb32b579c943fca0a28de6ef3
--> 1d1d8231dc8
STEP 3/5: COPY rename /usr/bin/
--> Using cache dcbe579fc6834ecb3e11a0467b2f9d623b27b370a74276a60503168b7acb9b07
--> dcbe579fc68
STEP 4/5: RUN mkdir -p /home/dir_lower
--> Using cache 0ed6e090c37db30b97641ac52366f7da3f703b3854c3a080f133d32ca5ed0c99
--> 0ed6e090c37
STEP 5/5: RUN touch /home/file_lower
--> Using cache a8c1a0981e75312e9b8689cb75eeda62625cbd28924707b1e3b354aac4be4db8
COMMIT lower_layer
--> a8c1a0981e7
Successfully tagged localhost/lower_layer:latest
a8c1a0981e75312e9b8689cb75eeda62625cbd28924707b1e3b354aac4be4db8

Run the built container image, on overlay (via fuse-overlayfs) (rootless: false):
+ mkdir /home/dir_upper
+ touch /home/file_upper
+ ls -l /home
total 8
drwxr-xr-x 2 root root 4096 Feb 22 09:18 dir_lower
drwxr-xr-x 2 root root 4096 Feb 22 09:19 dir_upper
-rw-r--r-- 1 root root    0 Feb 22 09:18 file_lower
-rw-r--r-- 1 root root    0 Feb 22 09:19 file_upper
+ strace -e rename rename /home/file_upper /home/file_upper.bak
rename("/home/file_upper", "/home/file_upper.bak") = 0
+++ exited with 0 +++
+ strace -e rename rename /home/dir_upper /home/dir_upper.bak
rename("/home/dir_upper", "/home/dir_upper.bak") = 0
+++ exited with 0 +++
+ strace -e rename rename /home/file_lower /home/file_lower.bak
rename("/home/file_lower", "/home/file_lower.bak") = 0
+++ exited with 0 +++
+ strace -e rename rename /home/dir_lower /home/dir_lower.bak
rename("/home/dir_lower", "/home/dir_lower.bak") = -1 EXDEV (Invalid cross-device link)
rename: Invalid cross-device link
+++ exited with 2 +++

Output of podman version:

$ podman version
Version:      3.4.4
API Version:  3.4.4
Go Version:   go1.17.4
Git Commit:   f6526ada1025c2e3f88745ba83b8b461ca659933
Built:        Thu Dec  9 13:30:40 2021
OS/Arch:      linux/amd64

Package info:

$ pacman -Qi podman
Name            : podman
Version         : 3.4.4-1
Description     : Tool and library for running OCI-based containers in pods
Architecture    : x86_64
URL             : https://github.com/containers/podman
Licenses        : Apache
Groups          : None
Provides        : None
Depends On      : cni-plugins  conmon  containers-common  crun  fuse-overlayfs  iptables  libdevmapper.so=1.02-64  libgpgme.so=11-64  libseccomp.so=2-64  slirp4netns
Optional Deps   : apparmor: for AppArmor support
                  btrfs-progs: support btrfs backend devices [installed]
                  catatonit: --init flag support [installed]
                  podman-docker: for Docker-compatible CLI [installed]
Required By     : podman-docker
Optional For    : None
Conflicts With  : None
Replaces        : None
Installed Size  : 72.79 MiB
Packager        : David Runge <dvzrv@archlinux.org>
Build Date      : Thu 09 Dec 2021 01:30:40 PM
Install Date    : Tue 14 Dec 2021 11:12:10 AM
Install Reason  : Explicitly installed
Install Script  : No
Validated By    : Signature

@kousu
Copy link
Contributor

kousu commented Feb 22, 2022

To test out what role Native Overlay Diff: "true" plays, I made and mounted btrfs on both storage locations:

$ truncate -s 15G disk.img && mkfs.btrfs disk.img && sudo mount -o loop disk.img ~/.local/share/containers/ && rm disk.img && sudo chown $(whoami):$(whoami) ~/.local/share/containers
$ truncate -s 15G disk.img && mkfs.btrfs disk.img && sudo mount -o loop disk.img /var/lib/containers/ && rm disk.img

I got identical results this way so btrfs does not seem to have an effect:

STORAGE_DRIVER=vfs STORAGE_DRIVER=overlay STORAGE_DRIVER=overlay + fuse-overlayfs
rootless 🟢 0 🔴 EXDEV 🔴 EXDEV
rootful 🟢 0 🟢 0 🔴 EXDEV

Curiously, only rootless overlay mode, the one OP originally insisted was buggy, reports Native Overlay Diff: "true".

But I'm not sure why @Hi-Angel's system is passing the third column where mine is failing. What did we do differently? @Hi-Angel, would you be willing to try my repro.sh on your system? Are you sure fuse-overlayfs is what fixed it for you?

Full logs
rootless, vfs
$ STORAGE_DRIVER=vfs STORAGE_OPTS="" sh repro.sh 
ERRO[0000] User-selected graph driver "vfs" overwritten by graph driver "overlay" from database - delete libpod local files to resolve 
In order to switch graph drivers, you must erase your existing containers/images/cache.
ERRO[0000] User-selected graph driver "vfs" overwritten by graph driver "overlay" from database - delete libpod local files to resolve 
ERRO[0000] User-selected graph driver "vfs" overwritten by graph driver "overlay" from database - delete libpod local files to resolve 

WARNING! This will remove:
        - all containers
        - all pods
        - all images
        - all build cache
Are you sure you want to continue? [y/N] y
ERRO[0001] User-selected graph driver "vfs" overwritten by graph driver "overlay" from database - delete libpod local files to resolve 
+ podman version
Version:      3.4.4
API Version:  3.4.4
Go Version:   go1.17.4
Git Commit:   f6526ada1025c2e3f88745ba83b8b461ca659933
Built:        Thu Dec  9 13:30:40 2021
OS/Arch:      linux/amd64
+ podman info --debug
host:
  arch: amd64
  buildahVersion: 1.23.1
  cgroupControllers:
  - memory
  - pids
  cgroupManager: systemd
  cgroupVersion: v2
  conmon:
    package: /usr/bin/conmon is owned by conmon 1:2.1.0-1
    path: /usr/bin/conmon
    version: 'conmon version 2.1.0, commit: bdb4f6e56cd193d40b75ffc9725d4b74a18cb33c'
  cpus: 4
  distribution:
    distribution: arch
    version: unknown
  eventLogger: journald
  hostname: requiem
  idMappings:
    gidmap:
    - container_id: 0
      host_id: 1001
      size: 1
    - container_id: 1
      host_id: 100000
      size: 65537
    uidmap:
    - container_id: 0
      host_id: 1001
      size: 1
    - container_id: 1
      host_id: 100000
      size: 65537
  kernel: 5.16.10-arch1-1
  linkmode: dynamic
  logDriver: journald
  memFree: 9213206528
  memTotal: 16446435328
  ociRuntime:
    name: crun
    package: /usr/bin/crun is owned by crun 1.4.2-1
    path: /usr/bin/crun
    version: |-
      crun version 1.4.2
      commit: f6fbc8f840df1a414f31a60953ae514fa497c748
      spec: 1.0.0
      +SYSTEMD +SELINUX +APPARMOR +CAP +SECCOMP +EBPF +CRIU +YAJL
  os: linux
  remoteSocket:
    path: /run/user/1001/podman/podman.sock
  security:
    apparmorEnabled: false
    capabilities: CAP_CHOWN,CAP_DAC_OVERRIDE,CAP_FOWNER,CAP_FSETID,CAP_KILL,CAP_NET_BIND_SERVICE,CAP_SETFCAP,CAP_SETGID,CAP_SETPCAP,CAP_SETUID,CAP_SYS_CHROOT
    rootless: true
    seccompEnabled: true
    seccompProfilePath: /etc/containers/seccomp.json
    selinuxEnabled: false
  serviceIsRemote: false
  slirp4netns:
    executable: /usr/bin/slirp4netns
    package: /usr/bin/slirp4netns is owned by slirp4netns 1.1.12-1
    version: |-
      slirp4netns version 1.1.12
      commit: 7a104a101aa3278a2152351a082a6df71f57c9a3
      libslirp: 4.6.1
      SLIRP_CONFIG_VERSION_MAX: 3
      libseccomp: 2.5.3
  swapFree: 0
  swapTotal: 0
  uptime: 16h 18m 42.9s (Approximately 0.67 days)
plugins:
  log:
  - k8s-file
  - none
  - journald
  network:
  - bridge
  - macvlan
  volume:
  - local
registries: {}
store:
  configFile: /home/kousu/.config/containers/storage.conf
  containerStore:
    number: 0
    paused: 0
    running: 0
    stopped: 0
  graphDriverName: vfs
  graphOptions: {}
  graphRoot: /home/kousu/.local/share/containers/storage
  graphStatus: {}
  imageStore:
    number: 0
  runRoot: /run/user/1001/containers
  volumePath: /home/kousu/.local/share/containers/storage/volumes
version:
  APIVersion: 3.4.4
  Built: 1639074640
  BuiltTime: Thu Dec  9 13:30:40 2021
  GitCommit: f6526ada1025c2e3f88745ba83b8b461ca659933
  GoVersion: go1.17.4
  OsArch: linux/amd64
  Version: 3.4.4

+ findmnt --target=/home/kousu/.local/share/containers/storage
TARGET                              SOURCE     FSTYPE OPTIONS
/home/kousu/.local/share/containers /dev/loop0 btrfs  rw,relatime,space_cache=v2,subvolid=5,subvol=/

+ df -h /home/kousu/.local/share/containers/storage
Filesystem      Size  Used Avail Use% Mounted on
/dev/loop0       15G   58M   15G   1% /home/kousu/.local/share/containers

+ findmnt --target=/run/user/1001/containers
TARGET         SOURCE FSTYPE OPTIONS
/run/user/1001 tmpfs  tmpfs  rw,nosuid,nodev,relatime,size=14454876k,nr_inodes=401524,mode=700,uid=1001,gid=1001,inode64

+ df -h /run/user/1001/containers
Filesystem      Size  Used Avail Use% Mounted on
tmpfs            14G  1.4M   14G   1% /run/user/1001

+ podman build -t lower_layer .
STEP 1/5: FROM ubuntu:20.04
Resolved "ubuntu" as an alias (/etc/containers/registries.conf.d/00-shortnames.conf)
Trying to pull docker.io/library/ubuntu:20.04...
Getting image source signatures
Copying blob 08c01a0ec47e done  
Copying config 54c9d81cbb done  
Writing manifest to image destination
Storing signatures
STEP 2/5: RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y strace
Get:1 http://archive.ubuntu.com/ubuntu focal InRelease [265 kB]
Get:2 http://security.ubuntu.com/ubuntu focal-security InRelease [114 kB]
Get:3 http://security.ubuntu.com/ubuntu focal-security/universe amd64 Packages [842 kB]
Get:4 http://archive.ubuntu.com/ubuntu focal-updates InRelease [114 kB]
Get:5 http://security.ubuntu.com/ubuntu focal-security/multiverse amd64 Packages [25.8 kB]
Get:6 http://security.ubuntu.com/ubuntu focal-security/restricted amd64 Packages [982 kB]
Get:7 http://security.ubuntu.com/ubuntu focal-security/main amd64 Packages [1577 kB]
Get:8 http://archive.ubuntu.com/ubuntu focal-backports InRelease [108 kB]
Get:9 http://archive.ubuntu.com/ubuntu focal/restricted amd64 Packages [33.4 kB]
Get:10 http://archive.ubuntu.com/ubuntu focal/universe amd64 Packages [11.3 MB]
Get:11 http://archive.ubuntu.com/ubuntu focal/multiverse amd64 Packages [177 kB]
Get:12 http://archive.ubuntu.com/ubuntu focal/main amd64 Packages [1275 kB]
Get:13 http://archive.ubuntu.com/ubuntu focal-updates/universe amd64 Packages [1134 kB]
Get:14 http://archive.ubuntu.com/ubuntu focal-updates/restricted amd64 Packages [1052 kB]
Get:15 http://archive.ubuntu.com/ubuntu focal-updates/multiverse amd64 Packages [29.4 kB]
Get:16 http://archive.ubuntu.com/ubuntu focal-updates/main amd64 Packages [2006 kB]
Get:17 http://archive.ubuntu.com/ubuntu focal-backports/universe amd64 Packages [24.8 kB]
Get:18 http://archive.ubuntu.com/ubuntu focal-backports/main amd64 Packages [50.8 kB]
Fetched 21.2 MB in 21s (1001 kB/s)
Reading package lists...
Reading package lists...
Building dependency tree...
Reading state information...
The following additional packages will be installed:
  libunwind8
The following NEW packages will be installed:
  libunwind8 strace
0 upgraded, 2 newly installed, 0 to remove and 10 not upgraded.
Need to get 428 kB of archives.
After this operation, 1844 kB of additional disk space will be used.
Get:1 http://archive.ubuntu.com/ubuntu focal/main amd64 libunwind8 amd64 1.2.1-9build1 [47.6 kB]
Get:2 http://archive.ubuntu.com/ubuntu focal-updates/main amd64 strace amd64 5.5-3ubuntu1 [380 kB]
debconf: delaying package configuration, since apt-utils is not installed
Fetched 428 kB in 1s (545 kB/s)
Selecting previously unselected package libunwind8:amd64.
(Reading database ... 4127 files and directories currently installed.)
Preparing to unpack .../libunwind8_1.2.1-9build1_amd64.deb ...
Unpacking libunwind8:amd64 (1.2.1-9build1) ...
Selecting previously unselected package strace.
Preparing to unpack .../strace_5.5-3ubuntu1_amd64.deb ...
Unpacking strace (5.5-3ubuntu1) ...
Setting up libunwind8:amd64 (1.2.1-9build1) ...
Setting up strace (5.5-3ubuntu1) ...
Processing triggers for libc-bin (2.31-0ubuntu9.2) ...
--> 14cbfaf3eca
STEP 3/5: COPY rename /usr/bin/
--> e72a032cb10
STEP 4/5: RUN mkdir -p /home/dir_lower
--> 753b5b59d38
STEP 5/5: RUN touch /home/file_lower
COMMIT lower_layer
--> c278ccf7853
Successfully tagged localhost/lower_layer:latest
c278ccf7853ccf4f194f08eabc56f0a8e83050a1d9a3bd7415a5ba309ed2e5ec

Run the built container image, on vfs (via (kernel)) (rootless: true):
+ mkdir /home/dir_upper
+ touch /home/file_upper
+ ls -l /home
total 0
drwxr-xr-x 1 root root 0 Feb 22 09:55 dir_lower
drwxr-xr-x 1 root root 0 Feb 22 09:55 dir_upper
-rw-r--r-- 1 root root 0 Feb 22 09:55 file_lower
-rw-r--r-- 1 root root 0 Feb 22 09:55 file_upper
+ strace -e rename rename /home/file_upper /home/file_upper.bak
rename("/home/file_upper", "/home/file_upper.bak") = 0
+++ exited with 0 +++
+ strace -e rename rename /home/dir_upper /home/dir_upper.bak
rename("/home/dir_upper", "/home/dir_upper.bak") = 0
+++ exited with 0 +++
+ strace -e rename rename /home/file_lower /home/file_lower.bak
rename("/home/file_lower", "/home/file_lower.bak") = 0
+++ exited with 0 +++
+ strace -e rename rename /home/dir_lower /home/dir_lower.bak
rename("/home/dir_lower", "/home/dir_lower.bak") = 0
+++ exited with 0 +++
+ ls /home
dir_lower.bak  dir_upper.bak  file_lower.bak  file_upper.bak
rootful, vfs
$ sudo STORAGE_DRIVER=vfs STORAGE_OPTS="" sh repro.sh 
+ podman version
Version:      3.4.4
API Version:  3.4.4
Go Version:   go1.17.4
Git Commit:   f6526ada1025c2e3f88745ba83b8b461ca659933
Built:        Thu Dec  9 13:30:40 2021
OS/Arch:      linux/amd64
+ podman info --debug
host:
  arch: amd64
  buildahVersion: 1.23.1
  cgroupControllers:
  - cpuset
  - cpu
  - io
  - memory
  - hugetlb
  - pids
  - rdma
  - misc
  cgroupManager: systemd
  cgroupVersion: v2
  conmon:
    package: /usr/bin/conmon is owned by conmon 1:2.1.0-1
    path: /usr/bin/conmon
    version: 'conmon version 2.1.0, commit: bdb4f6e56cd193d40b75ffc9725d4b74a18cb33c'
  cpus: 4
  distribution:
    distribution: arch
    version: unknown
  eventLogger: journald
  hostname: requiem
  idMappings:
    gidmap: null
    uidmap: null
  kernel: 5.16.10-arch1-1
  linkmode: dynamic
  logDriver: journald
  memFree: 8772284416
  memTotal: 16446435328
  ociRuntime:
    name: crun
    package: /usr/bin/crun is owned by crun 1.4.2-1
    path: /usr/bin/crun
    version: |-
      crun version 1.4.2
      commit: f6fbc8f840df1a414f31a60953ae514fa497c748
      spec: 1.0.0
      +SYSTEMD +SELINUX +APPARMOR +CAP +SECCOMP +EBPF +CRIU +YAJL
  os: linux
  remoteSocket:
    path: /run/podman/podman.sock
  security:
    apparmorEnabled: false
    capabilities: CAP_CHOWN,CAP_DAC_OVERRIDE,CAP_FOWNER,CAP_FSETID,CAP_KILL,CAP_NET_BIND_SERVICE,CAP_SETFCAP,CAP_SETGID,CAP_SETPCAP,CAP_SETUID,CAP_SYS_CHROOT
    rootless: false
    seccompEnabled: true
    seccompProfilePath: /etc/containers/seccomp.json
    selinuxEnabled: false
  serviceIsRemote: false
  slirp4netns:
    executable: /usr/bin/slirp4netns
    package: /usr/bin/slirp4netns is owned by slirp4netns 1.1.12-1
    version: |-
      slirp4netns version 1.1.12
      commit: 7a104a101aa3278a2152351a082a6df71f57c9a3
      libslirp: 4.6.1
      SLIRP_CONFIG_VERSION_MAX: 3
      libseccomp: 2.5.3
  swapFree: 0
  swapTotal: 0
  uptime: 16h 29m 20.82s (Approximately 0.67 days)
plugins:
  log:
  - k8s-file
  - none
  - journald
  network:
  - bridge
  - macvlan
  volume:
  - local
registries: {}
store:
  configFile: /etc/containers/storage.conf
  containerStore:
    number: 0
    paused: 0
    running: 0
    stopped: 0
  graphDriverName: vfs
  graphOptions: {}
  graphRoot: /var/lib/containers/storage
  graphStatus: {}
  imageStore:
    number: 0
  runRoot: /run/containers/storage
  volumePath: /var/lib/containers/storage/volumes
version:
  APIVersion: 3.4.4
  Built: 1639074640
  BuiltTime: Thu Dec  9 13:30:40 2021
  GitCommit: f6526ada1025c2e3f88745ba83b8b461ca659933
  GoVersion: go1.17.4
  OsArch: linux/amd64
  Version: 3.4.4

+ findmnt --target=/var/lib/containers/storage
TARGET              SOURCE     FSTYPE OPTIONS
/var/lib/containers /dev/loop1 btrfs  rw,relatime,space_cache=v2,subvolid=5,subvol=/

+ df -h /var/lib/containers/storage
Filesystem      Size  Used Avail Use% Mounted on
/dev/loop1       15G  3.6M   15G   1% /var/lib/containers

+ findmnt --target=/run/containers/storage
TARGET SOURCE FSTYPE OPTIONS
/run   run    tmpfs  rw,nosuid,nodev,relatime,mode=755,inode64

+ df -h /run/containers/storage
Filesystem      Size  Used Avail Use% Mounted on
run             7.7G  1.4M  7.7G   1% /run

+ podman build -t lower_layer .
STEP 1/5: FROM ubuntu:20.04
Resolved "ubuntu" as an alias (/etc/containers/registries.conf.d/00-shortnames.conf)
Trying to pull docker.io/library/ubuntu:20.04...
Getting image source signatures
Copying blob 08c01a0ec47e done  
Copying config 54c9d81cbb done  
Writing manifest to image destination
Storing signatures
STEP 2/5: RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y strace
Get:1 http://security.ubuntu.com/ubuntu focal-security InRelease [114 kB]
Get:2 http://archive.ubuntu.com/ubuntu focal InRelease [265 kB]
Get:3 http://security.ubuntu.com/ubuntu focal-security/multiverse amd64 Packages [25.8 kB]
Get:4 http://security.ubuntu.com/ubuntu focal-security/main amd64 Packages [1577 kB]
Get:5 http://security.ubuntu.com/ubuntu focal-security/restricted amd64 Packages [982 kB]
Get:6 http://archive.ubuntu.com/ubuntu focal-updates InRelease [114 kB]
Get:7 http://security.ubuntu.com/ubuntu focal-security/universe amd64 Packages [842 kB]
Get:8 http://archive.ubuntu.com/ubuntu focal-backports InRelease [108 kB]
Get:9 http://archive.ubuntu.com/ubuntu focal/universe amd64 Packages [11.3 MB]
Get:10 http://archive.ubuntu.com/ubuntu focal/multiverse amd64 Packages [177 kB]
Get:11 http://archive.ubuntu.com/ubuntu focal/restricted amd64 Packages [33.4 kB]
Get:12 http://archive.ubuntu.com/ubuntu focal/main amd64 Packages [1275 kB]
Get:13 http://archive.ubuntu.com/ubuntu focal-updates/restricted amd64 Packages [1052 kB]
Get:14 http://archive.ubuntu.com/ubuntu focal-updates/universe amd64 Packages [1134 kB]
Get:15 http://archive.ubuntu.com/ubuntu focal-updates/multiverse amd64 Packages [29.4 kB]
Get:16 http://archive.ubuntu.com/ubuntu focal-updates/main amd64 Packages [2006 kB]
Get:17 http://archive.ubuntu.com/ubuntu focal-backports/universe amd64 Packages [24.8 kB]
Get:18 http://archive.ubuntu.com/ubuntu focal-backports/main amd64 Packages [50.8 kB]
Fetched 21.2 MB in 6s (3614 kB/s)
Reading package lists...
Reading package lists...
Building dependency tree...
Reading state information...
The following additional packages will be installed:
  libunwind8
The following NEW packages will be installed:
  libunwind8 strace
0 upgraded, 2 newly installed, 0 to remove and 10 not upgraded.
Need to get 428 kB of archives.
After this operation, 1844 kB of additional disk space will be used.
Get:1 http://archive.ubuntu.com/ubuntu focal/main amd64 libunwind8 amd64 1.2.1-9build1 [47.6 kB]
Get:2 http://archive.ubuntu.com/ubuntu focal-updates/main amd64 strace amd64 5.5-3ubuntu1 [380 kB]
debconf: delaying package configuration, since apt-utils is not installed
Fetched 428 kB in 1s (390 kB/s)
Selecting previously unselected package libunwind8:amd64.
(Reading database ... 4127 files and directories currently installed.)
Preparing to unpack .../libunwind8_1.2.1-9build1_amd64.deb ...
Unpacking libunwind8:amd64 (1.2.1-9build1) ...
Selecting previously unselected package strace.
Preparing to unpack .../strace_5.5-3ubuntu1_amd64.deb ...
Unpacking strace (5.5-3ubuntu1) ...
Setting up libunwind8:amd64 (1.2.1-9build1) ...
Setting up strace (5.5-3ubuntu1) ...
Processing triggers for libc-bin (2.31-0ubuntu9.2) ...
--> 202b2ebb952
STEP 3/5: COPY rename /usr/bin/
--> 9551a71c056
STEP 4/5: RUN mkdir -p /home/dir_lower
--> 781b61a4c54
STEP 5/5: RUN touch /home/file_lower
COMMIT lower_layer
--> 1c2c725aa94
Successfully tagged localhost/lower_layer:latest
1c2c725aa9492b44c150429ba0096386e4af19e56fdd61007834b55969edbd47

Run the built container image, on vfs (via (kernel)) (rootless: false):
+ mkdir /home/dir_upper
+ touch /home/file_upper
+ ls -l /home
total 0
drwxr-xr-x 1 root root 0 Feb 22 10:06 dir_lower
drwxr-xr-x 1 root root 0 Feb 22 10:06 dir_upper
-rw-r--r-- 1 root root 0 Feb 22 10:06 file_lower
-rw-r--r-- 1 root root 0 Feb 22 10:06 file_upper
+ strace -e rename rename /home/file_upper /home/file_upper.bak
rename("/home/file_upper", "/home/file_upper.bak") = 0
+++ exited with 0 +++
+ strace -e rename rename /home/dir_upper /home/dir_upper.bak
rename("/home/dir_upper", "/home/dir_upper.bak") = 0
+++ exited with 0 +++
+ strace -e rename rename /home/file_lower /home/file_lower.bak
rename("/home/file_lower", "/home/file_lower.bak") = 0
+++ exited with 0 +++
+ strace -e rename rename /home/dir_lower /home/dir_lower.bak
rename("/home/dir_lower", "/home/dir_lower.bak") = 0
+++ exited with 0 +++
+ ls /home
dir_lower.bak  dir_upper.bak  file_lower.bak  file_upper.bak
rootless, overlay (pure kernel)
$ STORAGE_DRIVER=overlay STORAGE_OPTS="" sh repro.sh 
+ podman version
Version:      3.4.4
API Version:  3.4.4
Go Version:   go1.17.4
Git Commit:   f6526ada1025c2e3f88745ba83b8b461ca659933
Built:        Thu Dec  9 13:30:40 2021
OS/Arch:      linux/amd64
+ podman info --debug
host:
  arch: amd64
  buildahVersion: 1.23.1
  cgroupControllers:
  - memory
  - pids
  cgroupManager: systemd
  cgroupVersion: v2
  conmon:
    package: /usr/bin/conmon is owned by conmon 1:2.1.0-1
    path: /usr/bin/conmon
    version: 'conmon version 2.1.0, commit: bdb4f6e56cd193d40b75ffc9725d4b74a18cb33c'
  cpus: 4
  distribution:
    distribution: arch
    version: unknown
  eventLogger: journald
  hostname: requiem
  idMappings:
    gidmap:
    - container_id: 0
      host_id: 1001
      size: 1
    - container_id: 1
      host_id: 100000
      size: 65537
    uidmap:
    - container_id: 0
      host_id: 1001
      size: 1
    - container_id: 1
      host_id: 100000
      size: 65537
  kernel: 5.16.10-arch1-1
  linkmode: dynamic
  logDriver: journald
  memFree: 9431904256
  memTotal: 16446435328
  ociRuntime:
    name: crun
    package: /usr/bin/crun is owned by crun 1.4.2-1
    path: /usr/bin/crun
    version: |-
      crun version 1.4.2
      commit: f6fbc8f840df1a414f31a60953ae514fa497c748
      spec: 1.0.0
      +SYSTEMD +SELINUX +APPARMOR +CAP +SECCOMP +EBPF +CRIU +YAJL
  os: linux
  remoteSocket:
    path: /run/user/1001/podman/podman.sock
  security:
    apparmorEnabled: false
    capabilities: CAP_CHOWN,CAP_DAC_OVERRIDE,CAP_FOWNER,CAP_FSETID,CAP_KILL,CAP_NET_BIND_SERVICE,CAP_SETFCAP,CAP_SETGID,CAP_SETPCAP,CAP_SETUID,CAP_SYS_CHROOT
    rootless: true
    seccompEnabled: true
    seccompProfilePath: /etc/containers/seccomp.json
    selinuxEnabled: false
  serviceIsRemote: false
  slirp4netns:
    executable: /usr/bin/slirp4netns
    package: /usr/bin/slirp4netns is owned by slirp4netns 1.1.12-1
    version: |-
      slirp4netns version 1.1.12
      commit: 7a104a101aa3278a2152351a082a6df71f57c9a3
      libslirp: 4.6.1
      SLIRP_CONFIG_VERSION_MAX: 3
      libseccomp: 2.5.3
  swapFree: 0
  swapTotal: 0
  uptime: 16h 14m 2.44s (Approximately 0.67 days)
plugins:
  log:
  - k8s-file
  - none
  - journald
  network:
  - bridge
  - macvlan
  volume:
  - local
registries: {}
store:
  configFile: /home/kousu/.config/containers/storage.conf
  containerStore:
    number: 0
    paused: 0
    running: 0
    stopped: 0
  graphDriverName: overlay
  graphOptions: {}
  graphRoot: /home/kousu/.local/share/containers/storage
  graphStatus:
    Backing Filesystem: btrfs
    Native Overlay Diff: "true"
    Supports d_type: "true"
    Using metacopy: "false"
  imageStore:
    number: 0
  runRoot: /run/user/1001/containers
  volumePath: /home/kousu/.local/share/containers/storage/volumes
version:
  APIVersion: 3.4.4
  Built: 1639074640
  BuiltTime: Thu Dec  9 13:30:40 2021
  GitCommit: f6526ada1025c2e3f88745ba83b8b461ca659933
  GoVersion: go1.17.4
  OsArch: linux/amd64
  Version: 3.4.4

+ findmnt --target=/home/kousu/.local/share/containers/storage
TARGET                              SOURCE     FSTYPE OPTIONS
/home/kousu/.local/share/containers /dev/loop0 btrfs  rw,relatime,space_cache=v2,subvolid=5,subvol=/

+ df -h /home/kousu/.local/share/containers/storage
Filesystem      Size  Used Avail Use% Mounted on
/dev/loop0       15G  3.6M   15G   1% /home/kousu/.local/share/containers

+ findmnt --target=/run/user/1001/containers
TARGET         SOURCE FSTYPE OPTIONS
/run/user/1001 tmpfs  tmpfs  rw,nosuid,nodev,relatime,size=14454876k,nr_inodes=401524,mode=700,uid=1001,gid=1001,inode64

+ df -h /run/user/1001/containers
Filesystem      Size  Used Avail Use% Mounted on
tmpfs            14G  1.4M   14G   1% /run/user/1001

+ podman build -t lower_layer .
STEP 1/5: FROM ubuntu:20.04
Resolved "ubuntu" as an alias (/etc/containers/registries.conf.d/00-shortnames.conf)
Trying to pull docker.io/library/ubuntu:20.04...
Getting image source signatures
Copying blob 08c01a0ec47e done  
Copying config 54c9d81cbb done  
Writing manifest to image destination
Storing signatures
STEP 2/5: RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y strace
Get:1 http://security.ubuntu.com/ubuntu focal-security InRelease [114 kB]
Get:2 http://archive.ubuntu.com/ubuntu focal InRelease [265 kB]
Get:3 http://security.ubuntu.com/ubuntu focal-security/universe amd64 Packages [842 kB]
Get:4 http://security.ubuntu.com/ubuntu focal-security/main amd64 Packages [1577 kB]
Get:5 http://security.ubuntu.com/ubuntu focal-security/restricted amd64 Packages [982 kB]
Get:6 http://security.ubuntu.com/ubuntu focal-security/multiverse amd64 Packages [25.8 kB]
Get:7 http://archive.ubuntu.com/ubuntu focal-updates InRelease [114 kB]
Get:8 http://archive.ubuntu.com/ubuntu focal-backports InRelease [108 kB]
Get:9 http://archive.ubuntu.com/ubuntu focal/main amd64 Packages [1275 kB]
Get:10 http://archive.ubuntu.com/ubuntu focal/restricted amd64 Packages [33.4 kB]
Get:11 http://archive.ubuntu.com/ubuntu focal/multiverse amd64 Packages [177 kB]
Get:12 http://archive.ubuntu.com/ubuntu focal/universe amd64 Packages [11.3 MB]
Get:13 http://archive.ubuntu.com/ubuntu focal-updates/multiverse amd64 Packages [29.4 kB]
Get:14 http://archive.ubuntu.com/ubuntu focal-updates/main amd64 Packages [2006 kB]
Get:15 http://archive.ubuntu.com/ubuntu focal-updates/universe amd64 Packages [1134 kB]
Get:16 http://archive.ubuntu.com/ubuntu focal-updates/restricted amd64 Packages [1052 kB]
Get:17 http://archive.ubuntu.com/ubuntu focal-backports/main amd64 Packages [50.8 kB]
Get:18 http://archive.ubuntu.com/ubuntu focal-backports/universe amd64 Packages [24.8 kB]
Fetched 21.2 MB in 22s (959 kB/s)
Reading package lists...
Reading package lists...
Building dependency tree...
Reading state information...
The following additional packages will be installed:
  libunwind8
The following NEW packages will be installed:
  libunwind8 strace
0 upgraded, 2 newly installed, 0 to remove and 10 not upgraded.
Need to get 428 kB of archives.
After this operation, 1844 kB of additional disk space will be used.
Get:1 http://archive.ubuntu.com/ubuntu focal/main amd64 libunwind8 amd64 1.2.1-9build1 [47.6 kB]
Get:2 http://archive.ubuntu.com/ubuntu focal-updates/main amd64 strace amd64 5.5-3ubuntu1 [380 kB]
debconf: delaying package configuration, since apt-utils is not installed
Fetched 428 kB in 1s (513 kB/s)
Selecting previously unselected package libunwind8:amd64.
(Reading database ... 4127 files and directories currently installed.)
Preparing to unpack .../libunwind8_1.2.1-9build1_amd64.deb ...
Unpacking libunwind8:amd64 (1.2.1-9build1) ...
Selecting previously unselected package strace.
Preparing to unpack .../strace_5.5-3ubuntu1_amd64.deb ...
Unpacking strace (5.5-3ubuntu1) ...
Setting up libunwind8:amd64 (1.2.1-9build1) ...
Setting up strace (5.5-3ubuntu1) ...
Processing triggers for libc-bin (2.31-0ubuntu9.2) ...
--> d7fe1273e79
STEP 3/5: COPY rename /usr/bin/
--> 3206b035515
STEP 4/5: RUN mkdir -p /home/dir_lower
--> ee457ec2794
STEP 5/5: RUN touch /home/file_lower
COMMIT lower_layer
--> fddb2379e84
Successfully tagged localhost/lower_layer:latest
fddb2379e84f27cb6b450780f4bd7a9289bd1db0c1a8871e7ba30ccf4a35cf9e

Run the built container image, on overlay (via (kernel)) (rootless: true):
+ mkdir /home/dir_upper
+ touch /home/file_upper
+ ls -l /home
total 0
drwxr-xr-x 1 root root 0 Feb 22 09:50 dir_lower
drwxr-xr-x 1 root root 0 Feb 22 09:50 dir_upper
-rw-r--r-- 1 root root 0 Feb 22 09:50 file_lower
-rw-r--r-- 1 root root 0 Feb 22 09:50 file_upper
+ strace -e rename rename /home/file_upper /home/file_upper.bak
rename("/home/file_upper", "/home/file_upper.bak") = 0
+++ exited with 0 +++
+ strace -e rename rename /home/dir_upper /home/dir_upper.bak
rename("/home/dir_upper", "/home/dir_upper.bak") = 0
+++ exited with 0 +++
+ strace -e rename rename /home/file_lower /home/file_lower.bak
rename("/home/file_lower", "/home/file_lower.bak") = 0
+++ exited with 0 +++
+ strace -e rename rename /home/dir_lower /home/dir_lower.bak
rename("/home/dir_lower", "/home/dir_lower.bak") = -1 EXDEV (Invalid cross-device link)
rename: Invalid cross-device link
+++ exited with 2 +++
rootful, overlay (pure kernel)
$ sudo STORAGE_DRIVER=overlay STORAGE_OPTS="" sh repro.sh 
ERRO[0000] User-selected graph driver "overlay" overwritten by graph driver "vfs" from database - delete libpod local files to resolve 
In order to switch graph drivers, you must erase your existing containers/images/cache.
ERRO[0000] User-selected graph driver "overlay" overwritten by graph driver "vfs" from database - delete libpod local files to resolve 

WARNING! This will remove:
        - all containers
        - all pods
        - all images
        - all build cache
Are you sure you want to continue? [y/N] y
ERRO[0000] User-selected graph driver "overlay" overwritten by graph driver "vfs" from database - delete libpod local files to resolve 
A storage.conf file exists at /etc/containers/storage.conf
You should remove this file if you did not modified the configuration.
A storage.conf file exists at /etc/containers/storage.conf
You should remove this file if you did not modified the configuration.
+ podman version
Version:      3.4.4
API Version:  3.4.4
Go Version:   go1.17.4
Git Commit:   f6526ada1025c2e3f88745ba83b8b461ca659933
Built:        Thu Dec  9 13:30:40 2021
OS/Arch:      linux/amd64
+ podman info --debug
host:
  arch: amd64
  buildahVersion: 1.23.1
  cgroupControllers:
  - cpuset
  - cpu
  - io
  - memory
  - hugetlb
  - pids
  - rdma
  - misc
  cgroupManager: systemd
  cgroupVersion: v2
  conmon:
    package: /usr/bin/conmon is owned by conmon 1:2.1.0-1
    path: /usr/bin/conmon
    version: 'conmon version 2.1.0, commit: bdb4f6e56cd193d40b75ffc9725d4b74a18cb33c'
  cpus: 4
  distribution:
    distribution: arch
    version: unknown
  eventLogger: journald
  hostname: requiem
  idMappings:
    gidmap: null
    uidmap: null
  kernel: 5.16.10-arch1-1
  linkmode: dynamic
  logDriver: journald
  memFree: 8497168384
  memTotal: 16446435328
  ociRuntime:
    name: crun
    package: /usr/bin/crun is owned by crun 1.4.2-1
    path: /usr/bin/crun
    version: |-
      crun version 1.4.2
      commit: f6fbc8f840df1a414f31a60953ae514fa497c748
      spec: 1.0.0
      +SYSTEMD +SELINUX +APPARMOR +CAP +SECCOMP +EBPF +CRIU +YAJL
  os: linux
  remoteSocket:
    path: /run/podman/podman.sock
  security:
    apparmorEnabled: false
    capabilities: CAP_CHOWN,CAP_DAC_OVERRIDE,CAP_FOWNER,CAP_FSETID,CAP_KILL,CAP_NET_BIND_SERVICE,CAP_SETFCAP,CAP_SETGID,CAP_SETPCAP,CAP_SETUID,CAP_SYS_CHROOT
    rootless: false
    seccompEnabled: true
    seccompProfilePath: /etc/containers/seccomp.json
    selinuxEnabled: false
  serviceIsRemote: false
  slirp4netns:
    executable: /usr/bin/slirp4netns
    package: /usr/bin/slirp4netns is owned by slirp4netns 1.1.12-1
    version: |-
      slirp4netns version 1.1.12
      commit: 7a104a101aa3278a2152351a082a6df71f57c9a3
      libslirp: 4.6.1
      SLIRP_CONFIG_VERSION_MAX: 3
      libseccomp: 2.5.3
  swapFree: 0
  swapTotal: 0
  uptime: 16h 31m 45.44s (Approximately 0.67 days)
plugins:
  log:
  - k8s-file
  - none
  - journald
  network:
  - bridge
  - macvlan
  volume:
  - local
registries: {}
store:
  configFile: /etc/containers/storage.conf
  containerStore:
    number: 0
    paused: 0
    running: 0
    stopped: 0
  graphDriverName: overlay
  graphOptions: {}
  graphRoot: /var/lib/containers/storage
  graphStatus:
    Backing Filesystem: btrfs
    Native Overlay Diff: "false"
    Supports d_type: "true"
    Using metacopy: "true"
  imageStore:
    number: 0
  runRoot: /run/containers/storage
  volumePath: /var/lib/containers/storage/volumes
version:
  APIVersion: 3.4.4
  Built: 1639074640
  BuiltTime: Thu Dec  9 13:30:40 2021
  GitCommit: f6526ada1025c2e3f88745ba83b8b461ca659933
  GoVersion: go1.17.4
  OsArch: linux/amd64
  Version: 3.4.4

+ findmnt --target=/var/lib/containers/storage
TARGET              SOURCE     FSTYPE OPTIONS
/var/lib/containers /dev/loop1 btrfs  rw,relatime,space_cache=v2,subvolid=5,subvol=/

+ df -h /var/lib/containers/storage
Filesystem      Size  Used Avail Use% Mounted on
/dev/loop1       15G  3.7M   15G   1% /var/lib/containers

+ findmnt --target=/run/containers/storage
TARGET SOURCE FSTYPE OPTIONS
/run   run    tmpfs  rw,nosuid,nodev,relatime,mode=755,inode64

+ df -h /run/containers/storage
Filesystem      Size  Used Avail Use% Mounted on
run             7.7G  1.4M  7.7G   1% /run

+ podman build -t lower_layer .
STEP 1/5: FROM ubuntu:20.04
Resolved "ubuntu" as an alias (/etc/containers/registries.conf.d/00-shortnames.conf)
Trying to pull docker.io/library/ubuntu:20.04...
Getting image source signatures
Copying blob 08c01a0ec47e done  
Copying config 54c9d81cbb done  
Writing manifest to image destination
Storing signatures
STEP 2/5: RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y strace
Get:1 http://security.ubuntu.com/ubuntu focal-security InRelease [114 kB]
Get:2 http://archive.ubuntu.com/ubuntu focal InRelease [265 kB]
Get:3 http://security.ubuntu.com/ubuntu focal-security/restricted amd64 Packages [982 kB]
Get:4 http://archive.ubuntu.com/ubuntu focal-updates InRelease [114 kB]
Get:5 http://archive.ubuntu.com/ubuntu focal-backports InRelease [108 kB]
Get:6 http://archive.ubuntu.com/ubuntu focal/main amd64 Packages [1275 kB]
Get:7 http://security.ubuntu.com/ubuntu focal-security/multiverse amd64 Packages [25.8 kB]
Get:8 http://security.ubuntu.com/ubuntu focal-security/main amd64 Packages [1577 kB]
Get:9 http://archive.ubuntu.com/ubuntu focal/universe amd64 Packages [11.3 MB]
Get:10 http://security.ubuntu.com/ubuntu focal-security/universe amd64 Packages [842 kB]
Get:11 http://archive.ubuntu.com/ubuntu focal/multiverse amd64 Packages [177 kB]
Get:12 http://archive.ubuntu.com/ubuntu focal/restricted amd64 Packages [33.4 kB]
Get:13 http://archive.ubuntu.com/ubuntu focal-updates/restricted amd64 Packages [1052 kB]
Get:14 http://archive.ubuntu.com/ubuntu focal-updates/main amd64 Packages [2006 kB]
Get:15 http://archive.ubuntu.com/ubuntu focal-updates/multiverse amd64 Packages [29.4 kB]
Get:16 http://archive.ubuntu.com/ubuntu focal-updates/universe amd64 Packages [1134 kB]
Get:17 http://archive.ubuntu.com/ubuntu focal-backports/main amd64 Packages [50.8 kB]
Get:18 http://archive.ubuntu.com/ubuntu focal-backports/universe amd64 Packages [24.8 kB]
Fetched 21.2 MB in 7s (3077 kB/s)
Reading package lists...
Reading package lists...
Building dependency tree...
Reading state information...
The following additional packages will be installed:
  libunwind8
The following NEW packages will be installed:
  libunwind8 strace
0 upgraded, 2 newly installed, 0 to remove and 10 not upgraded.
Need to get 428 kB of archives.
After this operation, 1844 kB of additional disk space will be used.
Get:1 http://archive.ubuntu.com/ubuntu focal/main amd64 libunwind8 amd64 1.2.1-9build1 [47.6 kB]
Get:2 http://archive.ubuntu.com/ubuntu focal-updates/main amd64 strace amd64 5.5-3ubuntu1 [380 kB]
debconf: delaying package configuration, since apt-utils is not installed
Fetched 428 kB in 1s (333 kB/s)
Selecting previously unselected package libunwind8:amd64.
(Reading database ... 4127 files and directories currently installed.)
Preparing to unpack .../libunwind8_1.2.1-9build1_amd64.deb ...
Unpacking libunwind8:amd64 (1.2.1-9build1) ...
Selecting previously unselected package strace.
Preparing to unpack .../strace_5.5-3ubuntu1_amd64.deb ...
Unpacking strace (5.5-3ubuntu1) ...
Setting up libunwind8:amd64 (1.2.1-9build1) ...
Setting up strace (5.5-3ubuntu1) ...
Processing triggers for libc-bin (2.31-0ubuntu9.2) ...
--> 89296d7ebaa
STEP 3/5: COPY rename /usr/bin/
--> 4220d8887bb
STEP 4/5: RUN mkdir -p /home/dir_lower
--> a1e59513be7
STEP 5/5: RUN touch /home/file_lower
COMMIT lower_layer
--> 3f6d098af42
Successfully tagged localhost/lower_layer:latest
3f6d098af423fe60d6d1b98e4bb987913af502b6cac68ffb0ef2b6125bce57fd

Run the built container image, on overlay (via (kernel)) (rootless: false):
+ mkdir /home/dir_upper
+ touch /home/file_upper
+ ls -l /home
total 0
drwxr-xr-x 1 root root 0 Feb 22 10:08 dir_lower
drwxr-xr-x 1 root root 0 Feb 22 10:08 dir_upper
-rw-r--r-- 1 root root 0 Feb 22 10:08 file_lower
-rw-r--r-- 1 root root 0 Feb 22 10:08 file_upper
+ strace -e rename rename /home/file_upper /home/file_upper.bak
rename("/home/file_upper", "/home/file_upper.bak") = 0
+++ exited with 0 +++
+ strace -e rename rename /home/dir_upper /home/dir_upper.bak
rename("/home/dir_upper", "/home/dir_upper.bak") = 0
+++ exited with 0 +++
+ strace -e rename rename /home/file_lower /home/file_lower.bak
rename("/home/file_lower", "/home/file_lower.bak") = 0
+++ exited with 0 +++
+ strace -e rename rename /home/dir_lower /home/dir_lower.bak
rename("/home/dir_lower", "/home/dir_lower.bak") = 0
+++ exited with 0 +++
+ ls /home
dir_lower.bak  dir_upper.bak  file_lower.bak  file_upper.bak
rootless, overlay (w/ FUSE)
$ STORAGE_DRIVER=overlay STORAGE_OPTS="overlay.mount_program=/usr/bin/fuse-overlayfs" sh repro.sh
+ podman version
Version:      3.4.4
API Version:  3.4.4
Go Version:   go1.17.4
Git Commit:   f6526ada1025c2e3f88745ba83b8b461ca659933
Built:        Thu Dec  9 13:30:40 2021
OS/Arch:      linux/amd64
+ podman info --debug
host:
  arch: amd64
  buildahVersion: 1.23.1
  cgroupControllers:
  - memory
  - pids
  cgroupManager: systemd
  cgroupVersion: v2
  conmon:
    package: /usr/bin/conmon is owned by conmon 1:2.1.0-1
    path: /usr/bin/conmon
    version: 'conmon version 2.1.0, commit: bdb4f6e56cd193d40b75ffc9725d4b74a18cb33c'
  cpus: 4
  distribution:
    distribution: arch
    version: unknown
  eventLogger: journald
  hostname: requiem
  idMappings:
    gidmap:
    - container_id: 0
      host_id: 1001
      size: 1
    - container_id: 1
      host_id: 100000
      size: 65537
    uidmap:
    - container_id: 0
      host_id: 1001
      size: 1
    - container_id: 1
      host_id: 100000
      size: 65537
  kernel: 5.16.10-arch1-1
  linkmode: dynamic
  logDriver: journald
  memFree: 9019478016
  memTotal: 16446435328
  ociRuntime:
    name: crun
    package: /usr/bin/crun is owned by crun 1.4.2-1
    path: /usr/bin/crun
    version: |-
      crun version 1.4.2
      commit: f6fbc8f840df1a414f31a60953ae514fa497c748
      spec: 1.0.0
      +SYSTEMD +SELINUX +APPARMOR +CAP +SECCOMP +EBPF +CRIU +YAJL
  os: linux
  remoteSocket:
    path: /run/user/1001/podman/podman.sock
  security:
    apparmorEnabled: false
    capabilities: CAP_CHOWN,CAP_DAC_OVERRIDE,CAP_FOWNER,CAP_FSETID,CAP_KILL,CAP_NET_BIND_SERVICE,CAP_SETFCAP,CAP_SETGID,CAP_SETPCAP,CAP_SETUID,CAP_SYS_CHROOT
    rootless: true
    seccompEnabled: true
    seccompProfilePath: /etc/containers/seccomp.json
    selinuxEnabled: false
  serviceIsRemote: false
  slirp4netns:
    executable: /usr/bin/slirp4netns
    package: /usr/bin/slirp4netns is owned by slirp4netns 1.1.12-1
    version: |-
      slirp4netns version 1.1.12
      commit: 7a104a101aa3278a2152351a082a6df71f57c9a3
      libslirp: 4.6.1
      SLIRP_CONFIG_VERSION_MAX: 3
      libseccomp: 2.5.3
  swapFree: 0
  swapTotal: 0
  uptime: 16h 22m 10.33s (Approximately 0.67 days)
plugins:
  log:
  - k8s-file
  - none
  - journald
  network:
  - bridge
  - macvlan
  volume:
  - local
registries: {}
store:
  configFile: /home/kousu/.config/containers/storage.conf
  containerStore:
    number: 0
    paused: 0
    running: 0
    stopped: 0
  graphDriverName: overlay
  graphOptions:
    overlay.mount_program:
      Executable: /usr/bin/fuse-overlayfs
      Package: /usr/bin/fuse-overlayfs is owned by fuse-overlayfs 1.8.2-1
      Version: |-
        fusermount3 version: 3.10.5
        fuse-overlayfs: version 1.8.2
        FUSE library version 3.10.5
        using FUSE kernel interface version 7.31
  graphRoot: /home/kousu/.local/share/containers/storage
  graphStatus:
    Backing Filesystem: btrfs
    Native Overlay Diff: "false"
    Supports d_type: "true"
    Using metacopy: "false"
  imageStore:
    number: 0
  runRoot: /run/user/1001/containers
  volumePath: /home/kousu/.local/share/containers/storage/volumes
version:
  APIVersion: 3.4.4
  Built: 1639074640
  BuiltTime: Thu Dec  9 13:30:40 2021
  GitCommit: f6526ada1025c2e3f88745ba83b8b461ca659933
  GoVersion: go1.17.4
  OsArch: linux/amd64
  Version: 3.4.4

+ findmnt --target=/home/kousu/.local/share/containers/storage
TARGET                              SOURCE     FSTYPE OPTIONS
/home/kousu/.local/share/containers /dev/loop0 btrfs  rw,relatime,space_cache=v2,subvolid=5,subvol=/

+ df -h /home/kousu/.local/share/containers/storage
Filesystem      Size  Used Avail Use% Mounted on
/dev/loop0       15G  3.7M   15G   1% /home/kousu/.local/share/containers

+ findmnt --target=/run/user/1001/containers
TARGET         SOURCE FSTYPE OPTIONS
/run/user/1001 tmpfs  tmpfs  rw,nosuid,nodev,relatime,size=14454876k,nr_inodes=401524,mode=700,uid=1001,gid=1001,inode64

+ df -h /run/user/1001/containers
Filesystem      Size  Used Avail Use% Mounted on
tmpfs            14G  1.4M   14G   1% /run/user/1001

+ podman build -t lower_layer .
STEP 1/5: FROM ubuntu:20.04
Resolved "ubuntu" as an alias (/etc/containers/registries.conf.d/00-shortnames.conf)
Trying to pull docker.io/library/ubuntu:20.04...
Getting image source signatures
Copying blob 08c01a0ec47e done  
Copying config 54c9d81cbb done  
Writing manifest to image destination
Storing signatures
STEP 2/5: RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y strace
Get:1 http://security.ubuntu.com/ubuntu focal-security InRelease [114 kB]
Get:2 http://archive.ubuntu.com/ubuntu focal InRelease [265 kB]
Get:3 http://archive.ubuntu.com/ubuntu focal-updates InRelease [114 kB]
Get:4 http://security.ubuntu.com/ubuntu focal-security/universe amd64 Packages [842 kB]
Get:5 http://archive.ubuntu.com/ubuntu focal-backports InRelease [108 kB]
Get:6 http://archive.ubuntu.com/ubuntu focal/restricted amd64 Packages [33.4 kB]
Get:7 http://archive.ubuntu.com/ubuntu focal/multiverse amd64 Packages [177 kB]
Get:8 http://archive.ubuntu.com/ubuntu focal/main amd64 Packages [1275 kB]
Get:9 http://archive.ubuntu.com/ubuntu focal/universe amd64 Packages [11.3 MB]
Get:10 http://security.ubuntu.com/ubuntu focal-security/multiverse amd64 Packages [25.8 kB]
Get:11 http://security.ubuntu.com/ubuntu focal-security/restricted amd64 Packages [982 kB]
Get:12 http://security.ubuntu.com/ubuntu focal-security/main amd64 Packages [1577 kB]
Get:13 http://archive.ubuntu.com/ubuntu focal-updates/main amd64 Packages [2006 kB]
Get:14 http://archive.ubuntu.com/ubuntu focal-updates/restricted amd64 Packages [1052 kB]
Get:15 http://archive.ubuntu.com/ubuntu focal-updates/universe amd64 Packages [1134 kB]
Get:16 http://archive.ubuntu.com/ubuntu focal-updates/multiverse amd64 Packages [29.4 kB]
Get:17 http://archive.ubuntu.com/ubuntu focal-backports/main amd64 Packages [50.8 kB]
Get:18 http://archive.ubuntu.com/ubuntu focal-backports/universe amd64 Packages [24.8 kB]
Fetched 21.2 MB in 9s (2393 kB/s)
Reading package lists...
Reading package lists...
Building dependency tree...
Reading state information...
The following additional packages will be installed:
  libunwind8
The following NEW packages will be installed:
  libunwind8 strace
0 upgraded, 2 newly installed, 0 to remove and 10 not upgraded.
Need to get 428 kB of archives.
After this operation, 1844 kB of additional disk space will be used.
Get:1 http://archive.ubuntu.com/ubuntu focal/main amd64 libunwind8 amd64 1.2.1-9build1 [47.6 kB]
Get:2 http://archive.ubuntu.com/ubuntu focal-updates/main amd64 strace amd64 5.5-3ubuntu1 [380 kB]
debconf: delaying package configuration, since apt-utils is not installed
Fetched 428 kB in 1s (441 kB/s)
Selecting previously unselected package libunwind8:amd64.
(Reading database ... 4127 files and directories currently installed.)
Preparing to unpack .../libunwind8_1.2.1-9build1_amd64.deb ...
Unpacking libunwind8:amd64 (1.2.1-9build1) ...
Selecting previously unselected package strace.
Preparing to unpack .../strace_5.5-3ubuntu1_amd64.deb ...
Unpacking strace (5.5-3ubuntu1) ...
Setting up libunwind8:amd64 (1.2.1-9build1) ...
Setting up strace (5.5-3ubuntu1) ...
Processing triggers for libc-bin (2.31-0ubuntu9.2) ...
--> 9fae997a7a9
STEP 3/5: COPY rename /usr/bin/
--> 7563747d904
STEP 4/5: RUN mkdir -p /home/dir_lower
--> 2a5dcf1e3ae
STEP 5/5: RUN touch /home/file_lower
COMMIT lower_layer
--> 7068b3e1a20
Successfully tagged localhost/lower_layer:latest
7068b3e1a20d421df9cf1d6aa4fcf6ef113446ed4fa928c9759f44e03e943c62

Run the built container image, on overlay (via fuse-overlayfs) (rootless: true):
+ mkdir /home/dir_upper
+ touch /home/file_upper
+ ls -l /home
total 0
drwxr-xr-x 2 root root  0 Feb 22 09:58 dir_lower
drwxr-xr-x 2 root root 40 Feb 22 09:58 dir_upper
-rw-r--r-- 1 root root  0 Feb 22 09:58 file_lower
-rw-r--r-- 1 root root  0 Feb 22 09:58 file_upper
+ strace -e rename rename /home/file_upper /home/file_upper.bak
rename("/home/file_upper", "/home/file_upper.bak") = 0
+++ exited with 0 +++
+ strace -e rename rename /home/dir_upper /home/dir_upper.bak
rename("/home/dir_upper", "/home/dir_upper.bak") = 0
+++ exited with 0 +++
+ strace -e rename rename /home/file_lower /home/file_lower.bak
rename("/home/file_lower", "/home/file_lower.bak") = 0
+++ exited with 0 +++
+ strace -e rename rename /home/dir_lower /home/dir_lower.bak
rename("/home/dir_lower", "/home/dir_lower.bak") = -1 EXDEV (Invalid cross-device link)
rename: Invalid cross-device link
+++ exited with 2 +++
rootful, overlay (w/ FUSE)
$ sudo STORAGE_DRIVER=overlay STORAGE_OPTS="overlay.mount_program=/usr/bin/fuse-overlayfs" sh repro.sh
+ podman version
Version:      3.4.4
API Version:  3.4.4
Go Version:   go1.17.4
Git Commit:   f6526ada1025c2e3f88745ba83b8b461ca659933
Built:        Thu Dec  9 13:30:40 2021
OS/Arch:      linux/amd64
+ podman info --debug
host:
  arch: amd64
  buildahVersion: 1.23.1
  cgroupControllers:
  - cpuset
  - cpu
  - io
  - memory
  - hugetlb
  - pids
  - rdma
  - misc
  cgroupManager: systemd
  cgroupVersion: v2
  conmon:
    package: /usr/bin/conmon is owned by conmon 1:2.1.0-1
    path: /usr/bin/conmon
    version: 'conmon version 2.1.0, commit: bdb4f6e56cd193d40b75ffc9725d4b74a18cb33c'
  cpus: 4
  distribution:
    distribution: arch
    version: unknown
  eventLogger: journald
  hostname: requiem
  idMappings:
    gidmap: null
    uidmap: null
  kernel: 5.16.10-arch1-1
  linkmode: dynamic
  logDriver: journald
  memFree: 8290557952
  memTotal: 16446435328
  ociRuntime:
    name: crun
    package: /usr/bin/crun is owned by crun 1.4.2-1
    path: /usr/bin/crun
    version: |-
      crun version 1.4.2
      commit: f6fbc8f840df1a414f31a60953ae514fa497c748
      spec: 1.0.0
      +SYSTEMD +SELINUX +APPARMOR +CAP +SECCOMP +EBPF +CRIU +YAJL
  os: linux
  remoteSocket:
    path: /run/podman/podman.sock
  security:
    apparmorEnabled: false
    capabilities: CAP_CHOWN,CAP_DAC_OVERRIDE,CAP_FOWNER,CAP_FSETID,CAP_KILL,CAP_NET_BIND_SERVICE,CAP_SETFCAP,CAP_SETGID,CAP_SETPCAP,CAP_SETUID,CAP_SYS_CHROOT
    rootless: false
    seccompEnabled: true
    seccompProfilePath: /etc/containers/seccomp.json
    selinuxEnabled: false
  serviceIsRemote: false
  slirp4netns:
    executable: /usr/bin/slirp4netns
    package: /usr/bin/slirp4netns is owned by slirp4netns 1.1.12-1
    version: |-
      slirp4netns version 1.1.12
      commit: 7a104a101aa3278a2152351a082a6df71f57c9a3
      libslirp: 4.6.1
      SLIRP_CONFIG_VERSION_MAX: 3
      libseccomp: 2.5.3
  swapFree: 0
  swapTotal: 0
  uptime: 16h 32m 52.6s (Approximately 0.67 days)
plugins:
  log:
  - k8s-file
  - none
  - journald
  network:
  - bridge
  - macvlan
  volume:
  - local
registries: {}
store:
  configFile: /etc/containers/storage.conf
  containerStore:
    number: 0
    paused: 0
    running: 0
    stopped: 0
  graphDriverName: overlay
  graphOptions:
    overlay.mount_program:
      Executable: /usr/bin/fuse-overlayfs
      Package: /usr/bin/fuse-overlayfs is owned by fuse-overlayfs 1.8.2-1
      Version: |-
        fusermount3 version: 3.10.5
        fuse-overlayfs: version 1.8.2
        FUSE library version 3.10.5
        using FUSE kernel interface version 7.31
  graphRoot: /var/lib/containers/storage
  graphStatus:
    Backing Filesystem: btrfs
    Native Overlay Diff: "false"
    Supports d_type: "true"
    Using metacopy: "false"
  imageStore:
    number: 5
  runRoot: /run/containers/storage
  volumePath: /var/lib/containers/storage/volumes
version:
  APIVersion: 3.4.4
  Built: 1639074640
  BuiltTime: Thu Dec  9 13:30:40 2021
  GitCommit: f6526ada1025c2e3f88745ba83b8b461ca659933
  GoVersion: go1.17.4
  OsArch: linux/amd64
  Version: 3.4.4

+ findmnt --target=/var/lib/containers/storage
TARGET              SOURCE     FSTYPE OPTIONS
/var/lib/containers /dev/loop1 btrfs  rw,relatime,space_cache=v2,subvolid=5,subvol=/

+ df -h /var/lib/containers/storage
Filesystem      Size  Used Avail Use% Mounted on
/dev/loop1       15G   81M   15G   1% /var/lib/containers

+ findmnt --target=/run/containers/storage
TARGET SOURCE FSTYPE OPTIONS
/run   run    tmpfs  rw,nosuid,nodev,relatime,mode=755,inode64

+ df -h /run/containers/storage
Filesystem      Size  Used Avail Use% Mounted on
run             7.7G  1.4M  7.7G   1% /run

+ podman build -t lower_layer .
STEP 1/5: FROM ubuntu:20.04
STEP 2/5: RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y strace
--> Using cache 89296d7ebaa99c4426ea9a3452d6727d0b1a8294b5901788dedd9debaaba45a0
--> 89296d7ebaa
STEP 3/5: COPY rename /usr/bin/
--> Using cache 4220d8887bb78cd96c40e0472791cf7b1b308067715b3ff6331139e642822dbc
--> 4220d8887bb
STEP 4/5: RUN mkdir -p /home/dir_lower
--> Using cache a1e59513be78a6f5046ab793248236e8dad954538751818007a71598528bcd40
--> a1e59513be7
STEP 5/5: RUN touch /home/file_lower
--> Using cache 3f6d098af423fe60d6d1b98e4bb987913af502b6cac68ffb0ef2b6125bce57fd
COMMIT lower_layer
--> 3f6d098af42
Successfully tagged localhost/lower_layer:latest
3f6d098af423fe60d6d1b98e4bb987913af502b6cac68ffb0ef2b6125bce57fd

Run the built container image, on overlay (via fuse-overlayfs) (rootless: false):
+ mkdir /home/dir_upper
+ touch /home/file_upper
+ ls -l /home
total 0
drwxr-xr-x 2 root root  0 Feb 22 10:08 dir_lower
drwxr-xr-x 2 root root 40 Feb 22 10:09 dir_upper
-rw-r--r-- 1 root root  0 Feb 22 10:08 file_lower
-rw-r--r-- 1 root root  0 Feb 22 10:09 file_upper
+ strace -e rename rename /home/file_upper /home/file_upper.bak
rename("/home/file_upper", "/home/file_upper.bak") = 0
+++ exited with 0 +++
+ strace -e rename rename /home/dir_upper /home/dir_upper.bak
rename("/home/dir_upper", "/home/dir_upper.bak") = 0
+++ exited with 0 +++
+ strace -e rename rename /home/file_lower /home/file_lower.bak
rename("/home/file_lower", "/home/file_lower.bak") = 0
+++ exited with 0 +++
+ strace -e rename rename /home/dir_lower /home/dir_lower.bak
rename("/home/dir_lower", "/home/dir_lower.bak") = -1 EXDEV (Invalid cross-device link)
rename: Invalid cross-device link
+++ exited with 2 +++

@kousu
Copy link
Contributor

kousu commented Feb 22, 2022

I downloaded and ran @Hi-Angel's docker.io/kkharlamov/bugreport-enomem and was able to reproduce

Invalid cross-device link

with fuse-overlayfs disabled, but not with it enabled, so I confirm @Hi-Angel's report. But that only deepens the mystery for me. I'll take another look tomorrow.

STORAGE_DRIVER=overlay 🔴
$ podman system reset -f
$ export STORAGE_DRIVER=overlay STORAGE_OPTS=""
$ podman info --debug | grep fuse-overlayfs
$ time podman run --rm -it docker.io/kkharlamov/bugreport-enomem apt install libreadline-dev
Trying to pull docker.io/kkharlamov/bugreport-enomem:latest...
Getting image source signatures
Copying blob aeae617804b7 done  
Copying blob aeae617804b7 done  
Copying blob aeae617804b7 done  
Copying blob aeae617804b7 done  
Copying blob aeae617804b7 done  
Copying blob aeae617804b7 done  
Copying blob aeae617804b7 done  
[...]
Copying blob 3137086702aa done  
Copying blob c6f9499b32eb done  
Copying blob 764706933a45 done  
Copying blob da30d8200b0c done  
Copying blob bbded690825e done  
Copying blob ec191f0e38f7 done  
Copying config 6eb6bf9f50 done  
Writing manifest to image destination
Storing signatures
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following packages were automatically installed and are no longer required:
  gyp javascript-common libasan6:i386 libatomic1:i386 libboost-dev libboost1.65-dev libc-ares2 libc6-dev:i386 libgomp1:i386 libhttp-parser2.7.1 libitm1:i386 libjs-async libjs-inherits
  libjs-jquery libjs-node-uuid libjs-underscore libquadmath0:i386 libstdc++6:i386 libubsan1:i386 libuv1-dev libyaml-cpp0.5v5 linux-libc-dev:i386 nodejs-doc python-chardet
  python-pkg-resources
Use 'apt autoremove' to remove them.
Suggested packages:
  readline-doc
The following NEW packages will be installed:
  libreadline-dev
0 upgraded, 1 newly installed, 0 to remove and 148 not upgraded.
Need to get 133 kB of archives.
After this operation, 728 kB of additional disk space will be used.
Get:1 http://archive.ubuntu.com/ubuntu bionic/main amd64 libreadline-dev amd64 7.0-3 [133 kB]
Fetched 133 kB in 1s (204 kB/s)          
debconf: delaying package configuration, since apt-utils is not installed
Selecting previously unselected package libreadline-dev:amd64.
(Reading database ... 156394 files and directories currently installed.)
Preparing to unpack .../libreadline-dev_7.0-3_amd64.deb ...
Unpacking libreadline-dev:amd64 (7.0-3) ...
dpkg: error processing archive /var/cache/apt/archives/libreadline-dev_7.0-3_amd64.deb (--unpack):
 unable to install new version of './usr/include/readline': Invalid cross-device link
dpkg-deb: error: paste subprocess was killed by signal (Broken pipe)
Errors were encountered while processing:
 /var/cache/apt/archives/libreadline-dev_7.0-3_amd64.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)

real	14m0.736s
user	6m44.050s
sys	1m39.670s
$ 
STORAGE_DRIVER=overlay + fuse-overlayfs 🟢
$ export TMPDIR=/tmp
$ rmdir ~/.config/containers/
$ podman system reset -f
$ export STORAGE_DRIVER=overlay STORAGE_OPTS="overlay.mount_program=/usr/bin/fuse-overlayfs"
$ podman info --debug | grep fuse-overlayfs
      Executable: /usr/bin/fuse-overlayfs
      Package: /usr/bin/fuse-overlayfs is owned by fuse-overlayfs 1.8.2-1
        fuse-overlayfs: version 1.8.2
$ podman info
host:
  arch: amd64
  buildahVersion: 1.23.1
  cgroupControllers:
  - memory
  - pids
  cgroupManager: systemd
  cgroupVersion: v2
  conmon:
    package: /usr/bin/conmon is owned by conmon 1:2.1.0-1
    path: /usr/bin/conmon
    version: 'conmon version 2.1.0, commit: bdb4f6e56cd193d40b75ffc9725d4b74a18cb33c'
  cpus: 4
  distribution:
    distribution: arch
    version: unknown
  eventLogger: journald
  hostname: requiem
  idMappings:
    gidmap:
    - container_id: 0
      host_id: 1001
      size: 1
    - container_id: 1
      host_id: 100000
      size: 65537
    uidmap:
    - container_id: 0
      host_id: 1001
      size: 1
    - container_id: 1
      host_id: 100000
      size: 65537
  kernel: 5.16.10-arch1-1
  linkmode: dynamic
  logDriver: journald
  memFree: 9103687680
  memTotal: 16446435328
  ociRuntime:
    name: crun
    package: /usr/bin/crun is owned by crun 1.4.2-1
    path: /usr/bin/crun
    version: |-
      crun version 1.4.2
      commit: f6fbc8f840df1a414f31a60953ae514fa497c748
      spec: 1.0.0
      +SYSTEMD +SELINUX +APPARMOR +CAP +SECCOMP +EBPF +CRIU +YAJL
  os: linux
  remoteSocket:
    path: /run/user/1001/podman/podman.sock
  security:
    apparmorEnabled: false
    capabilities: CAP_CHOWN,CAP_DAC_OVERRIDE,CAP_FOWNER,CAP_FSETID,CAP_KILL,CAP_NET_BIND_SERVICE,CAP_SETFCAP,CAP_SETGID,CAP_SETPCAP,CAP_SETUID,CAP_SYS_CHROOT
    rootless: true
    seccompEnabled: true
    seccompProfilePath: /etc/containers/seccomp.json
    selinuxEnabled: false
  serviceIsRemote: false
  slirp4netns:
    executable: /usr/bin/slirp4netns
    package: /usr/bin/slirp4netns is owned by slirp4netns 1.1.12-1
    version: |-
      slirp4netns version 1.1.12
      commit: 7a104a101aa3278a2152351a082a6df71f57c9a3
      libslirp: 4.6.1
      SLIRP_CONFIG_VERSION_MAX: 3
      libseccomp: 2.5.3
  swapFree: 0
  swapTotal: 0
  uptime: 16h 49m 23.28s (Approximately 0.67 days)
plugins:
  log:
  - k8s-file
  - none
  - journald
  network:
  - bridge
  - macvlan
  volume:
  - local
registries: {}
store:
  configFile: /home/kousu/.config/containers/storage.conf
  containerStore:
    number: 0
    paused: 0
    running: 0
    stopped: 0
  graphDriverName: overlay
  graphOptions:
    overlay.mount_program:
      Executable: /usr/bin/fuse-overlayfs
      Package: /usr/bin/fuse-overlayfs is owned by fuse-overlayfs 1.8.2-1
      Version: |-
        fusermount3 version: 3.10.5
        fuse-overlayfs: version 1.8.2
        FUSE library version 3.10.5
        using FUSE kernel interface version 7.31
  graphRoot: /home/kousu/.local/share/containers/storage
  graphStatus:
    Backing Filesystem: extfs
    Native Overlay Diff: "false"
    Supports d_type: "true"
    Using metacopy: "false"
  imageStore:
    number: 0
  runRoot: /run/user/1001/containers
  volumePath: /home/kousu/.local/share/containers/storage/volumes
version:
  APIVersion: 3.4.4
  Built: 1639074640
  BuiltTime: Thu Dec  9 13:30:40 2021
  GitCommit: f6526ada1025c2e3f88745ba83b8b461ca659933
  GoVersion: go1.17.4
  OsArch: linux/amd64
  Version: 3.4.4

$ time podman run --rm -it docker.io/kkharlamov/bugreport-enomem apt install libreadline-dev
Trying to pull docker.io/kkharlamov/bugreport-enomem:latest...
Getting image source signatures
Copying blob beb8f979e425 done  
Copying blob beb8f979e425 done  
[...]
Copying blob 3137086702aa done  
Copying blob c6f9499b32eb done  
Copying blob 764706933a45 done  
Copying blob da30d8200b0c done  
Copying blob bbded690825e done  
Copying blob ec191f0e38f7 done  
Copying config 6eb6bf9f50 done  
Writing manifest to image destination
Storing signatures





Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following packages were automatically installed and are no longer required:
  gyp javascript-common libasan6:i386 libatomic1:i386 libboost-dev libboost1.65-dev libc-ares2 libc6-dev:i386 libgomp1:i386 libhttp-parser2.7.1 libitm1:i386 libjs-async libjs-inherits
  libjs-jquery libjs-node-uuid libjs-underscore libquadmath0:i386 libstdc++6:i386 libubsan1:i386 libuv1-dev libyaml-cpp0.5v5 linux-libc-dev:i386 nodejs-doc python-chardet
  python-pkg-resources
Use 'apt autoremove' to remove them.
Suggested packages:
  readline-doc
The following NEW packages will be installed:
  libreadline-dev
0 upgraded, 1 newly installed, 0 to remove and 148 not upgraded.
Need to get 133 kB of archives.
After this operation, 728 kB of additional disk space will be used.
Get:1 http://archive.ubuntu.com/ubuntu bionic/main amd64 libreadline-dev amd64 7.0-3 [133 kB]
Fetched 133 kB in 1s (150 kB/s)     
debconf: delaying package configuration, since apt-utils is not installed
Selecting previously unselected package libreadline-dev:amd64.
(Reading database ... 156394 files and directories currently installed.)
Preparing to unpack .../libreadline-dev_7.0-3_amd64.deb ...
Unpacking libreadline-dev:amd64 (7.0-3) ...
Setting up libreadline-dev:amd64 (7.0-3) ...

real	14m15.575s
user	6m49.553s
sys	1m39.825s
$ 

I cut down my reproduction script to run against the container image you first saw it on, and got a surprise:

repro-kkharlamov.sh
#!/bin/sh
#
# reproduce https://github.com/containers/podman/issues/13123
# wherein podman in rootless + overlayfs mode triggers EXDEV errors
# for no good reason.
# 
# Since the bug turns on what podman uses for its storage driver,
# you should know this is configured with (by order of priority):
#
# * flag --storage-driver
# * env $STORAGE_DRIVER.
# * ~/.config/containers/storage.conf (if rootless)
# * /etc/containers/storage.conf
# 
# There are basically three modes that podman supports:
#
# 1. legacy vfs
#
#   export STORAGE_DRIVER=vfs STORAGE_OPTS=""
#
# 2. modern kernel
#
#   export STORAGE_DRIVER=overlay STORAGE_OPTS=""
#
# 3. modern overlayfs, but with a FUSE helper
#    (this is only needed for rootless mode)
#
#    export STORAGE_DRIVER=overlay STORAGE_OPTS="overlay.mount_program=/usr/bin/fuse-overlayfs"
#
# I recommend you pick a mode using these env vars. For example: 
#
#    STORAGE_DRIVER=overlay STORAGE_OPTS="overlay.mount_program=/usr/bin/fuse-overlayfs" sh repro.sh
#
# To use root mode, just use sudo:
#
#    sudo STORAGE_DRIVER=vfs STORAGE_OPTS="" sh repro.sh


set -eu

GRAPHROOT=$(podman info --format={{".Store.GraphRoot"}})

# verify configured driver is actually active: if you switch the driver you 
# have to erase the entire cache of containers/images/cached config. And sometimes even twice before it will stick?
if podman info --debug 2>&1 | grep -q 'delete libpod local files to resolve'; then
  echo "In order to switch graph drivers, you must erase your existing containers/images/cache."
  podman system reset
  if podman info --debug 2>&1 | grep -q 'delete libpod local files to resolve'; then
    echo "You chose to keep your existing containers. This reproduction script cannot work. Exiting."
    exit 1
  fi

  # sometimes the above *does not work* and we need to resort to this to get podman working again
  rm -f "$GRAPHROOT"/libpod/* # XXX dangerous
  podman system reset -f # XXX dangerous
fi

cat >rename.c <<EOF
// rename.c: a direct interface to rename(2) without all that coreutils junk in the way
// compile with: gcc -static rename.c -o rename

#include <stdio.h>
#include <errno.h>

int main(int argc, char* argv[]) {
  if(argc != 3) { errno = EINVAL; perror("argv"); return 1; }
  if(rename(argv[1], argv[2]) != 0) { perror("rename"); return 2; }
  return 0;
}
EOF
gcc -static rename.c -o rename

# platform:
(
set -x

podman version

podman info --debug
)


GRAPHROOT=$(podman info --format={{".Store.GraphRoot"}})
RUNROOT=$(podman info --format={{".Store.RunRoot"}})
DRIVER=$(podman info --format={{".Store.GraphDriverName"}})
ROOTLESS=$(podman info --format={{".Host.Security.Rootless"}})


if podman info --debug | grep -q fuse-overlayfs; then
  MOUNT_PROGRAM="fuse-overlayfs";
else
  MOUNT_PROGRAM="(kernel)";
fi

(set -x
findmnt --target="$GRAPHROOT"
)
echo
(set -x
df -h "$GRAPHROOT"
)
echo
(set -x
findmnt --target="$RUNROOT"
)
echo
(set -x
df -h "$RUNROOT"
)
echo

echo "Run the container image, on $DRIVER (via $MOUNT_PROGRAM) (rootless: $ROOTLESS):"
podman create --name repro1 --cap-add=SYS_PTRACE --rm -it docker.io/kkharlamov/bugreport-enomem
trap 'podman stop repro1' EXIT
podman start repro1
podman cp rename repro1:/usr/bin
podman exec repro1 sh -c '
  set -x
  mkdir /home/dir_upper &&
  touch /home/file_upper &&
  ls -l /home &&
  strace -e rename rename /home/file_upper /home/file_upper.bak &&
  strace -e rename rename /home/dir_upper /home/dir_upper.bak &&
  strace -e rename rename /home/file_lower /home/file_lower.bak &&
  strace -e rename rename /home/dir_lower /home/dir_lower.bak &&
  ls /home
'

With this, even the first directory rename -- renaming a directory that did not exist before running this script and thus should be in the top layer -- fails, contradicting what I saw when using a simpler image:

rename("/home/dir_upper", "/home/dir_upper.bak") = -1 EXDEV (Invalid cross-device link)
STORAGE_DRIVER=overlay 🔴
$ sh repro-kkharlamov.sh 
+ podman version
Version:      3.4.4
API Version:  3.4.4
Go Version:   go1.17.4
Git Commit:   f6526ada1025c2e3f88745ba83b8b461ca659933
Built:        Thu Dec  9 13:30:40 2021
OS/Arch:      linux/amd64
+ podman info --debug
host:
  arch: amd64
  buildahVersion: 1.23.1
  cgroupControllers:
  - memory
  - pids
  cgroupManager: systemd
  cgroupVersion: v2
  conmon:
    package: /usr/bin/conmon is owned by conmon 1:2.1.0-1
    path: /usr/bin/conmon
    version: 'conmon version 2.1.0, commit: bdb4f6e56cd193d40b75ffc9725d4b74a18cb33c'
  cpus: 4
  distribution:
    distribution: arch
    version: unknown
  eventLogger: journald
  hostname: requiem
  idMappings:
    gidmap:
    - container_id: 0
      host_id: 1001
      size: 1
    - container_id: 1
      host_id: 100000
      size: 65537
    uidmap:
    - container_id: 0
      host_id: 1001
      size: 1
    - container_id: 1
      host_id: 100000
      size: 65537
  kernel: 5.16.10-arch1-1
  linkmode: dynamic
  logDriver: journald
  memFree: 2536812544
  memTotal: 16446435328
  ociRuntime:
    name: crun
    package: /usr/bin/crun is owned by crun 1.4.2-1
    path: /usr/bin/crun
    version: |-
      crun version 1.4.2
      commit: f6fbc8f840df1a414f31a60953ae514fa497c748
      spec: 1.0.0
      +SYSTEMD +SELINUX +APPARMOR +CAP +SECCOMP +EBPF +CRIU +YAJL
  os: linux
  remoteSocket:
    path: /run/user/1001/podman/podman.sock
  security:
    apparmorEnabled: false
    capabilities: CAP_CHOWN,CAP_DAC_OVERRIDE,CAP_FOWNER,CAP_FSETID,CAP_KILL,CAP_NET_BIND_SERVICE,CAP_SETFCAP,CAP_SETGID,CAP_SETPCAP,CAP_SETUID,CAP_SYS_CHROOT
    rootless: true
    seccompEnabled: true
    seccompProfilePath: /etc/containers/seccomp.json
    selinuxEnabled: false
  serviceIsRemote: false
  slirp4netns:
    executable: /usr/bin/slirp4netns
    package: /usr/bin/slirp4netns is owned by slirp4netns 1.1.12-1
    version: |-
      slirp4netns version 1.1.12
      commit: 7a104a101aa3278a2152351a082a6df71f57c9a3
      libslirp: 4.6.1
      SLIRP_CONFIG_VERSION_MAX: 3
      libseccomp: 2.5.3
  swapFree: 0
  swapTotal: 0
  uptime: 22h 53m 42.92s (Approximately 0.92 days)
plugins:
  log:
  - k8s-file
  - none
  - journald
  network:
  - bridge
  - macvlan
  volume:
  - local
registries: {}
store:
  configFile: /home/kousu/.config/containers/storage.conf
  containerStore:
    number: 0
    paused: 0
    running: 0
    stopped: 0
  graphDriverName: overlay
  graphOptions: {}
  graphRoot: /home/kousu/.local/share/containers/storage
  graphStatus:
    Backing Filesystem: extfs
    Native Overlay Diff: "true"
    Supports d_type: "true"
    Using metacopy: "false"
  imageStore:
    number: 6
  runRoot: /run/user/1001/containers
  volumePath: /home/kousu/.local/share/containers/storage/volumes
version:
  APIVersion: 3.4.4
  Built: 1639074640
  BuiltTime: Thu Dec  9 13:30:40 2021
  GitCommit: f6526ada1025c2e3f88745ba83b8b461ca659933
  GoVersion: go1.17.4
  OsArch: linux/amd64
  Version: 3.4.4

+ findmnt --target=/home/kousu/.local/share/containers/storage
TARGET SOURCE    FSTYPE OPTIONS
/home  /dev/sda9 ext2   rw,relatime

+ df -h /home/kousu/.local/share/containers/storage
Filesystem      Size  Used Avail Use% Mounted on
/dev/sda9       391G  342G   29G  93% /home

+ findmnt --target=/run/user/1001/containers
TARGET         SOURCE FSTYPE OPTIONS
/run/user/1001 tmpfs  tmpfs  rw,nosuid,nodev,relatime,size=14454876k,nr_inodes=401524,mode=700,uid=1001,gid=1001,inode64

+ df -h /run/user/1001/containers
Filesystem      Size  Used Avail Use% Mounted on
tmpfs            14G  1.5M   14G   1% /run/user/1001

Run the container image, on overlay (via (kernel)) (rootless: true):
a1065427fa2e537136c3e3885114292faa2faa904dc471b9ecfb350ad579f391
repro1
+ mkdir /home/dir_upper
+ touch /home/file_upper
+ ls -l /home
total 20
drwxr-xr-x 4 archie archie 4096 Dec 16  2020 archie
drwxr-xr-x 2 root   root   4096 Oct  6 09:15 bds_builder
drwxr-xr-x 2 root   root   4096 Feb 22 16:29 dir_upper
-rw-r--r-- 1 root   root      0 Feb 22 16:29 file_upper
drwxr-xr-x 2 foo    foo    4096 Oct  6 09:13 foo
drwxr-xr-t 3 root   root   4096 Nov 11  2020 swarm
+ strace -e rename rename /home/file_upper /home/file_upper.bak
syscall_0x14e(0xd6cd60, 0x20, 0, 0x53053053, 0, 0xc0000) = 0
rename("/home/file_upper", "/home/file_upper.bak") = 0
+++ exited with 0 +++
+ strace -e rename rename /home/dir_upper /home/dir_upper.bak
syscall_0x14e(0x18e9d60, 0x20, 0, 0x53053053, 0, 0xc0000) = 0
rename("/home/dir_upper", "/home/dir_upper.bak") = -1 EXDEV (Invalid cross-device link)
rename: Invalid cross-device link
+++ exited with 2 +++
repro1

I found these lines in dmesg just after running repro-kkharlamov.sh :

[41144.565768] overlayfs: upper fs does not support xattr, falling back to index=off,metacopy=off.
[41144.565772] overlayfs: upper fs does not support xattr, falling back to xino=off.

For comparison, I found these lines in dmesg just after running repro.sh:

[41271.902123] overlayfs: upper fs does not support file handles, falling back to index=off.
[41271.902133] overlayfs: fs on '/home/kousu/.local/share/containers/storage/overlay/l/EFSU256NSEESIK66WLNKSB2N4A' does not support file handles, falling back to xino=off.
[41271.927089] overlayfs: upper fs does not support file handles, falling back to index=off.
[41271.927099] overlayfs: fs on '/home/kousu/.local/share/containers/storage/overlay/l/VIPESUNTHVVSNWQ257T7QFCKIH' does not support file handles, falling back to xino=off.
[41272.177363] overlayfs: upper fs does not support file handles, falling back to index=off.
[41272.177384] overlayfs: fs on '/home/kousu/.local/share/containers/storage/overlay/l/N3UC4P6K6D5X2XB3KRM5C7Z4I2' does not support file handles, falling back to xino=off.
[41272.206512] overlayfs: upper fs does not support file handles, falling back to index=off.
[41272.206535] overlayfs: fs on '/home/kousu/.local/share/containers/storage/overlay/l/DWIB6VA26G7ADZPM2MWNXAER3R' does not support file handles, falling back to xino=off.
[41272.482014] overlayfs: upper fs does not support file handles, falling back to index=off.
[41272.482023] overlayfs: fs on '/home/kousu/.local/share/containers/storage/overlay/l/PNCQVBDSULJ5RTIBTT5TWSZWB4' does not support file handles, falling back to xino=off.

I don't understand what this all means but maybe it's enough to give you clues?

@kousu
Copy link
Contributor

kousu commented Feb 22, 2022

The dmesg lines helped me find this thread: "btrfs+overlayfs: upper fs does not support xattr, falling back to index=off and metacopy=off." from 8 months ago, and that gave me two more clues:

  1. https://gitlab.freedesktop.org/bolt/bolt/-/issues/171#note_872119 is probably another symptom of the same underlying issue
  2. From https://www.spinics.net/lists/linux-unionfs/msg09111.html:

OK, so unprivileged overlayfs mount support was added in v5.11 and it requires opt-in with mount option "userxattr"

  1. main: move directory load at readdir time fuse-overlayfs#291 attempted to address a similar issue in fuse-overlayfs; maybe this is part of why fuse-overlayfs is working for @Hi-Angel's container?

@kousu
Copy link
Contributor

kousu commented Feb 22, 2022

The reason I'm here in the first place is I am trying to run podman on tmpfs: my disks are slow and I have many containers to test and I don't need to keep them locally -- the working ones I'll eventually podman push -- so it's much more efficient for me to keep it all in RAM. So I started by

$ sudo mount -t tmpfs tmpfs ~/.local/share/containers/ && sudo chown $(whoami):$(whoami) ~/.local/share/containers

but I quickly hit EXDEV errors. In this mode I can't even run apt install strace in the Dockerfile, where that has worked in all other situations.

STORAGE_DRIVER=overlay 🔴
$ podman system reset -f
$ STORAGE_DRIVER=overlay STORAGE_OPTS="" sh repro.sh
+ podman version
Version:      3.4.4
API Version:  3.4.4
Go Version:   go1.17.4
Git Commit:   f6526ada1025c2e3f88745ba83b8b461ca659933
Built:        Thu Dec  9 13:30:40 2021
OS/Arch:      linux/amd64
+ podman info --debug
host:
  arch: amd64
  buildahVersion: 1.23.1
  cgroupControllers:
  - memory
  - pids
  cgroupManager: systemd
  cgroupVersion: v2
  conmon:
    package: /usr/bin/conmon is owned by conmon 1:2.1.0-1
    path: /usr/bin/conmon
    version: 'conmon version 2.1.0, commit: bdb4f6e56cd193d40b75ffc9725d4b74a18cb33c'
  cpus: 4
  distribution:
    distribution: arch
    version: unknown
  eventLogger: journald
  hostname: requiem
  idMappings:
    gidmap:
    - container_id: 0
      host_id: 1001
      size: 1
    - container_id: 1
      host_id: 100000
      size: 65537
    uidmap:
    - container_id: 0
      host_id: 1001
      size: 1
    - container_id: 1
      host_id: 100000
      size: 65537
  kernel: 5.16.10-arch1-1
  linkmode: dynamic
  logDriver: journald
  memFree: 2678231040
  memTotal: 16446435328
  ociRuntime:
    name: crun
    package: /usr/bin/crun is owned by crun 1.4.2-1
    path: /usr/bin/crun
    version: |-
      crun version 1.4.2
      commit: f6fbc8f840df1a414f31a60953ae514fa497c748
      spec: 1.0.0
      +SYSTEMD +SELINUX +APPARMOR +CAP +SECCOMP +EBPF +CRIU +YAJL
  os: linux
  remoteSocket:
    path: /run/user/1001/podman/podman.sock
  security:
    apparmorEnabled: false
    capabilities: CAP_CHOWN,CAP_DAC_OVERRIDE,CAP_FOWNER,CAP_FSETID,CAP_KILL,CAP_NET_BIND_SERVICE,CAP_SETFCAP,CAP_SETGID,CAP_SETPCAP,CAP_SETUID,CAP_SYS_CHROOT
    rootless: true
    seccompEnabled: true
    seccompProfilePath: /etc/containers/seccomp.json
    selinuxEnabled: false
  serviceIsRemote: false
  slirp4netns:
    executable: /usr/bin/slirp4netns
    package: /usr/bin/slirp4netns is owned by slirp4netns 1.1.12-1
    version: |-
      slirp4netns version 1.1.12
      commit: 7a104a101aa3278a2152351a082a6df71f57c9a3
      libslirp: 4.6.1
      SLIRP_CONFIG_VERSION_MAX: 3
      libseccomp: 2.5.3
  swapFree: 0
  swapTotal: 0
  uptime: 24h 6m 59.51s (Approximately 1.00 days)
plugins:
  log:
  - k8s-file
  - none
  - journald
  network:
  - bridge
  - macvlan
  volume:
  - local
registries: {}
store:
  configFile: /home/kousu/.config/containers/storage.conf
  containerStore:
    number: 0
    paused: 0
    running: 0
    stopped: 0
  graphDriverName: overlay
  graphOptions: {}
  graphRoot: /home/kousu/.local/share/containers/storage
  graphStatus:
    Backing Filesystem: tmpfs
    Native Overlay Diff: "false"
    Supports d_type: "true"
    Using metacopy: "false"
  imageStore:
    number: 0
  runRoot: /run/user/1001/containers
  volumePath: /home/kousu/.local/share/containers/storage/volumes
version:
  APIVersion: 3.4.4
  Built: 1639074640
  BuiltTime: Thu Dec  9 13:30:40 2021
  GitCommit: f6526ada1025c2e3f88745ba83b8b461ca659933
  GoVersion: go1.17.4
  OsArch: linux/amd64
  Version: 3.4.4

+ findmnt --target=/home/kousu/.local/share/containers/storage
TARGET                              SOURCE FSTYPE OPTIONS
/home/kousu/.local/share/containers tmpfs  tmpfs  rw,relatime,inode64

+ df -h /home/kousu/.local/share/containers/storage
Filesystem      Size  Used Avail Use% Mounted on
tmpfs           7.7G   92K  7.7G   1% /home/kousu/.local/share/containers

+ findmnt --target=/run/user/1001/containers
TARGET         SOURCE FSTYPE OPTIONS
/run/user/1001 tmpfs  tmpfs  rw,nosuid,nodev,relatime,size=14454876k,nr_inodes=401524,mode=700,uid=1001,gid=1001,inode64

+ df -h /run/user/1001/containers
Filesystem      Size  Used Avail Use% Mounted on
tmpfs            14G  1.5M   14G   1% /run/user/1001

+ podman build -t lower_layer .
STEP 1/5: FROM ubuntu:20.04
Resolved "ubuntu" as an alias (/etc/containers/registries.conf.d/00-shortnames.conf)
Trying to pull docker.io/library/ubuntu:20.04...
Getting image source signatures
Copying blob 08c01a0ec47e done  
Copying config 54c9d81cbb done  
Writing manifest to image destination
Storing signatures
STEP 2/5: RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y strace
Get:1 http://archive.ubuntu.com/ubuntu focal InRelease [265 kB]
Get:2 http://security.ubuntu.com/ubuntu focal-security InRelease [114 kB]
Get:3 http://archive.ubuntu.com/ubuntu focal-updates InRelease [114 kB]
Get:4 http://security.ubuntu.com/ubuntu focal-security/restricted amd64 Packages [982 kB]
Get:5 http://archive.ubuntu.com/ubuntu focal-backports InRelease [108 kB]
Get:6 http://archive.ubuntu.com/ubuntu focal/restricted amd64 Packages [33.4 kB]
Get:7 http://archive.ubuntu.com/ubuntu focal/multiverse amd64 Packages [177 kB]
Get:8 http://archive.ubuntu.com/ubuntu focal/main amd64 Packages [1275 kB]
Get:9 http://security.ubuntu.com/ubuntu focal-security/main amd64 Packages [1577 kB]
Get:10 http://archive.ubuntu.com/ubuntu focal/universe amd64 Packages [11.3 MB]
Get:11 http://security.ubuntu.com/ubuntu focal-security/multiverse amd64 Packages [25.8 kB]
Get:12 http://security.ubuntu.com/ubuntu focal-security/universe amd64 Packages [842 kB]
Get:13 http://archive.ubuntu.com/ubuntu focal-updates/main amd64 Packages [2006 kB]
Get:14 http://archive.ubuntu.com/ubuntu focal-updates/universe amd64 Packages [1135 kB]
Get:15 http://archive.ubuntu.com/ubuntu focal-updates/multiverse amd64 Packages [29.4 kB]
Get:16 http://archive.ubuntu.com/ubuntu focal-updates/restricted amd64 Packages [1052 kB]
Get:17 http://archive.ubuntu.com/ubuntu focal-backports/main amd64 Packages [50.8 kB]
Get:18 http://archive.ubuntu.com/ubuntu focal-backports/universe amd64 Packages [25.2 kB]
Fetched 21.2 MB in 6s (3552 kB/s)
Reading package lists...
Reading package lists...
Building dependency tree...
Reading state information...
The following additional packages will be installed:
  libunwind8
The following NEW packages will be installed:
  libunwind8 strace
0 upgraded, 2 newly installed, 0 to remove and 10 not upgraded.
Need to get 428 kB of archives.
After this operation, 1844 kB of additional disk space will be used.
Get:1 http://archive.ubuntu.com/ubuntu focal/main amd64 libunwind8 amd64 1.2.1-9build1 [47.6 kB]
Get:2 http://archive.ubuntu.com/ubuntu focal-updates/main amd64 strace amd64 5.5-3ubuntu1 [380 kB]
debconf: delaying package configuration, since apt-utils is not installed
Fetched 428 kB in 1s (547 kB/s)
Selecting previously unselected package libunwind8:amd64.
(Reading database ... 4127 files and directories currently installed.)
Preparing to unpack .../libunwind8_1.2.1-9build1_amd64.deb ...
Unpacking libunwind8:amd64 (1.2.1-9build1) ...
dpkg: error processing archive /var/cache/apt/archives/libunwind8_1.2.1-9build1_amd64.deb (--unpack):
 unable to install new version of './usr/share/doc/libunwind8': Invalid cross-device link
Selecting previously unselected package strace.
Preparing to unpack .../strace_5.5-3ubuntu1_amd64.deb ...
Unpacking strace (5.5-3ubuntu1) ...
dpkg: error processing archive /var/cache/apt/archives/strace_5.5-3ubuntu1_amd64.deb (--unpack):
 unable to install new version of './usr/share/doc/strace': Invalid cross-device link
Errors were encountered while processing:
 /var/cache/apt/archives/libunwind8_1.2.1-9build1_amd64.deb
 /var/cache/apt/archives/strace_5.5-3ubuntu1_amd64.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)
Error: error building at STEP "RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y strace": error while running runtime: exit status 100

with this in dmesg:

[44032.315005] overlayfs: upper fs does not support xattr, falling back to index=off,metacopy=off.
[44032.315009] overlayfs: upper fs does not support xattr, falling back to xino=off.
[44032.333861] overlayfs: upper fs does not support xattr, falling back to index=off,metacopy=off.
[44032.333864] overlayfs: upper fs does not support xattr, falling back to xino=off.
[44044.295700] overlayfs: upper fs does not support xattr, falling back to index=off,metacopy=off.
[44044.295704] overlayfs: upper fs does not support xattr, falling back to xino=off.
[44044.295972] overlayfs: upper fs does not support xattr, falling back to index=off,metacopy=off.
[44044.295974] overlayfs: upper fs does not support xattr, falling back to xino=off.
STORAGE_DRIVER=overlay + fuse-overlayfs 🟠

Weirdly, this one still failed, but it fails at a different place than the previous one, hence the 🟠 instead of 🔴 . This is the first time on my system I've seen a difference between using fuse-overlayfs and not. Which is why I was curious if btrfs was the case, though I (seem to??) have disproved that.

$ STORAGE_DRIVER=overlay STORAGE_OPTS="overlay.mount_program=/usr/bin/fuse-overlayfs" sh repro.sh
+ podman version
Version:      3.4.4
API Version:  3.4.4
Go Version:   go1.17.4
Git Commit:   f6526ada1025c2e3f88745ba83b8b461ca659933
Built:        Thu Dec  9 13:30:40 2021
OS/Arch:      linux/amd64
+ podman info --debug
host:
  arch: amd64
  buildahVersion: 1.23.1
  cgroupControllers:
  - memory
  - pids
  cgroupManager: systemd
  cgroupVersion: v2
  conmon:
    package: /usr/bin/conmon is owned by conmon 1:2.1.0-1
    path: /usr/bin/conmon
    version: 'conmon version 2.1.0, commit: bdb4f6e56cd193d40b75ffc9725d4b74a18cb33c'
  cpus: 4
  distribution:
    distribution: arch
    version: unknown
  eventLogger: journald
  hostname: requiem
  idMappings:
    gidmap:
    - container_id: 0
      host_id: 1001
      size: 1
    - container_id: 1
      host_id: 100000
      size: 65537
    uidmap:
    - container_id: 0
      host_id: 1001
      size: 1
    - container_id: 1
      host_id: 100000
      size: 65537
  kernel: 5.16.10-arch1-1
  linkmode: dynamic
  logDriver: journald
  memFree: 2589032448
  memTotal: 16446435328
  ociRuntime:
    name: crun
    package: /usr/bin/crun is owned by crun 1.4.2-1
    path: /usr/bin/crun
    version: |-
      crun version 1.4.2
      commit: f6fbc8f840df1a414f31a60953ae514fa497c748
      spec: 1.0.0
      +SYSTEMD +SELINUX +APPARMOR +CAP +SECCOMP +EBPF +CRIU +YAJL
  os: linux
  remoteSocket:
    path: /run/user/1001/podman/podman.sock
  security:
    apparmorEnabled: false
    capabilities: CAP_CHOWN,CAP_DAC_OVERRIDE,CAP_FOWNER,CAP_FSETID,CAP_KILL,CAP_NET_BIND_SERVICE,CAP_SETFCAP,CAP_SETGID,CAP_SETPCAP,CAP_SETUID,CAP_SYS_CHROOT
    rootless: true
    seccompEnabled: true
    seccompProfilePath: /etc/containers/seccomp.json
    selinuxEnabled: false
  serviceIsRemote: false
  slirp4netns:
    executable: /usr/bin/slirp4netns
    package: /usr/bin/slirp4netns is owned by slirp4netns 1.1.12-1
    version: |-
      slirp4netns version 1.1.12
      commit: 7a104a101aa3278a2152351a082a6df71f57c9a3
      libslirp: 4.6.1
      SLIRP_CONFIG_VERSION_MAX: 3
      libseccomp: 2.5.3
  swapFree: 0
  swapTotal: 0
  uptime: 24h 5m 51.51s (Approximately 1.00 days)
plugins:
  log:
  - k8s-file
  - none
  - journald
  network:
  - bridge
  - macvlan
  volume:
  - local
registries: {}
store:
  configFile: /home/kousu/.config/containers/storage.conf
  containerStore:
    number: 0
    paused: 0
    running: 0
    stopped: 0
  graphDriverName: overlay
  graphOptions:
    overlay.mount_program:
      Executable: /usr/bin/fuse-overlayfs
      Package: /usr/bin/fuse-overlayfs is owned by fuse-overlayfs 1.8.2-1
      Version: |-
        fusermount3 version: 3.10.5
        fuse-overlayfs: version 1.8.2
        FUSE library version 3.10.5
        using FUSE kernel interface version 7.31
  graphRoot: /home/kousu/.local/share/containers/storage
  graphStatus:
    Backing Filesystem: tmpfs
    Native Overlay Diff: "false"
    Supports d_type: "true"
    Using metacopy: "false"
  imageStore:
    number: 5
  runRoot: /run/user/1001/containers
  volumePath: /home/kousu/.local/share/containers/storage/volumes
version:
  APIVersion: 3.4.4
  Built: 1639074640
  BuiltTime: Thu Dec  9 13:30:40 2021
  GitCommit: f6526ada1025c2e3f88745ba83b8b461ca659933
  GoVersion: go1.17.4
  OsArch: linux/amd64
  Version: 3.4.4

+ findmnt --target=/home/kousu/.local/share/containers/storage
TARGET                              SOURCE FSTYPE OPTIONS
/home/kousu/.local/share/containers tmpfs  tmpfs  rw,relatime,inode64

+ df -h /home/kousu/.local/share/containers/storage
Filesystem      Size  Used Avail Use% Mounted on
tmpfs           7.7G  112M  7.6G   2% /home/kousu/.local/share/containers

+ findmnt --target=/run/user/1001/containers
TARGET         SOURCE FSTYPE OPTIONS
/run/user/1001 tmpfs  tmpfs  rw,nosuid,nodev,relatime,size=14454876k,nr_inodes=401524,mode=700,uid=1001,gid=1001,inode64

+ df -h /run/user/1001/containers
Filesystem      Size  Used Avail Use% Mounted on
tmpfs            14G  1.5M   14G   1% /run/user/1001

+ podman build -t lower_layer .
STEP 1/5: FROM ubuntu:20.04
STEP 2/5: RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y strace
--> Using cache 57da15f574b354dc0d294fed1e4c294f4e483c2172038b29d777a9f1c6251441
--> 57da15f574b
STEP 3/5: COPY rename /usr/bin/
--> Using cache 8b6c784126fc7a440dc097d8224a2e202605712153f5f681367277803c1eaba8
--> 8b6c784126f
STEP 4/5: RUN mkdir -p /home/dir_lower
--> Using cache 01beff291752f153e81d03f3d36ae512548c26664e69eacb82c42b03c4fbb998
--> 01beff29175
STEP 5/5: RUN touch /home/file_lower
--> Using cache 5d338d2b6dd839c15b505ad3e37f52bda6b5c481a61a441d0b7ee13d9c9312e3
COMMIT lower_layer
--> 5d338d2b6dd
Successfully tagged localhost/lower_layer:latest
5d338d2b6dd839c15b505ad3e37f52bda6b5c481a61a441d0b7ee13d9c9312e3

Run the built container image, on overlay (via fuse-overlayfs) (rootless: true):
+ mkdir /home/dir_upper
+ touch /home/file_upper
+ ls -l /home
total 0
drwxr-xr-x 2 root root 40 Feb 22 17:41 dir_lower
drwxr-xr-x 2 root root 80 Feb 22 17:42 dir_upper
-rw-r--r-- 1 root root  0 Feb 22 17:41 file_lower
-rw-r--r-- 1 root root  0 Feb 22 17:42 file_upper
+ strace -e rename rename /home/file_upper /home/file_upper.bak
rename("/home/file_upper", "/home/file_upper.bak") = 0
+++ exited with 0 +++
+ strace -e rename rename /home/dir_upper /home/dir_upper.bak
rename("/home/dir_upper", "/home/dir_upper.bak") = 0
+++ exited with 0 +++
+ strace -e rename rename /home/file_lower /home/file_lower.bak
rename("/home/file_lower", "/home/file_lower.bak") = 0
+++ exited with 0 +++
+ strace -e rename rename /home/dir_lower /home/dir_lower.bak
rename("/home/dir_lower", "/home/dir_lower.bak") = -1 EXDEV (Invalid cross-device link)
rename: Invalid cross-device link
+++ exited with 2 +++

with this in dmesg:

[43901.265934] overlayfs: upper fs does not support xattr, falling back to index=off,metacopy=off.
[43901.265938] overlayfs: upper fs does not support xattr, falling back to xino=off.
STORAGE_DRIVER=vfs 🟢
$ STORAGE_DRIVER=vfs STORAGE_OPTS="" sh repro.sh
+ podman version
Version:      3.4.4
API Version:  3.4.4
Go Version:   go1.17.4
Git Commit:   f6526ada1025c2e3f88745ba83b8b461ca659933
Built:        Thu Dec  9 13:30:40 2021
OS/Arch:      linux/amd64
+ podman info --debug
host:
  arch: amd64
  buildahVersion: 1.23.1
  cgroupControllers:
  - memory
  - pids
  cgroupManager: systemd
  cgroupVersion: v2
  conmon:
    package: /usr/bin/conmon is owned by conmon 1:2.1.0-1
    path: /usr/bin/conmon
    version: 'conmon version 2.1.0, commit: bdb4f6e56cd193d40b75ffc9725d4b74a18cb33c'
  cpus: 4
  distribution:
    distribution: arch
    version: unknown
  eventLogger: journald
  hostname: requiem
  idMappings:
    gidmap:
    - container_id: 0
      host_id: 1001
      size: 1
    - container_id: 1
      host_id: 100000
      size: 65537
    uidmap:
    - container_id: 0
      host_id: 1001
      size: 1
    - container_id: 1
      host_id: 100000
      size: 65537
  kernel: 5.16.10-arch1-1
  linkmode: dynamic
  logDriver: journald
  memFree: 2160644096
  memTotal: 16446435328
  ociRuntime:
    name: crun
    package: /usr/bin/crun is owned by crun 1.4.2-1
    path: /usr/bin/crun
    version: |-
      crun version 1.4.2
      commit: f6fbc8f840df1a414f31a60953ae514fa497c748
      spec: 1.0.0
      +SYSTEMD +SELINUX +APPARMOR +CAP +SECCOMP +EBPF +CRIU +YAJL
  os: linux
  remoteSocket:
    path: /run/user/1001/podman/podman.sock
  security:
    apparmorEnabled: false
    capabilities: CAP_CHOWN,CAP_DAC_OVERRIDE,CAP_FOWNER,CAP_FSETID,CAP_KILL,CAP_NET_BIND_SERVICE,CAP_SETFCAP,CAP_SETGID,CAP_SETPCAP,CAP_SETUID,CAP_SYS_CHROOT
    rootless: true
    seccompEnabled: true
    seccompProfilePath: /etc/containers/seccomp.json
    selinuxEnabled: false
  serviceIsRemote: false
  slirp4netns:
    executable: /usr/bin/slirp4netns
    package: /usr/bin/slirp4netns is owned by slirp4netns 1.1.12-1
    version: |-
      slirp4netns version 1.1.12
      commit: 7a104a101aa3278a2152351a082a6df71f57c9a3
      libslirp: 4.6.1
      SLIRP_CONFIG_VERSION_MAX: 3
      libseccomp: 2.5.3
  swapFree: 0
  swapTotal: 0
  uptime: 24h 28m 25.62s (Approximately 1.00 days)
plugins:
  log:
  - k8s-file
  - none
  - journald
  network:
  - bridge
  - macvlan
  volume:
  - local
registries: {}
store:
  configFile: /home/kousu/.config/containers/storage.conf
  containerStore:
    number: 0
    paused: 0
    running: 0
    stopped: 0
  graphDriverName: vfs
  graphOptions: {}
  graphRoot: /home/kousu/.local/share/containers/storage
  graphStatus: {}
  imageStore:
    number: 0
  runRoot: /run/user/1001/containers
  volumePath: /home/kousu/.local/share/containers/storage/volumes
version:
  APIVersion: 3.4.4
  Built: 1639074640
  BuiltTime: Thu Dec  9 13:30:40 2021
  GitCommit: f6526ada1025c2e3f88745ba83b8b461ca659933
  GoVersion: go1.17.4
  OsArch: linux/amd64
  Version: 3.4.4

+ findmnt --target=/home/kousu/.local/share/containers/storage
TARGET                              SOURCE FSTYPE OPTIONS
/home/kousu/.local/share/containers tmpfs  tmpfs  rw,relatime,inode64

+ df -h /home/kousu/.local/share/containers/storage
Filesystem      Size  Used Avail Use% Mounted on
tmpfs           7.7G   92K  7.7G   1% /home/kousu/.local/share/containers

+ findmnt --target=/run/user/1001/containers
TARGET         SOURCE FSTYPE OPTIONS
/run/user/1001 tmpfs  tmpfs  rw,nosuid,nodev,relatime,size=14454876k,nr_inodes=401524,mode=700,uid=1001,gid=1001,inode64

+ df -h /run/user/1001/containers
Filesystem      Size  Used Avail Use% Mounted on
tmpfs            14G  1.5M   14G   1% /run/user/1001

+ podman build -t lower_layer .
STEP 1/5: FROM ubuntu:20.04
Resolved "ubuntu" as an alias (/etc/containers/registries.conf.d/00-shortnames.conf)
Trying to pull docker.io/library/ubuntu:20.04...
Getting image source signatures
Copying blob 08c01a0ec47e done  
Copying config 54c9d81cbb done  
Writing manifest to image destination
Storing signatures
STEP 2/5: RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y strace
Get:1 http://archive.ubuntu.com/ubuntu focal InRelease [265 kB]
Get:2 http://security.ubuntu.com/ubuntu focal-security InRelease [114 kB]
Get:3 http://archive.ubuntu.com/ubuntu focal-updates InRelease [114 kB]
Get:4 http://security.ubuntu.com/ubuntu focal-security/universe amd64 Packages [842 kB]
Get:5 http://archive.ubuntu.com/ubuntu focal-backports InRelease [108 kB]
Get:6 http://archive.ubuntu.com/ubuntu focal/restricted amd64 Packages [33.4 kB]
Get:7 http://archive.ubuntu.com/ubuntu focal/multiverse amd64 Packages [177 kB]
Get:8 http://archive.ubuntu.com/ubuntu focal/main amd64 Packages [1275 kB]
Get:9 http://security.ubuntu.com/ubuntu focal-security/main amd64 Packages [1577 kB]
Get:10 http://archive.ubuntu.com/ubuntu focal/universe amd64 Packages [11.3 MB]
Get:11 http://security.ubuntu.com/ubuntu focal-security/multiverse amd64 Packages [25.8 kB]
Get:12 http://security.ubuntu.com/ubuntu focal-security/restricted amd64 Packages [982 kB]
Get:13 http://archive.ubuntu.com/ubuntu focal-updates/restricted amd64 Packages [1052 kB]
Get:14 http://archive.ubuntu.com/ubuntu focal-updates/main amd64 Packages [2006 kB]
Get:15 http://archive.ubuntu.com/ubuntu focal-updates/multiverse amd64 Packages [29.4 kB]
Get:16 http://archive.ubuntu.com/ubuntu focal-updates/universe amd64 Packages [1135 kB]
Get:17 http://archive.ubuntu.com/ubuntu focal-backports/universe amd64 Packages [25.2 kB]
Get:18 http://archive.ubuntu.com/ubuntu focal-backports/main amd64 Packages [50.8 kB]
Fetched 21.2 MB in 8s (2694 kB/s)
Reading package lists...
Reading package lists...
Building dependency tree...
Reading state information...
The following additional packages will be installed:
  libunwind8
The following NEW packages will be installed:
  libunwind8 strace
0 upgraded, 2 newly installed, 0 to remove and 10 not upgraded.
Need to get 428 kB of archives.
After this operation, 1844 kB of additional disk space will be used.
Get:1 http://archive.ubuntu.com/ubuntu focal/main amd64 libunwind8 amd64 1.2.1-9build1 [47.6 kB]
Get:2 http://archive.ubuntu.com/ubuntu focal-updates/main amd64 strace amd64 5.5-3ubuntu1 [380 kB]
debconf: delaying package configuration, since apt-utils is not installed
Fetched 428 kB in 2s (254 kB/s)
Selecting previously unselected package libunwind8:amd64.
(Reading database ... 4127 files and directories currently installed.)
Preparing to unpack .../libunwind8_1.2.1-9build1_amd64.deb ...
Unpacking libunwind8:amd64 (1.2.1-9build1) ...
Selecting previously unselected package strace.
Preparing to unpack .../strace_5.5-3ubuntu1_amd64.deb ...
Unpacking strace (5.5-3ubuntu1) ...
Setting up libunwind8:amd64 (1.2.1-9build1) ...
Setting up strace (5.5-3ubuntu1) ...
Processing triggers for libc-bin (2.31-0ubuntu9.2) ...
--> 78f2a3d0879
STEP 3/5: COPY rename /usr/bin/
--> 4ce39b55eb7
STEP 4/5: RUN mkdir -p /home/dir_lower
--> 5c10fea1184
STEP 5/5: RUN touch /home/file_lower
COMMIT lower_layer
--> 2d121a2ca7d
Successfully tagged localhost/lower_layer:latest
2d121a2ca7dce74cc7d5904858b1e3555f73db4b0b1c6bad10a617ae106acb31

Run the built container image, on vfs (via (kernel)) (rootless: true):
+ mkdir /home/dir_upper
+ touch /home/file_upper
+ ls -l /home
total 0
drwxr-xr-x 2 root root 40 Feb 22 18:05 dir_lower
drwxr-xr-x 2 root root 40 Feb 22 18:05 dir_upper
-rw-r--r-- 1 root root  0 Feb 22 18:05 file_lower
-rw-r--r-- 1 root root  0 Feb 22 18:05 file_upper
+ strace -e rename rename /home/file_upper /home/file_upper.bak
rename("/home/file_upper", "/home/file_upper.bak") = 0
+++ exited with 0 +++
+ strace -e rename rename /home/dir_upper /home/dir_upper.bak
rename("/home/dir_upper", "/home/dir_upper.bak") = 0
+++ exited with 0 +++
+ strace -e rename rename /home/file_lower /home/file_lower.bak
rename("/home/file_lower", "/home/file_lower.bak") = 0
+++ exited with 0 +++
+ strace -e rename rename /home/dir_lower /home/dir_lower.bak
rename("/home/dir_lower", "/home/dir_lower.bak") = 0
+++ exited with 0 +++
+ ls /home
dir_lower.bak  dir_upper.bak  file_lower.bak  file_upper.bak

with this in dmesg, same as the previous case:

[45347.982487] overlayfs: upper fs does not support xattr, falling back to index=off,metacopy=off.
[45347.982492] overlayfs: upper fs does not support xattr, falling back to xino=off.

tmpfs is mentioned as a problem in the thread above:

Perhaps the solution will be to add user xattr support to tmpfs..

So maybe I'm just out of luck. If the root of the problem is lack of userxattr, it would be helpful to future users if podman could detect this and 1. warn about it or 2. fall back to STORAGE_DRIVER=vfs.


I'm still stuck where I was; the only reliable workaround is:

$ mkdir -p ~/.config/containers && 
    (echo '[storage]';
     echo 'driver = "vfs"') > ~/.config/containers/storage.conf &&
    podman system reset &&
    unset STORAGE_DRIVER STORAGE_OPTS

WARNING! This will remove:
        - all containers
        - all pods
        - all images
        - all build cache
Are you sure you want to continue? [y/N] y
A storage.conf file exists at /home/kousu/.config/containers/storage.conf
You should remove this file if you did not modified the configuration.

@Hi-Angel
Copy link
Author

@Hi-Angel, would you be willing to try my repro.sh on your system?

Not sure if this question is still relevant, but running the script on my btrfs ends up with

rename("/home/dir_lower", "/home/dir_lower.bak") = -1 EXDEV (Invalid cross-device link)
rename: Invalid cross-device link

That is with fuse-overlayfs as mount program

@kousu
Copy link
Contributor

kousu commented Feb 22, 2022

@Hi-Angel, would you be willing to try my repro.sh on your system?

Not sure if this question is still relevant, but running the script on my btrfs ends up with

rename("/home/dir_lower", "/home/dir_lower.bak") = -1 EXDEV (Invalid cross-device link)
rename: Invalid cross-device link

That is with fuse-overlayfs as mount program

Thank you! That's useful confirmation. I do not know what it means yet, but it's useful.

I tried running your container on an older kernel:

$ uname -a
Linux bireli.neuro.polymtl.ca 5.4.0-99-generic #112-Ubuntu SMP Thu Feb 3 13:50:55 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux

It uses fuse-overlayfs by default, and that succeeds:

$ podman info --debug | grep fuse-overlayfs; echo; strace -o strace.log -f podman run --rm -it docker.io/kkharlamov/bugreport-enomem     apt install libreadline-dev
      Executable: /usr/bin/fuse-overlayfs
      Package: 'fuse-overlayfs: /usr/bin/fuse-overlayfs'
        fuse-overlayfs: version 1.5

Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following packages were automatically installed and are no longer required:
  gyp javascript-common libasan6:i386 libatomic1:i386 libboost-dev libboost1.65-dev libc-ares2 libc6-dev:i386 libgomp1:i386 libhttp-parser2.7.1
  libitm1:i386 libjs-async libjs-inherits libjs-jquery libjs-node-uuid libjs-underscore libquadmath0:i386 libstdc++6:i386 libubsan1:i386 libuv1-dev
  libyaml-cpp0.5v5 linux-libc-dev:i386 nodejs-doc python-chardet python-pkg-resources
Use 'apt autoremove' to remove them.
Suggested packages:
  readline-doc
The following NEW packages will be installed:
  libreadline-dev
0 upgraded, 1 newly installed, 0 to remove and 148 not upgraded.
Need to get 133 kB of archives.
After this operation, 728 kB of additional disk space will be used.
Get:1 http://archive.ubuntu.com/ubuntu bionic/main amd64 libreadline-dev amd64 7.0-3 [133 kB]
Fetched 133 kB in 1s (263 kB/s)         
debconf: delaying package configuration, since apt-utils is not installed
Selecting previously unselected package libreadline-dev:amd64.
(Reading database ... 156394 files and directories currently installed.)
Preparing to unpack .../libreadline-dev_7.0-3_amd64.deb ...
Unpacking libreadline-dev:amd64 (7.0-3) ...
Setting up libreadline-dev:amd64 (7.0-3) ...

Here's the successful part of strace corresponding to where it fails on the newer system:

$ egrep '^111054' strace.log
[...]  # manually clipped
111054 lstat("/usr/include/readline",  <unfinished ...>
111054 <... lstat resumed>0x7ffed5159b70) = -1 ENOENT (No such file or directory)
111054 rename("/usr/include/readline.dpkg-tmp", "/usr/include/readline" <unfinished ...>
111054 <... rename resumed>)            = -1 ENOENT (No such file or directory)
111054 stat("/usr/include/readline", 0x7ffed5159c90) = -1 ENOENT (No such file or directory)
111054 rmdir("/usr/include/readline.dpkg-new" <unfinished ...>
111054 <... rmdir resumed>)             = -1 ENOENT (No such file or directory)
111054 rmdir("/usr/include/readline.dpkg-tmp") = -1 ENOENT (No such file or directory)
111054 mkdir("/usr/include/readline.dpkg-new", 000 <unfinished ...>
111054 <... mkdir resumed>)             = 0
111054 chown("/usr/include/readline.dpkg-new", 0, 0 <unfinished ...>
111054 <... chown resumed>)             = 0
111054 chmod("/usr/include/readline.dpkg-new", 0755 <unfinished ...>
111054 <... chmod resumed>)             = 0
111054 utimes("/usr/include/readline.dpkg-new", [{tv_sec=1645570768, tv_usec=0} /* 2022-02-22T17:59:28-0500 */, {tv_sec=1494878423, tv_usec=0} /* 2017-05-15T16:00:23-0400 */] <unfinished ...>
111054 <... utimes resumed>)            = 0
111054 rename("/usr/include/readline.dpkg-new", "/usr/include/readline" <unfinished ...>
111054 <... rename resumed>)            = 0
[...]  # manually clipped

If I try to force it to not use fuse-overlayfs, then it refuses to run:

$ podman system reset -f; podman --storage-opt="" info --debug | grep fuse-overlayfs; echo; --storage-opt="" run --rm -it docker.io/kkharlamov/bugreport-enomem     apt install libreadline-dev
Error: kernel does not support overlay fs: unable to create kernel-style whiteout: operation not permitted

Error: kernel does not support overlay fs: unable to create kernel-style whiteout: operation not permitted

I'm going to try your container now on my other laptop which is also running Arch, but with ext4 and that I reinstalled recently. It should be able to attempt rootless overlayfs. Maybe there's some secretly bad state that podman is choking on on my older system and the newer one will just work.

@kousu
Copy link
Contributor

kousu commented Feb 23, 2022

I'm going to try your container now on my other laptop which is also running Arch, but with ext4 and that I reinstalled recently. It should be able to attempt rootless overlayfs. Maybe there's some secretly bad state that podman is choking on on my older system and the newer one will just work.

Just to let you know: I tried but wasn't able to complete this. docker.io/kkharlamov/bugreport-enomem is something like 8GB unpacked and like I said above the original reason I found this bug report was that my disks are pretty slow on that system. I left it running for about 2 hours with my system freezing up the whole time before I gave up.

I wish I knew what it was about that image that makes it different from the lower_layer I generated. Can you share its Dockerfile?

@Hi-Angel
Copy link
Author

Can you share its Dockerfile?

I'm afraid there's no Dockerfile. It was originally a ubuntu 18.04, which was modified during 1.5 years by installing various packages and executing a podman commit ….

@kousu
Copy link
Contributor

kousu commented Mar 1, 2022

I'm afraid there's no Dockerfile. It was originally a ubuntu 18.04, which was modified during 1.5 years by installing various packages and executing a podman commit ….

Thanks for this clue! I sat down with this again last night and was able to trace it out. There's an oversight in storage.drivers.overlay that is only triggered when using

  1. the native overlayfs driver
  2. in rootless mode
  3. on a container image with many, many layers

Here's how I traced this out.

Symptoms

I took note that my lower_layer created by my repro.sh (#13123 (comment)) and @Hi-Angel's behaved differently: mine can run apt and make and rename folders (though it can't rename a preexisting folder, one created in a lower overlay layer):

$ podman run --cap-add=SYS_PTRACE --rm -it lower_layer:latest 
root@809f172109a9:/# Z=$(mktemp -d); strace -e rename mv -v $Z $Z.bak
renamed '/tmp/tmp.Xq1VfMzyyq' -> '/tmp/tmp.Xq1VfMzyyq.bak'
+++ exited with 0 +++

but his fails on any apt attempt because (as noted above #13123 (comment)) rename() fails -- even on folders made in the top layer:

$ podman run --cap-add=SYS_PTRACE --rm -it docker.io/kkharlamov/bugreport-enomem
╭─root@22b8358b18a0  / ‹node-›  ‹›
╰─$ Z=$(mktemp -d); strace -e rename mv -v $Z $Z.bak
rename("/tmp/tmp.YcUhoQVKZC", "/tmp/tmp.YcUhoQVKZC.bak") = -1 EXDEV (Invalid cross-device link)
created directory '/tmp/tmp.YcUhoQVKZC.bak'
removed directory '/tmp/tmp.YcUhoQVKZC'
+++ exited with 0 +++

I went searching for why.

Inspecting

I read up on user_namespaces(7) and I figured out with both containers running I could inspect "under their floorboards" by with by nsentering their kernel namespace:

$ lsns | grep podman
4026532871 user        9  2950 kousu podman
4026532872 mnt         5  2950 kousu podman
$ nsenter -U -m -t 2950 mount | grep "overlay on"   # -U == user, -m == mnt; requesting any others requires sudo because podman hasn't allocated those namespaces
overlay on /home/kousu/.local/share/containers/storage/overlay/d7c83476c8f942bef2f2a09af7299ea477539598d3615efe12b2aed98e04918c/merged type overlay (rw,relatime,lowerdir=/home/kousu/.local/share/containers/storage/overlay/l/PNCQVBDSULJ5RTIBTT5TWSZWB4:/home/kousu/.local/share/containers/storage/overlay/l/DWIB6VA26G7ADZPM2MWNXAER3R:/home/kousu/.local/share/containers/storage/overlay/l/N3UC4P6K6D5X2XB3KRM5C7Z4I2:/home/kousu/.local/share/containers/storage/overlay/l/VIPESUNTHVVSNWQ257T7QFCKIH:/home/kousu/.local/share/containers/storage/overlay/l/EFSU256NSEESIK66WLNKSB2N4A,upperdir=/home/kousu/.local/share/containers/storage/overlay/d7c83476c8f942bef2f2a09af7299ea477539598d3615efe12b2aed98e04918c/diff,workdir=/home/kousu/.local/share/containers/storage/overlay/d7c83476c8f942bef2f2a09af7299ea477539598d3615efe12b2aed98e04918c/work,index=off,metacopy=off,volatile,userxattr)
overlay on /home/kousu/.local/share/containers/storage/overlay/bea2e46a25207d77bf18bdc451d0a411ba0eda8a555f7c1a87d6514af43f94f5/merged type overlay (rw,relatime,lowerdir=l/V5MW4GSYR4LZWGJAEKI6VPQ5LK:l/PEXMFA6AB7IBPVULJDKF3UQHB6:l/E6TX2PDKNWUW5ZHPTQB4Z5S2WL:l/J3DH3KTLVQRVUYY5YCAZTNOCS3:l/WY72SHAFPAK4TEMGMFVMQVFSRN:l/EXBFDZ2H6TCANQXJC236E67UAU:l/XNONCHGOQAITDC2NRI2KDMLB7D:l/3QAHF6EAVPQIRQM2MZ2ICGBHRU:l/JPBLRBC6DBCTUGTGEKEUFD4FC7:l/G2QJVBN2XCDSGSLERY6LQTWP6U:l/WI33PZSLKMMFZ4K5WVPUHKL5B7:l/ABTJNOSJUPZU7QGCR5NRKLUOYG:l/6DCMRXXRSHMASV2UTC7NLDJUFH:l/42325RQYDGTWPOKNVNARUJPBR6:l/JQ7X3WNRAILJTIBASCCZH3YNEM:l/7XABMNHUJ4J2TCDUCACGLCVFZZ:l/ENEJ7W33SYHH7OVSO3NCS4M7CF:l/ORUBRX3UHCRNW25PTDMWYXGTSX:l/JCVLDMLQ5MVWB42VE2RAZDVQ4Q:l/FROMRMZFP7A6BZENO6JGITQXJD:l/IJKU2CGWWALCSF3ZJCNTLF4AQX:l/DQRXSB3GO7IJVFAPPWPPTJ5U53:l/36HVBAUQS3I7IL3YQGNZUEWTYN:l/ZSUTN5USUDHHDI3YPUPJHWSFBR:l/YQFKQE7M67ZGCX4D4TOJVMQO4J:l/2T6EYTLM3NCA7RZYVA67G2EKUA:l/4B53RLAY7572DOOPAPNAOQVVGS:l/GZM3TSIFEWFA2JC37LN5B7RUEF:l/XRUC27XIYZAGJVHYUCE7NQU7IQ:l/VWQF67YF7MWUWYM3HZJCRTY557:l/FJSYW3MGLECQXDLHNE7BWVRAH7:l/3GUNL5VSULGHAIQ7RFTNVU55BT:l/QUEYVQMQSTYOQEUDCBVMXH425Z:l/6X35PRBMCNP5JO4ANKBQEC533N:l/E4VBMJX4SPYO763RSN7S7YY3MA:l/I2EVLTFQQVKMRH6R5MI65BQZHQ:l/FP7SHTGIXEIUVUJLOWBLCBAVA6:l/Y5G5DRGQWU3OMI34RD2HCCD4AY:l/O2FTWOQXZ6XSF2ISLVJOJY56JR:l/FB5APONHPOTVLDMLRAF5JAHY2K:l/ALFC3CRGOYXBPVWPYCR6I3AY6Y:l/3GW7H35CMKQGZV33SO7NANKTAK:l/66FC6XTOTCYW6EKCQOCK52JERS:l/65VWKK22S3SF7ECUBT7NGPS3SG:l/3TD7BNOPW3MGNRFAJXUMPEVAUP:l/FOLA5JDRVJZOQLKA3SCCZ3INXM:l/H4CCKACX44KBFADT3R2565NBI4:l/66MR4A4SB34XLVB4DL5UOHDMK6:l/FP23GP3LTTANVAM4BTBF4PRUD3:l/26BI2XBIWFEWGNKX54W76KCJTE:l/5FDXS7LR7PVC5PR5C75RXA5ECW:l/C5AZGUWPJDVHZFKFEWLHYCIS35,upperdir=bea2e46a25207d77bf18bdc451d0a411ba0eda8a555f7c1a87d6514af43f94f5/diff,workdir=bea2e46a25207d77bf18bdc451d0a411ba0eda8a555f7c1a87d6514af43f94f5/work,index=off,metacopy=off)

What immediately stuck out:

  1. I can see both containers' mounts here, so podman must be sharing a single namespace between all containers.

    Good to know though not directly relevant.

  2. I can tell the first line is the smaller container (lower_layer) because it is shorter -- it has less layers to mount than docker.io/kkharlamov/bugreport-enomem.

    I also confirmed this by mktemping some files in each container and checking I could see the matching names via nsenter -U -m -t 2950 ls /home/kousu/.local/share/containers/storage/overlay/*/merged/tmp

  3. The smaller container was mounted with absolute paths, but the smaller one seems to be using relative paths.

  4. The smaller container has volatile,userxattr, but the larger container doesn't.

This last point confused me, so I used strace -f -o container.trace podman run --rm -it docker.io/kkharlamov/bugreport-enomem to look closer, and found that indeed there was a chdir() that went with mount():

51758 chdir("/home/kousu/.local/share/containers/storage/overlay") = 0
51758 mount("overlay", "dab78adc3bc2642353e6f5716300f99f0b2ee95461248ab3d3e6bc56ae5c24bd/merged", "overlay", 0, "lowerdir=l/V5MW4GSYR4LZWGJAEKI6V"...) = 0

Root Cause

I read in https://www.kernel.org/doc/html/latest/filesystems/overlayfs.html that

The the “-o userxattr” mount option forces overlayfs to use the “user.overlay.” xattr namespace instead of “trusted.overlay.”. This is useful for unprivileged mounting of overlayfs.

I skimmed the rest of those docs and I still don't really understand it all, except that indeed, overlayfs has to handle rename() intricately, and that rootless mode needs userxattr, so losing it must be the cause.

But I wondered why volatile was also missing. And that was the string I pulled on to unravel the mystery.

Tracing the Code

[kousu@requiem podman]$ git grep volatile
RELEASE_NOTES.md:- Containers created with the `--rm` option now automatically use the `volatile` storage flag when available for their root filesystems, causing them not to write changes to disk as often as they will be removed at completion anyways. This should result in improved performance.

so volatile is added because I passed --rm; but that didn't seem to have anything to do with the bug. And sometimes in my experience that sort of counterintuitive connection is exactly what you need to highlight the relevant clues. I kept looking through git grep volatile and well, long story short, that word doesn't show up that often, and I narrowed down where both flags get added:

if d.options.mountProgram == "" && unshare.IsRootless() {
opts = fmt.Sprintf("%s,userxattr", opts)
}
// If "volatile" is not supported by the file system, just ignore the request
if options.Volatile && !hasVolatileOption(strings.Split(opts, ",")) {
supported, err := d.getSupportsVolatile()
if err != nil {
return "", err
}
if supported {
opts = fmt.Sprintf("%s,volatile", opts)
}
}

and, 👏 to the podman team, just below there's this comment which precisely fits the symptoms above:

// Use relative paths and mountFrom when the mount data has exceeded
// the page size. The mount syscall fails if the mount data cannot
// fit within a page and relative links make the mount data much
// smaller at the expense of requiring a fork exec to chroot.

  1. A long mount command -- due to many layers
  2. Relative paths

and the code that implements that comment overwrites opts

} else if len(mountData) > pageSize {
workdir = path.Join(id, "work")
//FIXME: We need to figure out to get this to work with additional stores
if readWrite {
diffDir := path.Join(id, "diff")
opts = fmt.Sprintf("lowerdir=%s,upperdir=%s,workdir=%s", strings.Join(relLowers, ":"), diffDir, workdir)
} else {
opts = fmt.Sprintf("lowerdir=%s", strings.Join(absLowers, ":"))
}

which fits the final symptom

  1. Forgetting about volatile and userxattr

Ta-dah

So, that was the bug. #13375 should fix it, and you should be able to use your container without fuse-overlayfs, @Hi-Angel. Thanks for helping me solve it! "modified during 1.5 years by installing various packages and executing a podman commit" gave me exactly the insight I needed.

@Hi-Angel
Copy link
Author

Hi-Angel commented Mar 1, 2022

This is an amazing research, thank you very much!

@kousu
Copy link
Contributor

kousu commented Mar 7, 2022

This is sort of beating the horse dead, but I have only been working on this in my spare time, and I want to be sure. I got stumped on https://github.com/containers/podman/issues/13432 too...

but anyway now I've been able to work out a minimal reproducer the replicates your bug without having to download anything, which shows that the issue really is the many layers:

#!/bin/sh
#
# reproduce https://github.com/containers/podman/issues/13123
# 
# When:
#
# - using the non-fuse-overlayfs overlay storage driver
# - on a large number of container layers
# - in rootless mode
#
# then:
# 
# - rename()ing any directory in the container fails.
#
# Usage: rename-repro.sh [LAYERS]
#   LAYERS is the number of layers to create in the container.
# 

set -eu

LAYERS=${1:-50}

# The bug is in the native overlayfs backend, the one without fuse-overlayfs
export STORAGE_DRIVER=overlay STORAGE_OPTS=""

# verify configured driver is actually active: if you switch the driver you 
# have to erase the entire cache of containers/images/cached config. And sometimes even twice before it will stick?
if podman info --debug 2>&1 | grep -q 'delete libpod local files to resolve'; then
  echo "In order to switch graph drivers, you must erase your existing containers/images/cache."
  podman system reset
  if podman info --debug 2>&1 | grep -q 'delete libpod local files to resolve'; then
    echo "You chose to keep your existing containers. This reproduction script cannot work. Exiting."
    exit 1
  fi

  # sometimes the above *does not work*, so force it a second time over
  GRAPHROOT=$(podman info --format={{".Store.GraphRoot"}})
  rm -f "$GRAPHROOT"/libpod/* # XXX dangerous
  podman system reset -f # XXX dangerous
fi

cat <<EOF |
// rename.c: a direct interface to rename(2) without all that coreutils junk in the way
#include <stdio.h>
#include <errno.h>
int main(int argc, char* argv[]) {
  if(argc != 3) { errno = EINVAL; perror("argv"); return 1; }
  if(rename(argv[1], argv[2]) != 0) { perror("rename"); return 2; }
  return 0;
}
EOF
gcc -static -x c - -o rename

# Make a container with many layers
LAYERS=$(($LAYERS - 3)) # the test container has $LAYERS plus the base layer plus the COPY layer plus the final actual layer
(
echo "FROM alpine"
echo "COPY rename /usr/bin"
for i in `seq $LAYERS`; do
  echo 'RUN dd if=/dev/urandom of=$(mktemp) count=1'
done
) | podman build -f - -t layer .

podman --log-level=debug run -it --rm layer sh -c '
  mkdir A &&
  rename A B
'

I made a username with 3 characters in it (because https://github.com/containers/podman/issues/13432 showed me that 5 wouldn't work at the moment).

sudo useradd -m tst
sudo -i -u tst

A shorter or longer name will change the precise number of layers where the problem appears. With USER=tst, it happens to appear at layer 50:

[tst@requiem ~]$ sh rename-repro.sh 50
[...]
STEP 49/49: RUN dd if=/dev/urandom of=$(mktemp) count=1
--> Using cache 95d8c74f6fc7a5b76f18c38d19b4e21bfc0d696ebdbe184cc56cb453b709c3cf
COMMIT layer
--> 95d8c74f6fc
Successfully tagged localhost/layer:latest
[...]
DEBU[0000] overlay: mount_data=lowerdir=l/6MRCIQO52TVXNM4HXTAAJR2ODI:l/IIOYYWVMYJPQJGJOICDQVFW2DC:l/WEWLGOFKIGV7GBF7U746D4DENB:l/RCPD3W3QL3A3QDJUX5ZSRYRZN6:l/KSG34SZDDECVWV5C6WWBINYWLM:l/DCBKO747JINKXJM36T2SLFK6RB:l/D2XXK3YKQ4JQSS5WD27JK36UG7:l/C353DSRGEGSYKHD6PSNQ3FLENX:l/YSVEGIGVDMDVNGBOLJTF5ET3SK:l/Y46ZPOYX3OCGOEWRUAVHE5ZX5X:l/X2M67CDXDF2LD5EHVIFOCC26X7:l/MMKDZQ4EGSHKEQEUGFGV5JDIFX:l/CCGJDIIT3BQKCCDC5CWB6QLYH3:l/3BUR3ZNLOGKNVU66VUX2E3CD57:l/57KVSXUB7UXCPCW4RKHFVBD4OQ:l/JCER4YLA4YHDGWRLKTSA422I3V:l/ZL3GS2HYKUVVB37EVPYGQSH423:l/PLVVYDKGCGXT3E4QBKJFMDTBS6:l/CWA3ZLDUBP3CVWVNANQ7I2NUYZ:l/P6FHVR22RGARI24JNVU7RNJ3PS:l/GGQMG7RTTKTNDHEDG4S2VQNMUY:l/XLMBB62DOG66SN5SQKPJH5CXX5:l/KSMDG6UUVBN4THICOUZRJ3IVZ2:l/3TAMAIP4ZWC7QGGLZTRL7JMDNX:l/VOWJFH4NWGEDOH7MAGOS7YMSKJ:l/TEOWIK6WH3UYW27623WLCJZMXB:l/NWIXLODDY2EUOLWDSAF23QS2J6:l/6UX4LIHS7Z5WTW6JLKAUCC4PGL:l/N32FCKQPZ76WBBIYF4Y3UG5TVC:l/XQBTXA4DTO63MP5CAKOIUWX6JK:l/ULM3RZONWX7Z5TEINKKWV3MZD5:l/W6BZA4OFDQWL24FKORN6TAHQAY:l/SCT75IHFFLEY7T6XJSAVDZY5J7:l/QDJTOMBN2T4Q3NK4ACBSSDXBHN:l/62XELSXZS2ASDT3GXAKTU247NL:l/35RPXRWRSXBZANK4QQ6KTNS6NT:l/JGNCNKJK4GJ47IWO5OY4UL6VTU:l/6IFLG5WBVVQERLVOW2GXEWW47N:l/DHZXSMH55QMV2DSEXGY5LMTVLU:l/KWGMTXCTHBZFH3IMAV4Y2IKLDK:l/3W6RRVHVZYHFHAVRHXQCZCS3B5:l/46EQXSIMMZE6K2U3V2NPAT7R2F:l/A3E35CXGESKFTUVPH2MFYUJ6J2:l/NCAIGBJHZ35YTYUEEQ4IE2C7OW:l/522MEICOJZP5XUB3G6YG6TEF5O:l/BSH4DGY2GHU2SXF67JZVCMAID5:l/ZMJE73AU5FB7GBS634AQ4QTN44:l/NMEBUD3IYBIU2LXH5WJWIDWCPS:l/M5U2EV7UM3DYUAW54JBZTW4VMN,upperdir=c52fffd0e9c9c8ae1a0b877da3244db2877d44ce7f6ae531a7bfd70f39599664/diff,workdir=c52fffd0e9c9c8ae1a0b877da3244db2877d44ce7f6ae531a7bfd70f39599664/work 
[...]
rename: Invalid cross-device link

Whereas layer 49 doesn't have the problem:

[tst@requiem ~]$ sh rename-repro.sh.txt 49
[...]
STEP 48/48: RUN dd if=/dev/urandom of=$(mktemp) count=1
--> Using cache c5d8bdb24f47e1e1a92daf8139f766e7cfd4b62d03758c5d6f2fb131178c2f76
COMMIT layer
--> c5d8bdb24f4
Successfully tagged localhost/layer:latest
[...]
DEBU[0000] overlay: mount_data=,lowerdir=/home/tst/.local/share/containers/storage/overlay/l/IIOYYWVMYJPQJGJOICDQVFW2DC:/home/tst/.local/share/containers/storage/overlay/l/WEWLGOFKIGV7GBF7U746D4DENB:/home/tst/.local/share/containers/storage/overlay/l/RCPD3W3QL3A3QDJUX5ZSRYRZN6:/home/tst/.local/share/containers/storage/overlay/l/KSG34SZDDECVWV5C6WWBINYWLM:/home/tst/.local/share/containers/storage/overlay/l/DCBKO747JINKXJM36T2SLFK6RB:/home/tst/.local/share/containers/storage/overlay/l/D2XXK3YKQ4JQSS5WD27JK36UG7:/home/tst/.local/share/containers/storage/overlay/l/C353DSRGEGSYKHD6PSNQ3FLENX:/home/tst/.local/share/containers/storage/overlay/l/YSVEGIGVDMDVNGBOLJTF5ET3SK:/home/tst/.local/share/containers/storage/overlay/l/Y46ZPOYX3OCGOEWRUAVHE5ZX5X:/home/tst/.local/share/containers/storage/overlay/l/X2M67CDXDF2LD5EHVIFOCC26X7:/home/tst/.local/share/containers/storage/overlay/l/MMKDZQ4EGSHKEQEUGFGV5JDIFX:/home/tst/.local/share/containers/storage/overlay/l/CCGJDIIT3BQKCCDC5CWB6QLYH3:/home/tst/.local/share/containers/storage/overlay/l/3BUR3ZNLOGKNVU66VUX2E3CD57:/home/tst/.local/share/containers/storage/overlay/l/57KVSXUB7UXCPCW4RKHFVBD4OQ:/home/tst/.local/share/containers/storage/overlay/l/JCER4YLA4YHDGWRLKTSA422I3V:/home/tst/.local/share/containers/storage/overlay/l/ZL3GS2HYKUVVB37EVPYGQSH423:/home/tst/.local/share/containers/storage/overlay/l/PLVVYDKGCGXT3E4QBKJFMDTBS6:/home/tst/.local/share/containers/storage/overlay/l/CWA3ZLDUBP3CVWVNANQ7I2NUYZ:/home/tst/.local/share/containers/storage/overlay/l/P6FHVR22RGARI24JNVU7RNJ3PS:/home/tst/.local/share/containers/storage/overlay/l/GGQMG7RTTKTNDHEDG4S2VQNMUY:/home/tst/.local/share/containers/storage/overlay/l/XLMBB62DOG66SN5SQKPJH5CXX5:/home/tst/.local/share/containers/storage/overlay/l/KSMDG6UUVBN4THICOUZRJ3IVZ2:/home/tst/.local/share/containers/storage/overlay/l/3TAMAIP4ZWC7QGGLZTRL7JMDNX:/home/tst/.local/share/containers/storage/overlay/l/VOWJFH4NWGEDOH7MAGOS7YMSKJ:/home/tst/.local/share/containers/storage/overlay/l/TEOWIK6WH3UYW27623WLCJZMXB:/home/tst/.local/share/containers/storage/overlay/l/NWIXLODDY2EUOLWDSAF23QS2J6:/home/tst/.local/share/containers/storage/overlay/l/6UX4LIHS7Z5WTW6JLKAUCC4PGL:/home/tst/.local/share/containers/storage/overlay/l/N32FCKQPZ76WBBIYF4Y3UG5TVC:/home/tst/.local/share/containers/storage/overlay/l/XQBTXA4DTO63MP5CAKOIUWX6JK:/home/tst/.local/share/containers/storage/overlay/l/ULM3RZONWX7Z5TEINKKWV3MZD5:/home/tst/.local/share/containers/storage/overlay/l/W6BZA4OFDQWL24FKORN6TAHQAY:/home/tst/.local/share/containers/storage/overlay/l/SCT75IHFFLEY7T6XJSAVDZY5J7:/home/tst/.local/share/containers/storage/overlay/l/QDJTOMBN2T4Q3NK4ACBSSDXBHN:/home/tst/.local/share/containers/storage/overlay/l/62XELSXZS2ASDT3GXAKTU247NL:/home/tst/.local/share/containers/storage/overlay/l/35RPXRWRSXBZANK4QQ6KTNS6NT:/home/tst/.local/share/containers/storage/overlay/l/JGNCNKJK4GJ47IWO5OY4UL6VTU:/home/tst/.local/share/containers/storage/overlay/l/6IFLG5WBVVQERLVOW2GXEWW47N:/home/tst/.local/share/containers/storage/overlay/l/DHZXSMH55QMV2DSEXGY5LMTVLU:/home/tst/.local/share/containers/storage/overlay/l/KWGMTXCTHBZFH3IMAV4Y2IKLDK:/home/tst/.local/share/containers/storage/overlay/l/3W6RRVHVZYHFHAVRHXQCZCS3B5:/home/tst/.local/share/containers/storage/overlay/l/46EQXSIMMZE6K2U3V2NPAT7R2F:/home/tst/.local/share/containers/storage/overlay/l/A3E35CXGESKFTUVPH2MFYUJ6J2:/home/tst/.local/share/containers/storage/overlay/l/NCAIGBJHZ35YTYUEEQ4IE2C7OW:/home/tst/.local/share/containers/storage/overlay/l/522MEICOJZP5XUB3G6YG6TEF5O:/home/tst/.local/share/containers/storage/overlay/l/BSH4DGY2GHU2SXF67JZVCMAID5:/home/tst/.local/share/containers/storage/overlay/l/ZMJE73AU5FB7GBS634AQ4QTN44:/home/tst/.local/share/containers/storage/overlay/l/NMEBUD3IYBIU2LXH5WJWIDWCPS:/home/tst/.local/share/containers/storage/overlay/l/M5U2EV7UM3DYUAW54JBZTW4VMN,upperdir=/home/tst/.local/share/containers/storage/overlay/f8cfd6d74fb3fac0ab994ca75e0eb43bed27ae5950cbad36c4c34b915ae1dab4/diff,workdir=/home/tst/.local/share/containers/storage/overlay/f8cfd6d74fb3fac0ab994ca75e0eb43bed27ae5950cbad36c4c34b915ae1dab4/work,userxattr,volatile 
[...]

To see that #13375 fixed it, build that version:

(git clone https://github.com/containers/podman/ && cd podman && git checkout 7877b02aacf3e8d3d37f6283c6b8aa81688fd120 && make binaries)

Then test using the fixed version:

[tst@requiem ~]$ (PATH=`pwd`/podman/bin:$PATH; sh rename-repro.sh.txt 50)
[...]
STEP 49/49: RUN dd if=/dev/urandom of=$(mktemp) count=1
--> Using cache 95d8c74f6fc7a5b76f18c38d19b4e21bfc0d696ebdbe184cc56cb453b709c3cf
COMMIT layer
--> 95d8c74f6fc
Successfully tagged localhost/layer:latest
[...]
DEBU[0000] overlay: mount_data=lowerdir=l/6MRCIQO52TVXNM4HXTAAJR2ODI:l/IIOYYWVMYJPQJGJOICDQVFW2DC:l/WEWLGOFKIGV7GBF7U746D4DENB:l/RCPD3W3QL3A3QDJUX5ZSRYRZN6:l/KSG34SZDDECVWV5C6WWBINYWLM:l/DCBKO747JINKXJM36T2SLFK6RB:l/D2XXK3YKQ4JQSS5WD27JK36UG7:l/C353DSRGEGSYKHD6PSNQ3FLENX:l/YSVEGIGVDMDVNGBOLJTF5ET3SK:l/Y46ZPOYX3OCGOEWRUAVHE5ZX5X:l/X2M67CDXDF2LD5EHVIFOCC26X7:l/MMKDZQ4EGSHKEQEUGFGV5JDIFX:l/CCGJDIIT3BQKCCDC5CWB6QLYH3:l/3BUR3ZNLOGKNVU66VUX2E3CD57:l/57KVSXUB7UXCPCW4RKHFVBD4OQ:l/JCER4YLA4YHDGWRLKTSA422I3V:l/ZL3GS2HYKUVVB37EVPYGQSH423:l/PLVVYDKGCGXT3E4QBKJFMDTBS6:l/CWA3ZLDUBP3CVWVNANQ7I2NUYZ:l/P6FHVR22RGARI24JNVU7RNJ3PS:l/GGQMG7RTTKTNDHEDG4S2VQNMUY:l/XLMBB62DOG66SN5SQKPJH5CXX5:l/KSMDG6UUVBN4THICOUZRJ3IVZ2:l/3TAMAIP4ZWC7QGGLZTRL7JMDNX:l/VOWJFH4NWGEDOH7MAGOS7YMSKJ:l/TEOWIK6WH3UYW27623WLCJZMXB:l/NWIXLODDY2EUOLWDSAF23QS2J6:l/6UX4LIHS7Z5WTW6JLKAUCC4PGL:l/N32FCKQPZ76WBBIYF4Y3UG5TVC:l/XQBTXA4DTO63MP5CAKOIUWX6JK:l/ULM3RZONWX7Z5TEINKKWV3MZD5:l/W6BZA4OFDQWL24FKORN6TAHQAY:l/SCT75IHFFLEY7T6XJSAVDZY5J7:l/QDJTOMBN2T4Q3NK4ACBSSDXBHN:l/62XELSXZS2ASDT3GXAKTU247NL:l/35RPXRWRSXBZANK4QQ6KTNS6NT:l/JGNCNKJK4GJ47IWO5OY4UL6VTU:l/6IFLG5WBVVQERLVOW2GXEWW47N:l/DHZXSMH55QMV2DSEXGY5LMTVLU:l/KWGMTXCTHBZFH3IMAV4Y2IKLDK:l/3W6RRVHVZYHFHAVRHXQCZCS3B5:l/46EQXSIMMZE6K2U3V2NPAT7R2F:l/A3E35CXGESKFTUVPH2MFYUJ6J2:l/NCAIGBJHZ35YTYUEEQ4IE2C7OW:l/522MEICOJZP5XUB3G6YG6TEF5O:l/BSH4DGY2GHU2SXF67JZVCMAID5:l/ZMJE73AU5FB7GBS634AQ4QTN44:l/NMEBUD3IYBIU2LXH5WJWIDWCPS:l/M5U2EV7UM3DYUAW54JBZTW4VMN,upperdir=00082b6883d833c20bc737a9b186fdd0fc31feb083dc5be034e049f8cf20675c/diff,workdir=00082b6883d833c20bc737a9b186fdd0fc31feb083dc5be034e049f8cf20675c/work,,userxattr,volatile 
[...]
....

and it finishes without error.

kbaran1998 pushed a commit to gcalin/podman that referenced this issue Mar 16, 2022
overlayfs -- the kernel's version, not fuse-overlayfs -- recently learned
(as of linux 5.16.0, I believe) how to support rootless users. Previously,
rootless users had to use these storage.conf(5) settings:

* storage.driver=vfs          (aka STORAGE_DRIVER=vfs), or
* storage.driver=overlay      (aka STORAGE_DRIVER=overlay),
  storage.options.overlay.mount_program=/usr/bin/fuse-overlayfs
                              (aka STORAGE_OPTS=/usr/bin/fuse-overlayfs)

Now that a third backend is available, setting only:

* storage.driver=overlay      (aka STORAGE_DRIVER=overlay)

containers#13123 reported EXDEV errors
during the normal operation of their container. Tracing it out, the
problem turned out to be that their container was being mounted without
'userxattr'; I don't fully understand why, but mount(8) mentions this is
needed for rootless users:

> userxattr
>
>   Use the "user.overlay." xattr namespace instead of "trusted.overlay.".
>   This is useful for unprivileged mounting of overlayfs.

containers/storage#1156 found and fixed the issue
in podman, and this just pulls in that via

    go get github.com/containers/storage@ebc90ab
    go mod vendor
    make vendor

Closes containers#13123

Signed-off-by: Nick Guenther <nick.guenther@polymtl.ca>
Signed-off-by: Krzysztof Baran <krysbaran@gmail.com>
keonchennl pushed a commit to gcalin/podman that referenced this issue Mar 18, 2022
overlayfs -- the kernel's version, not fuse-overlayfs -- recently learned
(as of linux 5.16.0, I believe) how to support rootless users. Previously,
rootless users had to use these storage.conf(5) settings:

* storage.driver=vfs          (aka STORAGE_DRIVER=vfs), or
* storage.driver=overlay      (aka STORAGE_DRIVER=overlay),
  storage.options.overlay.mount_program=/usr/bin/fuse-overlayfs
                              (aka STORAGE_OPTS=/usr/bin/fuse-overlayfs)

Now that a third backend is available, setting only:

* storage.driver=overlay      (aka STORAGE_DRIVER=overlay)

containers#13123 reported EXDEV errors
during the normal operation of their container. Tracing it out, the
problem turned out to be that their container was being mounted without
'userxattr'; I don't fully understand why, but mount(8) mentions this is
needed for rootless users:

> userxattr
>
>   Use the "user.overlay." xattr namespace instead of "trusted.overlay.".
>   This is useful for unprivileged mounting of overlayfs.

containers/storage#1156 found and fixed the issue
in podman, and this just pulls in that via

    go get github.com/containers/storage@ebc90ab
    go mod vendor
    make vendor

Closes containers#13123

Signed-off-by: Nick Guenther <nick.guenther@polymtl.ca>
Signed-off-by: Krzysztof Baran <krysbaran@gmail.com>
keonchennl pushed a commit to gcalin/podman that referenced this issue Mar 18, 2022
overlayfs -- the kernel's version, not fuse-overlayfs -- recently learned
(as of linux 5.16.0, I believe) how to support rootless users. Previously,
rootless users had to use these storage.conf(5) settings:

* storage.driver=vfs          (aka STORAGE_DRIVER=vfs), or
* storage.driver=overlay      (aka STORAGE_DRIVER=overlay),
  storage.options.overlay.mount_program=/usr/bin/fuse-overlayfs
                              (aka STORAGE_OPTS=/usr/bin/fuse-overlayfs)

Now that a third backend is available, setting only:

* storage.driver=overlay      (aka STORAGE_DRIVER=overlay)

containers#13123 reported EXDEV errors
during the normal operation of their container. Tracing it out, the
problem turned out to be that their container was being mounted without
'userxattr'; I don't fully understand why, but mount(8) mentions this is
needed for rootless users:

> userxattr
>
>   Use the "user.overlay." xattr namespace instead of "trusted.overlay.".
>   This is useful for unprivileged mounting of overlayfs.

containers/storage#1156 found and fixed the issue
in podman, and this just pulls in that via

    go get github.com/containers/storage@ebc90ab
    go mod vendor
    make vendor

Closes containers#13123

Signed-off-by: Nick Guenther <nick.guenther@polymtl.ca>
keonchennl pushed a commit to gcalin/podman that referenced this issue Mar 18, 2022
Signed-off-by: Krzysztof Baran <krysbaran@gmail.com>
Signed-off-by: Calin Georgescu <caling@protonmail.com>

Improve the error message for usused configMaps

If you run `podman play kube` on a yaml file that only contains
configMaps, podman will fail with the error:

	Error: YAML document does not contain any supported kube kind

This is not strictly true; configMaps are a supported kube kind. The
problem is that configMaps aren't a standalone entity. They have to be
used in a container somewhere, otherwise they don't do anything.

This change adds a new message in the case when there only configMaps
resources. It would be helpful if podman reported which configMaps are
unused on every invocation of kube play. However, even if that feedback
were added, this new error messages still helpfully explains the reason
that podman is not creating any resources.

[NO NEW TESTS NEEDED]

Signed-off-by: Jordan Christiansen <xordspar0@gmail.com>

Bump github.com/containernetworking/plugins from 1.0.1 to 1.1.0

Bumps [github.com/containernetworking/plugins](https://github.com/containernetworking/plugins) from 1.0.1 to 1.1.0.
- [Release notes](https://github.com/containernetworking/plugins/releases)
- [Commits](containernetworking/plugins@v1.0.1...v1.1.0)

---
updated-dependencies:
- dependency-name: github.com/containernetworking/plugins
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

Show version of the deb package in info output

Previously just showing name of the package, followed by
the path repeated again (already stated on the line above)

[NO NEW TESTS NEEDED]

Signed-off-by: Anders F Björklund <anders.f.bjorklund@gmail.com>

copr packaging: use generic macros for tmpfiles and modules load dirs

[NO NEW TESTS NEEDED]

Signed-off-by: Lokesh Mandvekar <lsm5@fedoraproject.org>

Vendor in containers/common@main

Signed-off-by: Ashley Cui <acui@redhat.com>

Allow setting binarypath from Makefile

Packagers for other distributions and package managers may put their helper binaries in other location prefixes.
Add HELPER_BINARIES_DIR to the makefile so packagers can set the prefix when building Podman.
HELPER_BINARIES_DIR will be set at link-time.

Example usage: make podman-remote HELPER_BINARIES_DIR=/my/location/prefix

Signed-off-by: Ashley Cui <acui@redhat.com>

Clarify v2 API testing for podman vs docker clients

Fixes: containers#13273

Signed-off-by: Chris Evich <cevich@redhat.com>

Add podman volume mount support

Fixes: containers#12768

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>

Add the names flag for pod logs

Fixes containers#13261

Signed-off-by: Xueyuan Chen <X.Chen-47@student.tudelft.nl>

Refactor docker-py compatibility tests

* Add which python client is being used to run tests, see "python
  client" below.
* Remove redundate code from test classes
* Update/Add comments to modules and classes

======================================================= test session starts ========================================================
platform linux -- Python 3.10.0, pytest-6.2.4, py-1.10.0, pluggy-0.13.1
python client -- DockerClient
rootdir: /home/jhonce/Projects/go/src/github.com/containers/podman
plugins: requests-mock-1.8.0
collected 33 items

test/python/docker/compat/test_containers.py ...s..............  [ 54%]
test/python/docker/compat/test_images.py ............  [ 90%]
test/python/docker/compat/test_system.py ...  [100%]

Note: Follow-up PRs will verify the test results and expand the tests.

Signed-off-by: Jhon Honce <jhonce@redhat.com>

Revert "use GetRuntimeDir() from c/common"

This reverts commit fc5cf81.

[NO NEW TESTS NEEDED]

Signed-off-by: Brent Baude <bbaude@redhat.com>

Use storage that better supports rootless overlayfs

overlayfs -- the kernel's version, not fuse-overlayfs -- recently learned
(as of linux 5.16.0, I believe) how to support rootless users. Previously,
rootless users had to use these storage.conf(5) settings:

* storage.driver=vfs          (aka STORAGE_DRIVER=vfs), or
* storage.driver=overlay      (aka STORAGE_DRIVER=overlay),
  storage.options.overlay.mount_program=/usr/bin/fuse-overlayfs
                              (aka STORAGE_OPTS=/usr/bin/fuse-overlayfs)

Now that a third backend is available, setting only:

* storage.driver=overlay      (aka STORAGE_DRIVER=overlay)

containers#13123 reported EXDEV errors
during the normal operation of their container. Tracing it out, the
problem turned out to be that their container was being mounted without
'userxattr'; I don't fully understand why, but mount(8) mentions this is
needed for rootless users:

> userxattr
>
>   Use the "user.overlay." xattr namespace instead of "trusted.overlay.".
>   This is useful for unprivileged mounting of overlayfs.

containers/storage#1156 found and fixed the issue
in podman, and this just pulls in that via

    go get github.com/containers/storage@ebc90ab
    go mod vendor
    make vendor

Closes containers#13123

Signed-off-by: Nick Guenther <nick.guenther@polymtl.ca>

container: workdir resolution must consider symlink if explicitly configured

While resolving `workdir` we mostly create a `workdir` when `stat`
fails with `ENOENT` or `ErrNotExist` however following cases are not
true when user explicitly specifies a `workdir` while `running` using
`--workdir` which tells `podman` to only use workdir if its exists on
the container. Following configuration is implicity set with other
`run` mechanism like `podman play kube`

Problem with explicit `--workdir` or similar implicit config in `podman play
kube` is that currently podman ignores the fact that workdir can also be
a `symlink` and actual `link` could be valid.

Hence following commit ensures that in such scenarios when a `workdir`
is not found and we cannot create a `workdir` podman must perform a
check to ensure that if `workdir` is a `symlink` and `link` is resolved
successfully and resolved link is present on the container then we
return as it is.

Docker performs a similar behviour.

Signed-off-by: Aditya R <arajan@redhat.com>

vendor: bump c/storage to main/d06b0f

Bump c/storage to main/d06b0f so we podman could use new `race-free`
`AddNames` and `RemoveNames` api

Signed-off-by: Aditya R <arajan@redhat.com>

vendor: bump c/image to main/9a9cd9

Bump c/image to upstream main/9a9cd9 so podman could use new race-free
code.

Signed-off-by: Aditya R <arajan@redhat.com>

test: add a test to verify race free concurrent/parallel builds

Invoking parallel/concurrent builds from podman race against each other
following behviour was fixed in
containers/storage#1153 and containers/image#1480

Test verifies if following bug is fixed in new race-free API or not.
Read more about this issue, see bz 2055487 for more details.

More details here: containers/buildah#3794 and containers#13339

Co-authored-by: Ed Santiago <santiago@redhat.com>
Signed-off-by: Aditya R <arajan@redhat.com>

RELEASE_PROCESS.md: build artifacts locally

The current PR process for release bump has the HEAD commit which bumps
version/version.go to the form `release+1-dev`. This makes Cirrus
publish release artifacts with `release+1-dev` and not `release`.

For example, the msi generated at https://cirrus-ci.com/task/5403901196238848
says podman-v4.0.3-dev.msi .

Building locally by checking out the released tag would generate the
correct artifacts and would also be faster and more convenient.

[NO NEW TESTS NEEDED]

Signed-off-by: Lokesh Mandvekar <lsm5@fedoraproject.org>

libpod: pods do not use cgroups if --cgroups=disabled

do not attempt to use cgroups with pods if the cgroups are disabled.
A similar check is already in place for containers.

Closes: containers#13411

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>

Throw an error if kube yaml has duplicate ctr names

Error out if the kube yaml passed to play kube has more
than one container or init container with the same name.

Signed-off-by: Urvashi Mohnani <umohnani@redhat.com>

Move all python tests to pytest

* Add configuration to add report header for python client used in tests
* Move report headers into the individual test runners vs runner.sh

Signed-off-by: Jhon Honce <jhonce@redhat.com>

Fixes: containers#13301 ("machine rm removes the mounted socket file on macos")

[NO NEW TESTS NEEDED]
Signed-off-by: Thibault Gagnaux <tgagnaux@gmail.com>

[CI:DOCS] RELEASE_PROCESS.md: cosmetic fix

Follow up to pr#13416

Insert line breaks to get rid of the horizontal scroll bar.

Resolves: containers#13416 (comment)

Co-authored-by: Ashley Cui <acui@redhat.com>
Signed-off-by: Lokesh Mandvekar <lsm5@fedoraproject.org>

[CI:DOCS] DISTRO_PACKAGE.md: List the packaging changes for v4

[NO NEW TESTS NEEDED]

Co-authored-by: Ashley Cui <ashleycui16@gmail.com>
Co-authored-by: Valentin Rothberg <vrothberg@redhat.com>
Signed-off-by: Lokesh Mandvekar <lsm5@fedoraproject.org>

[CI:DOCS] troubleshooting.md: Improve language and fix typos

Signed-off-by: Erik Sjölund <erik.sjolund@gmail.com>

Add ExitCommandDelay configuration use in API exec handler

[NO NEW TESTS NEEDED]

Signed-off-by: Rover van der Noort <s.r.vandernoort@student.tudelft.nl>

MacOS improvements

* Enable support of virtfs in Podman and darwin.  At the time of this writing, it requires a special patch not yet included in upstream qemu.
* Prefer to use a specially built qemu to support virtfs.  The qemu is installed under libexec/podman.

[NO NEW TESTS NEEDED]
Signed-off-by: Brent Baude <bbaude@redhat.com>

Inspect network info of a joined network namespace

Closes: containers#13150
Signed-off-by: 😎 Mostafa Emami <mustafaemami@gmail.com>

Move secret-verify-leak containerfile into its own Directory

Secret-verify-leak is causing flakes, when running in parallel tests.
This is because remote secrets are copied into the context directory to
send to the API server, and secret-verify-leak is doing a COPY * and
then checking if the temporary secret file ends up in the container or
not. Since all the temporary files are prefixed with
"podman-build-secret", this test checks if podman-build-secret is in the
image. However, when run in parallel with other tests, other temporary
podman-build-secrets might be in the context dir. Moving
secret-verify-leak into its own directory makes sure that the context
dir is used only by this one test.

Also renamed Dockerfile -> Containerfile and cleaned up unused
Containerfiles.

Signed-off-by: Ashley Cui <acui@redhat.com>

Skip flaky pprof tests

pprof tests are way too flaky, and are causing problems for
community contributors who don't have privs to press Re-run.

There has been no activity or interest in fixing the bug,
and it's not something I can fix. So, just disable the test.

Signed-off-by: Ed Santiago <santiago@redhat.com>

[CI:DOCS] troubleshooting.md: mention "podman unshare chown 0:0 path"

* Mention the command "podman unshare chown 0:0 dir1/a"
  that changes file ownership to the regular user's UID and GID on
  the host.

Co-authored-by: Tom Sweeney <tsweeney@redhat.com>
Signed-off-by: Erik Sjölund <erik.sjolund@gmail.com>

machine rm -f stops and removes machine

If you want to remove a running machine, you can now pass the --force/-f
to podman machine rm and the machine will be stopped and removed without
confirmations.

Fixes: containers#13448

[NO NEW TESTS NEEDED]

Signed-off-by: Brent Baude <bbaude@redhat.com>

Improve agent install message to add restart instructions

Signed-off-by: Jason T. Greene <jason.greene@redhat.com>

Bump github.com/docker/distribution

Bumps [github.com/docker/distribution](https://github.com/docker/distribution) from 2.8.0+incompatible to 2.8.1+incompatible.
- [Release notes](https://github.com/docker/distribution/releases)
- [Commits](distribution/distribution@v2.8.0...v2.8.1)

---
updated-dependencies:
- dependency-name: github.com/docker/distribution
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

Set default rule at the head of device configuration

The default rule should be set at the head of device configuration.
Otherwise, rules for user devices are overridden by the default rule so
that any access to the user devices are denied.

Signed-off-by: Hironori Shiina <shiina.hironori@jp.fujitsu.com>

use gopkg.in/yaml.v2 instead of v3

Many dependencies already import gopkg.in/yaml.v2, podman is the only
user of the v3 version except  github.com/stretchr/testify but this is
only a testing dependency so it will not end up in the binary.

This change reduces the podman binary size from 54740 to 54260 KB on my
system.

[NO NEW TESTS NEEDED]

Signed-off-by: Paul Holzinger <pholzing@redhat.com>

Use github.com/vbauerster/mpb/v7 in pkg/machine

We already use v7 in c/image so podman should use the same version to
prevent duplication.

This saves 170 KB binary size.

[NO NEW TESTS NEEDED]

Signed-off-by: Paul Holzinger <pholzing@redhat.com>

Fix handling of tmpfs-mode for tmpfs creation in compat mode

The permissions on disk were wrong since we were not converting to
octal.

Fixes: containers#13108

[NO NEW TESTS NEEDED] Since we don't currently test using the docker
client

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>

Add --context-dir option to podman play kube

This option was requested so that users could specify alternate
locations to find context directories for each image build. It
requites the --build option to be set.

Partion Fix: containers#12485

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>

Bump github.com/vbauerster/mpb/v7 from 7.3.2 to 7.4.1

Bumps [github.com/vbauerster/mpb/v7](https://github.com/vbauerster/mpb) from 7.3.2 to 7.4.1.
- [Release notes](https://github.com/vbauerster/mpb/releases)
- [Commits](vbauerster/mpb@v7.3.2...v7.4.1)

---
updated-dependencies:
- dependency-name: github.com/vbauerster/mpb/v7
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

Bump github.com/containernetworking/plugins from 1.1.0 to 1.1.1

Bumps [github.com/containernetworking/plugins](https://github.com/containernetworking/plugins) from 1.1.0 to 1.1.1.
- [Release notes](https://github.com/containernetworking/plugins/releases)
- [Commits](containernetworking/plugins@v1.1.0...v1.1.1)

---
updated-dependencies:
- dependency-name: github.com/containernetworking/plugins
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

CI: fix golangci-lint installation

avoid this warn:
```
golangci/golangci-lint info installed ./bin/golangci-lint
golangci/golangci-lint err this script is deprecated, please do not use it anymore. check goreleaser/godownloader#207
```

Signed-off-by: Pascal Bourdier <pascal.bourdier@gmail.com>

[CI:DOCS] Remove "(1)" from web tab text

* Remove the ending text "(1)" to avoid it from being
  displayed in the web tab title for a command man page
  on the web. Often such a text indicates that a web
  page got an update. For instance GitHub issues shows
  the number of new comments that have been written
  after the user's last visit.
  Fixes containers#13438

Signed-off-by: Erik Sjölund <erik.sjolund@gmail.com>

Add podman play kube --annotation

Allow users to add annotions in the podman play kube command.
This PR Also fixes the fact that annotations in the pod spec were
not being passed down to containers.

Fixes: containers#12968

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>

Bump github.com/docker/docker

Bumps [github.com/docker/docker](https://github.com/docker/docker) from 20.10.12+incompatible to 20.10.13+incompatible.
- [Release notes](https://github.com/docker/docker/releases)
- [Changelog](https://github.com/moby/moby/blob/master/CHANGELOG.md)
- [Commits](moby/moby@v20.10.12...v20.10.13)

---
updated-dependencies:
- dependency-name: github.com/docker/docker
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

Bump github.com/spf13/cobra from 1.3.0 to 1.4.0

Bumps [github.com/spf13/cobra](https://github.com/spf13/cobra) from 1.3.0 to 1.4.0.
- [Release notes](https://github.com/spf13/cobra/releases)
- [Changelog](https://github.com/spf13/cobra/blob/master/CHANGELOG.md)
- [Commits](spf13/cobra@v1.3.0...v1.4.0)

---
updated-dependencies:
- dependency-name: github.com/spf13/cobra
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

podman.spec.rpkg: enable rhel8 builds on copr

fix conditionals and buildtags to enable rhel8 builds

[NO NEW TESTS NEEDED]

Signed-off-by: Lokesh Mandvekar <lsm5@fedoraproject.org>

Fixes TTY & resizing on Mac and Windows

Signed-off-by: Jason T. Greene <jason.greene@redhat.com>

Bump golang to 1.17 in `vendor-in-container`

Go 1.17 compiler got faster

Signed-off-by: Pascal Bourdier <pascal.bourdier@gmail.com>

Add support for --chrootdirs

Signed-off-by: LStandman <65296484+LStandman@users.noreply.github.com>

Fix typo

[NO NEW TESTS NEEDED]

Signed-off-by: Radostin Stoyanov <rstoyanov@fedoraproject.org>

slirp: fix setup on ipv6 disabled systems

When enable_ipv6=true is set for slirp4netns (default since podman v4),
we will try to set the accept sysctl. This sysctl will not exist on
systems that have ipv6 disabled. In this case we should not error and
just ignore the extra ipv6 setup.

Also the current logic to wait for the slirp4 setup was kinda broken, it
did not actually wait until the sysctl was set before starting slirp.
This should now be fixed by using two `sync.WaitGroup`s.

[NO NEW TESTS NEEDED]

Fixes containers#13388

Signed-off-by: Paul Holzinger <pholzing@redhat.com>

vendor: bump buildah, c/image and c/storage

Bumps

c/buildah to -> `v1.24.3-0.20220310160415-5ec70bf01ea5`
c/storage to -> `v1.38.3-0.20220308085612-93ce26691863`
c/image to -> `v5.20.1-0.20220310094651-0d8056ee346f`

Signed-off-by: Aditya R <arajan@redhat.com>

docs: podman-build add --no-hosts

Add newly added `--no-hosts` to build docs and document its conflicting
nature with `--add-host`

Signed-off-by: Aditya R <arajan@redhat.com>

apply-podman-deltas: skip modified test case for --add-host which adds anomaly

All podman tests in CI expects exit code 125, which might not be true since exit code from runtime
is relayed as it is without any modification both in `buildah` and `podman`. Following behviour is seen when PR containers/buildah#3809
added a test here https://github.com/containers/buildah/blob/main/tests/bud.bats#L3183 which relays exit code from runtime as it
is, in case of both `podman` and `buildah`. However apart from this test case no other test case was able to trigger this behviour hence
marking this test as an anomaly. Since its debatable if we should override this returned error number or not hence adding a note here.

Signed-off-by: Aditya R <arajan@redhat.com>

test/e2e: add aardvark specific tests

Co-authored-by: Brent Baude <bbaude@redhat.com>
Signed-off-by: Lokesh Mandvekar <lsm5@fedoraproject.org>

Bump github.com/spf13/cobra from 1.3.0 to 1.4.0

Bumps [github.com/spf13/cobra](https://github.com/spf13/cobra) from 1.3.0 to 1.4.0.
- [Release notes](https://github.com/spf13/cobra/releases)
- [Changelog](https://github.com/spf13/cobra/blob/master/CHANGELOG.md)
- [Commits](spf13/cobra@v1.3.0...v1.4.0)

---
updated-dependencies:
- dependency-name: github.com/spf13/cobra
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

Bump github.com/docker/docker

Bumps [github.com/docker/docker](https://github.com/docker/docker) from 20.10.12+incompatible to 20.10.13+incompatible.
- [Release notes](https://github.com/docker/docker/releases)
- [Changelog](https://github.com/moby/moby/blob/master/CHANGELOG.md)
- [Commits](moby/moby@v20.10.12...v20.10.13)

---
updated-dependencies:
- dependency-name: github.com/docker/docker
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

fix breaking change in pkg/bindings

pkg/bindings is considered stable. We cannot make changes that would
break any users. If someone uses this field their code would fail to
compile. Since the fix is obviously correct we will keep it but also
add the old field back in to keep compatibility with old code.

When both fields are set ImportArchive is preferred over ImportAchive.

Fixes changes from commit 2171973

[NO NEW TESTS NEEDED]

Signed-off-by: Paul Holzinger <pholzing@redhat.com>

Fix windows win-sshproxy build

Github no longer supports the unauthenticated git protocol, so switch
to using https instead.

https://github.blog/2021-09-01-improving-git-protocol-security-github/

Signed-off-by: Paul Holzinger <pholzing@redhat.com>

fix empty newline in version output

When podman is build without git commit information it will print a
empty newline instead. This is undesirable and a regression introduced
in commit 7d22cc8.

To test build podman with `go build -mod=vendor -o bin/podman ./cmd/podman`
and check the output of bin/podman version with and without this commit.

[NO NEW TESTS NEEDED]

Signed-off-by: Paul Holzinger <pholzing@redhat.com>

move k8s deps into podman

We only need a small part of the k8s dependencies but they are the
biggest dependencies in podman by far. Moving them into podman allows us
to remove the unnecessary parts.

Signed-off-by: Paul Holzinger <pholzing@redhat.com>

remove unneeded k8s code

There is a lot of unneeded code, k8s is the by far the biggest
dependency in podman. We should remove as much as possible so that we
only have the stuff left that we use.

This is just a quick skim over the code which removes a lot of the
generated code and many packages that are now unused.
I know that this will be impossible to properly review. I will try to
make smaller changes in follow up work.

Right now this reduces about 8 MB in binary size!!!

[NO NEW TESTS NEEDED] Hopefully existing tests will catch any problems.

Signed-off-by: Paul Holzinger <pholzing@redhat.com>

pkg/k8s.io/...: fix lint errors

Fix linting errors. We use different/stricter linters, instead of
skipping these packages we should fix it.

Most errors are about naming conventions, since I do not want to change
the names I added the nolint comment there. I also removed some unused
fields where the linter complained.

Signed-off-by: Paul Holzinger <pholzing@redhat.com>

pkg/k8s.io/...: remove protobuf field tags

Since we do not use protobuf we can remove these field tags. This will
save some KB in the final binary size.

This change was automated with the following commands:
find pkg/k8s.io/ -type f -name "*.go" -exec sed -i -e 's/\sprotobuf\:\".*\"//g' {} +
find pkg/k8s.io/ -type f -name "*.go" -exec sed -i -e 's/\s`protobuf\:\".*\"`//g' {} +

Signed-off-by: Paul Holzinger <pholzing@redhat.com>

pkg/k8s.io/...: remove more unneeded files

We do not use the types defined in these fields.

Signed-off-by: Paul Holzinger <pholzing@redhat.com>

pkg/k8s.io/api/core/v1: remove unneeded types

Remove types that are not applicable for podman. This are types I do not
think we need, there is definitely more that could be removed but this
should be handled by someone who knows the k8s code better than me.

Signed-off-by: Paul Holzinger <pholzing@redhat.com>

pkg/k8s.io: add small readme with copyright notice

Signed-off-by: Paul Holzinger <pholzing@redhat.com>

[CI:DOCS]: Mention netavark limitations for macvlan/ipvlan drivers

The example is also improved to add the --subnet option, this option is required with netavark, else you get:
    Error: macvlan driver needs at least one subnet specified, DHCP is not supported with netavark

Signed-off-by: Clayton Craft <clayton@craftyguy.net>

Exit with 0 when receiving SIGTERM

* systemctl stop podman.service will now return exit code 0
* Update test framework to support JSON boolean and numeric values

Signed-off-by: Jhon Honce <jhonce@redhat.com>

Add test for BZ #2052697

Signed-off-by: Jhon Honce <jhonce@redhat.com>

Separator is no longer prepended when prefix is empty on podman generate systemd

When podman generate systemd is invoked, it previously did not check if
container-prefix or pod-prefix are empty. When these are empty, the file name
starts with the separator, which is hyphen by default. This results in files
like '-containername.service'.

The code now checks if these prefixes are empty. If they are, the filename no
longer adds a separator. Instead, it uses name or ID of the container or pod.

Closes containers#13272

Signed-off-by: Nirmal Patel <npate012@gmail.com>

Set rawimage for containers created via play kube

This commit set the containers RawImageName to default image name
specified in Pod YAML, so the containers could be used via autoupdate
feature, which needs the RawImageName to be set.

Currently RawImageName is set only for the create/run/clone podman
commands.

[NO NEW TESTS NEEDED]

Signed-off-by: Ondra Machacek <omachace@redhat.com>

podman create: building local pause image: do not read ignore files

Make sure to ignore local {container,docker}ignore files when building a
local pause image.  Otherwise, we may mistakenly not be able to copy
catatonit into the build container.

Fixes: containers#13529
Signed-off-by: Valentin Rothberg <vrothberg@redhat.com>

podman machine: remove hostip from port

Inside the podman machine vm we always remove the hostip from the port
mapping because this should only be used on the actual host. Otherwise
you run into issues when we would bind 127.0.0.1 or try to bind a
host address that is not available in the VM.

This was already done for cni/netavark ports and slirp4netns but not for
the port bindings inside libpod which are only used as root.

[NO NEW TESTS NEEDED] We still do not have machine tests!

Fixes containers#13543

Signed-off-by: Paul Holzinger <pholzing@redhat.com>

go fmt: use go 1.18 conditional-build syntax

Signed-off-by: Valentin Rothberg <vrothberg@redhat.com>

Handle incompatible machines

Start in a reduced mode for recovery, warn, and provide instructions to recreate them

Signed-off-by: Jason T. Greene <jason.greene@redhat.com>

logformatter: link to bats sources on error

We already link to ginkgo sources, now add links to bats.
Ugly, because we need to hardcode containers/podman (git
repo) and test/system (test file path): those can't be
determined from the log results like they can in ginkgo.

Also, great suggestion from @Luap99: in addition to the
'Annotated results' link which we append to the basic log,
include a short summary of failures. This should help a
viewer see exactly which test(s) failed, which in turn
can be helpful for diagnosing known-flake or real-problem.

Signed-off-by: Ed Santiago <santiago@redhat.com>

build(deps): bump github.com/stretchr/testify from 1.7.0 to 1.7.1

Bumps [github.com/stretchr/testify](https://github.com/stretchr/testify) from 1.7.0 to 1.7.1.
- [Release notes](https://github.com/stretchr/testify/releases)
- [Commits](stretchr/testify@v1.7.0...v1.7.1)

---
updated-dependencies:
- dependency-name: github.com/stretchr/testify
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

Deduplicate between Volumes and Mounts in compat API

Docker Compose v2.0 passes mount specifications in two different
places: Volumes (just the destination) and Mounts (full info
provided - source, destination, etc). This was causing Podman to
refuse to create containers, as the destination was used twice.
Deduplicate between Mounts and Volumes, preferring volumes, to
resolve this.

Fixes containers#11822

Signed-off-by: Matthew Heon <mheon@redhat.com>

Add tests with Docker Compose v2

Add a pair of new Cirrus test suites using Compose v2 instead of
Compose v1 (as is currently packaged in Fedora). They work
identically, and run the same tests, as the Compose v1 tests, but
with the new v2 binary instead.

[NO NEW TESTS NEEDED] This adds an entire Cirrus suite...

Signed-off-by: Matthew Heon <mheon@redhat.com>

Set names in compose tests based on version

Compose v2 uses dashes as separators instead of hyphens. This
broke some tests that relied upon container names. Set the name
conditionally to make it safe for both.

Signed-off-by: Matthew Heon <mheon@redhat.com>
keonchennl pushed a commit to gcalin/podman that referenced this issue Mar 18, 2022
overlayfs -- the kernel's version, not fuse-overlayfs -- recently learned
(as of linux 5.16.0, I believe) how to support rootless users. Previously,
rootless users had to use these storage.conf(5) settings:

* storage.driver=vfs          (aka STORAGE_DRIVER=vfs), or
* storage.driver=overlay      (aka STORAGE_DRIVER=overlay),
  storage.options.overlay.mount_program=/usr/bin/fuse-overlayfs
                              (aka STORAGE_OPTS=/usr/bin/fuse-overlayfs)

Now that a third backend is available, setting only:

* storage.driver=overlay      (aka STORAGE_DRIVER=overlay)

containers#13123 reported EXDEV errors
during the normal operation of their container. Tracing it out, the
problem turned out to be that their container was being mounted without
'userxattr'; I don't fully understand why, but mount(8) mentions this is
needed for rootless users:

> userxattr
>
>   Use the "user.overlay." xattr namespace instead of "trusted.overlay.".
>   This is useful for unprivileged mounting of overlayfs.

containers/storage#1156 found and fixed the issue
in podman, and this just pulls in that via

    go get github.com/containers/storage@ebc90ab
    go mod vendor
    make vendor

Closes containers#13123

Signed-off-by: Nick Guenther <nick.guenther@polymtl.ca>
keonchennl pushed a commit to gcalin/podman that referenced this issue Mar 18, 2022
overlayfs -- the kernel's version, not fuse-overlayfs -- recently learned
(as of linux 5.16.0, I believe) how to support rootless users. Previously,
rootless users had to use these storage.conf(5) settings:

* storage.driver=vfs          (aka STORAGE_DRIVER=vfs), or
* storage.driver=overlay      (aka STORAGE_DRIVER=overlay),
  storage.options.overlay.mount_program=/usr/bin/fuse-overlayfs
                              (aka STORAGE_OPTS=/usr/bin/fuse-overlayfs)

Now that a third backend is available, setting only:

* storage.driver=overlay      (aka STORAGE_DRIVER=overlay)

containers#13123 reported EXDEV errors
during the normal operation of their container. Tracing it out, the
problem turned out to be that their container was being mounted without
'userxattr'; I don't fully understand why, but mount(8) mentions this is
needed for rootless users:

> userxattr
>
>   Use the "user.overlay." xattr namespace instead of "trusted.overlay.".
>   This is useful for unprivileged mounting of overlayfs.

containers/storage#1156 found and fixed the issue
in podman, and this just pulls in that via

    go get github.com/containers/storage@ebc90ab
    go mod vendor
    make vendor

Closes containers#13123

Signed-off-by: Nick Guenther <nick.guenther@polymtl.ca>
kbaran1998 pushed a commit to gcalin/podman that referenced this issue Mar 23, 2022
overlayfs -- the kernel's version, not fuse-overlayfs -- recently learned
(as of linux 5.16.0, I believe) how to support rootless users. Previously,
rootless users had to use these storage.conf(5) settings:

* storage.driver=vfs          (aka STORAGE_DRIVER=vfs), or
* storage.driver=overlay      (aka STORAGE_DRIVER=overlay),
  storage.options.overlay.mount_program=/usr/bin/fuse-overlayfs
                              (aka STORAGE_OPTS=/usr/bin/fuse-overlayfs)

Now that a third backend is available, setting only:

* storage.driver=overlay      (aka STORAGE_DRIVER=overlay)

containers#13123 reported EXDEV errors
during the normal operation of their container. Tracing it out, the
problem turned out to be that their container was being mounted without
'userxattr'; I don't fully understand why, but mount(8) mentions this is
needed for rootless users:

> userxattr
>
>   Use the "user.overlay." xattr namespace instead of "trusted.overlay.".
>   This is useful for unprivileged mounting of overlayfs.

containers/storage#1156 found and fixed the issue
in podman, and this just pulls in that via

    go get github.com/containers/storage@ebc90ab
    go mod vendor
    make vendor

Closes containers#13123

Signed-off-by: Nick Guenther <nick.guenther@polymtl.ca>
Signed-off-by: Krzysztof Baran <krysbaran@gmail.com>
kbaran1998 pushed a commit to gcalin/podman that referenced this issue Mar 24, 2022
overlayfs -- the kernel's version, not fuse-overlayfs -- recently learned
(as of linux 5.16.0, I believe) how to support rootless users. Previously,
rootless users had to use these storage.conf(5) settings:

* storage.driver=vfs          (aka STORAGE_DRIVER=vfs), or
* storage.driver=overlay      (aka STORAGE_DRIVER=overlay),
  storage.options.overlay.mount_program=/usr/bin/fuse-overlayfs
                              (aka STORAGE_OPTS=/usr/bin/fuse-overlayfs)

Now that a third backend is available, setting only:

* storage.driver=overlay      (aka STORAGE_DRIVER=overlay)

containers#13123 reported EXDEV errors
during the normal operation of their container. Tracing it out, the
problem turned out to be that their container was being mounted without
'userxattr'; I don't fully understand why, but mount(8) mentions this is
needed for rootless users:

> userxattr
>
>   Use the "user.overlay." xattr namespace instead of "trusted.overlay.".
>   This is useful for unprivileged mounting of overlayfs.

containers/storage#1156 found and fixed the issue
in podman, and this just pulls in that via

    go get github.com/containers/storage@ebc90ab
    go mod vendor
    make vendor

Closes containers#13123

Signed-off-by: Nick Guenther <nick.guenther@polymtl.ca>
Signed-off-by: Krzysztof Baran <krysbaran@gmail.com>
kbaran1998 pushed a commit to gcalin/podman that referenced this issue Mar 24, 2022
overlayfs -- the kernel's version, not fuse-overlayfs -- recently learned
(as of linux 5.16.0, I believe) how to support rootless users. Previously,
rootless users had to use these storage.conf(5) settings:

* storage.driver=vfs          (aka STORAGE_DRIVER=vfs), or
* storage.driver=overlay      (aka STORAGE_DRIVER=overlay),
  storage.options.overlay.mount_program=/usr/bin/fuse-overlayfs
                              (aka STORAGE_OPTS=/usr/bin/fuse-overlayfs)

Now that a third backend is available, setting only:

* storage.driver=overlay      (aka STORAGE_DRIVER=overlay)

containers#13123 reported EXDEV errors
during the normal operation of their container. Tracing it out, the
problem turned out to be that their container was being mounted without
'userxattr'; I don't fully understand why, but mount(8) mentions this is
needed for rootless users:

> userxattr
>
>   Use the "user.overlay." xattr namespace instead of "trusted.overlay.".
>   This is useful for unprivileged mounting of overlayfs.

containers/storage#1156 found and fixed the issue
in podman, and this just pulls in that via

    go get github.com/containers/storage@ebc90ab
    go mod vendor
    make vendor

Closes containers#13123

Signed-off-by: Nick Guenther <nick.guenther@polymtl.ca>
Signed-off-by: Krzysztof Baran <krysbaran@gmail.com>
kbaran1998 pushed a commit to gcalin/podman that referenced this issue Mar 24, 2022
overlayfs -- the kernel's version, not fuse-overlayfs -- recently learned
(as of linux 5.16.0, I believe) how to support rootless users. Previously,
rootless users had to use these storage.conf(5) settings:

* storage.driver=vfs          (aka STORAGE_DRIVER=vfs), or
* storage.driver=overlay      (aka STORAGE_DRIVER=overlay),
  storage.options.overlay.mount_program=/usr/bin/fuse-overlayfs
                              (aka STORAGE_OPTS=/usr/bin/fuse-overlayfs)

Now that a third backend is available, setting only:

* storage.driver=overlay      (aka STORAGE_DRIVER=overlay)

containers#13123 reported EXDEV errors
during the normal operation of their container. Tracing it out, the
problem turned out to be that their container was being mounted without
'userxattr'; I don't fully understand why, but mount(8) mentions this is
needed for rootless users:

> userxattr
>
>   Use the "user.overlay." xattr namespace instead of "trusted.overlay.".
>   This is useful for unprivileged mounting of overlayfs.

containers/storage#1156 found and fixed the issue
in podman, and this just pulls in that via

    go get github.com/containers/storage@ebc90ab
    go mod vendor
    make vendor

Closes containers#13123

Signed-off-by: Nick Guenther <nick.guenther@polymtl.ca>
Signed-off-by: Krzysztof Baran <krysbaran@gmail.com>
keonchennl pushed a commit to gcalin/podman that referenced this issue Mar 24, 2022
overlayfs -- the kernel's version, not fuse-overlayfs -- recently learned
(as of linux 5.16.0, I believe) how to support rootless users. Previously,
rootless users had to use these storage.conf(5) settings:

* storage.driver=vfs          (aka STORAGE_DRIVER=vfs), or
* storage.driver=overlay      (aka STORAGE_DRIVER=overlay),
  storage.options.overlay.mount_program=/usr/bin/fuse-overlayfs
                              (aka STORAGE_OPTS=/usr/bin/fuse-overlayfs)

Now that a third backend is available, setting only:

* storage.driver=overlay      (aka STORAGE_DRIVER=overlay)

containers#13123 reported EXDEV errors
during the normal operation of their container. Tracing it out, the
problem turned out to be that their container was being mounted without
'userxattr'; I don't fully understand why, but mount(8) mentions this is
needed for rootless users:

> userxattr
>
>   Use the "user.overlay." xattr namespace instead of "trusted.overlay.".
>   This is useful for unprivileged mounting of overlayfs.

containers/storage#1156 found and fixed the issue
in podman, and this just pulls in that via

    go get github.com/containers/storage@ebc90ab
    go mod vendor
    make vendor

Closes containers#13123

Signed-off-by: Nick Guenther <nick.guenther@polymtl.ca>
keonchennl pushed a commit to gcalin/podman that referenced this issue Mar 29, 2022
overlayfs -- the kernel's version, not fuse-overlayfs -- recently learned
(as of linux 5.16.0, I believe) how to support rootless users. Previously,
rootless users had to use these storage.conf(5) settings:

* storage.driver=vfs          (aka STORAGE_DRIVER=vfs), or
* storage.driver=overlay      (aka STORAGE_DRIVER=overlay),
  storage.options.overlay.mount_program=/usr/bin/fuse-overlayfs
                              (aka STORAGE_OPTS=/usr/bin/fuse-overlayfs)

Now that a third backend is available, setting only:

* storage.driver=overlay      (aka STORAGE_DRIVER=overlay)

containers#13123 reported EXDEV errors
during the normal operation of their container. Tracing it out, the
problem turned out to be that their container was being mounted without
'userxattr'; I don't fully understand why, but mount(8) mentions this is
needed for rootless users:

> userxattr
>
>   Use the "user.overlay." xattr namespace instead of "trusted.overlay.".
>   This is useful for unprivileged mounting of overlayfs.

containers/storage#1156 found and fixed the issue
in podman, and this just pulls in that via

    go get github.com/containers/storage@ebc90ab
    go mod vendor
    make vendor

Closes containers#13123

Signed-off-by: Nick Guenther <nick.guenther@polymtl.ca>
gbraad pushed a commit to gbraad-redhat/podman that referenced this issue Jul 13, 2022
overlayfs -- the kernel's version, not fuse-overlayfs -- recently learned
(as of linux 5.16.0, I believe) how to support rootless users. Previously,
rootless users had to use these storage.conf(5) settings:

* storage.driver=vfs          (aka STORAGE_DRIVER=vfs), or
* storage.driver=overlay      (aka STORAGE_DRIVER=overlay),
  storage.options.overlay.mount_program=/usr/bin/fuse-overlayfs
                              (aka STORAGE_OPTS=/usr/bin/fuse-overlayfs)

Now that a third backend is available, setting only:

* storage.driver=overlay      (aka STORAGE_DRIVER=overlay)

containers#13123 reported EXDEV errors
during the normal operation of their container. Tracing it out, the
problem turned out to be that their container was being mounted without
'userxattr'; I don't fully understand why, but mount(8) mentions this is
needed for rootless users:

> userxattr
>
>   Use the "user.overlay." xattr namespace instead of "trusted.overlay.".
>   This is useful for unprivileged mounting of overlayfs.

containers/storage#1156 found and fixed the issue
in podman, and this just pulls in that via

    go get github.com/containers/storage@ebc90ab
    go mod vendor
    make vendor

Closes containers#13123

Signed-off-by: Nick Guenther <nick.guenther@polymtl.ca>
@github-actions github-actions bot added the locked - please file new issue/PR Assist humans wanting to comment on an old issue or PR with locked comments. label Sep 20, 2023
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 20, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
kind/bug Categorizes issue or PR as related to a bug. locked - please file new issue/PR Assist humans wanting to comment on an old issue or PR with locked comments.
Projects
None yet
4 participants