podman icon indicating copy to clipboard operation
podman copied to clipboard

`podman image scp` fails with `cannot chdir to /var/roothome: Permission denied`

Open eriksjolund opened this issue 2 years ago • 7 comments

Issue Description

The choice of current working directory decides whether this command succeeds or not:

podman image scp root@localhost::alpine core@localhost::
current working directory result
/root failure
/ success

Podman version used: 5.2.4

Steps to reproduce the issue

Steps to reproduce the issue

  1. sudo -i
  2. cd /root
  3. podman pull docker.io/library/alpine
  4. useradd test
  5. Run command
    podman image scp root@localhost::alpine test@localhost::
    
    The command fails and prints the following output
    Copying blob 16113d51b718 done   | 
    Copying config c157a85ed4 done   | 
    Writing manifest to image destination
    cannot chdir to /var/roothome: Permission denied
    Error: setting up the process
    Error: exit status 125
    

Describe the results you received

The command in step 5 fails.

Describe the results you expected

I expected the command in step 5 to succeed.

A sidenote: The command in step 5 succeeds if I replace step 2 with cd /

podman info output

host:
  arch: arm64
  buildahVersion: 1.37.4
  cgroupControllers:
  - cpuset
  - cpu
  - io
  - memory
  - pids
  - rdma
  - misc
  cgroupManager: systemd
  cgroupVersion: v2
  conmon:
    package: conmon-2.1.12-3.fc41.aarch64
    path: /usr/bin/conmon
    version: 'conmon version 2.1.12, commit: '
  cpuUtilization:
    idlePercent: 99.64
    systemPercent: 0.22
    userPercent: 0.14
  cpus: 2
  databaseBackend: sqlite
  distribution:
    distribution: fedora
    variant: coreos
    version: "41"
  eventLogger: journald
  freeLocks: 2043
  hostname: fcos-next5
  idMappings:
    gidmap: null
    uidmap: null
  kernel: 6.11.2-300.fc41.aarch64
  linkmode: dynamic
  logDriver: journald
  memFree: 192159744
  memTotal: 4081143808
  networkBackend: netavark
  networkBackendInfo:
    backend: netavark
    dns:
      package: aardvark-dns-1.12.2-2.fc41.aarch64
      path: /usr/libexec/podman/aardvark-dns
      version: aardvark-dns 1.12.2
    package: netavark-1.12.2-1.fc41.aarch64
    path: /usr/libexec/podman/netavark
    version: netavark 1.12.2
  ociRuntime:
    name: crun
    package: crun-1.17-1.fc41.aarch64
    path: /usr/bin/crun
    version: |-
      crun version 1.17
      commit: 000fa0d4eeed8938301f3bcf8206405315bc1017
      rundir: /run/crun
      spec: 1.0.0
      +SYSTEMD +SELINUX +APPARMOR +CAP +SECCOMP +EBPF +CRIU +LIBKRUN +WASM:wasmedge +YAJL
  os: linux
  pasta:
    executable: /usr/bin/pasta
    package: passt-0^20240906.g6b38f07-1.fc41.aarch64
    version: |
      pasta 0^20240906.g6b38f07-1.fc41.aarch64-pasta
      Copyright Red Hat
      GNU General Public License, version 2 or later
        <https://www.gnu.org/licenses/old-licenses/gpl-2.0.html>
      This is free software: you are free to change and redistribute it.
      There is NO WARRANTY, to the extent permitted by law.
  remoteSocket:
    exists: false
    path: /run/podman/podman.sock
  rootlessNetworkCmd: pasta
  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: /usr/share/containers/seccomp.json
    selinuxEnabled: true
  serviceIsRemote: false
  slirp4netns:
    executable: /usr/bin/slirp4netns
    package: slirp4netns-1.2.2-3.fc41.aarch64
    version: |-
      slirp4netns version 1.2.2
      commit: 0ee2d87523e906518d34a6b423271e4826f71faf
      libslirp: 4.8.0
      SLIRP_CONFIG_VERSION_MAX: 5
      libseccomp: 2.5.5
  swapFree: 0
  swapTotal: 0
  uptime: 9h 31m 34.00s (Approximately 0.38 days)
  variant: v8
plugins:
  authorization: null
  log:
  - k8s-file
  - none
  - passthrough
  - journald
  network:
  - bridge
  - macvlan
  - ipvlan
  volume:
  - local
registries:
  search:
  - registry.fedoraproject.org
  - registry.access.redhat.com
  - docker.io
store:
  configFile: /usr/share/containers/storage.conf
  containerStore:
    number: 2
    paused: 0
    running: 0
    stopped: 2
  graphDriverName: overlay
  graphOptions:
    overlay.imagestore: /usr/lib/containers/storage
    overlay.mountopt: nodev,metacopy=on
    overlay.use_composefs: "false"
  graphRoot: /var/lib/containers/storage
  graphRootAllocated: 26238496768
  graphRootUsed: 14285381632
  graphStatus:
    Backing Filesystem: xfs
    Native Overlay Diff: "false"
    Supports d_type: "true"
    Supports shifting: "true"
    Supports volatile: "true"
    Using metacopy: "true"
  imageCopyTmpDir: /var/tmp
  imageStore:
    number: 24
  runRoot: /run/containers/storage
  transientStore: false
  volumePath: /var/lib/containers/storage/volumes
version:
  APIVersion: 5.2.4
  Built: 1728259200
  BuiltTime: Mon Oct  7 00:00:00 2024
  GitCommit: ""
  GoVersion: go1.23.1
  Os: linux
  OsArch: linux/arm64
  Version: 5.2.4

Podman in a container

No

Privileged Or Rootless

Privileged

Upstream Latest Release

Yes

Additional environment details

Fedora CoreOS 41.20241006.1.1

# rpm-ostree status
State: idle
AutomaticUpdatesDriver: Zincati
  DriverState: active; periodically polling for updates (last checked Sat 2024-10-12 02:20:59 UTC)
Deployments:
● fedora:fedora/aarch64/coreos/next
                  Version: 41.20241006.1.1 (2024-10-08T00:00:38Z)
               BaseCommit: 0dae4f8983c2c67147e4e44dcb9e0183ee8d1a301a2047fe30be33937727c7ed
             GPGSignature: Valid signature by 466CF2D8B60BC3057AA9453ED0622462E99D6AD1
      RemovedBasePackages: containerd 1.7.22-2.fc41 moby-engine 27.3.1-1.fc41 runc 2:1.1.12-4.fc41

  fedora:fedora/aarch64/coreos/next
                  Version: 40.20240906.1.0 (2024-09-10T00:50:59Z)
               BaseCommit: 0db203f6e5bdc3ec6ce57e200c84d4506e12e641c681f2212ef77e8019f1381b
             GPGSignature: Valid signature by 115DF9AEF857853EE8445D0A0727707EA15B79CC
      RemovedBasePackages: containerd 1.6.23-5.fc40 moby-engine 24.0.5-4.fc40 runc 2:1.1.12-3.fc40

Additional information

Additional information like issue happens only occasionally or issue happens with a particular architecture or on a particular setting

eriksjolund avatar Oct 12 '24 12:10 eriksjolund

A friendly reminder that this issue had no activity for 30 days.

github-actions[bot] avatar Nov 12 '24 00:11 github-actions[bot]

I can reproduce the issue with Podman 5.5.2 (rpm: podman-5.5.2-1.fc42.x86_64)

eriksjolund avatar Jun 28 '25 11:06 eriksjolund

Ran head first into this today. Also Podman 5.5.2 on Arch.

Was trying to podman image scp my-user@localhost::my-img root@localhost:: in a sudo machinectl shell root@ shell (which puts you in /root).

It seems like, in the current implementation, it's necessary for both users to have access rights to the current working directory for things to work. Probably some sort of edge case that was overlooked. Also #24297.

cyqsimon avatar Jul 07 '25 07:07 cyqsimon

Still an issue with podman 5.6.2 on Fedora

sailingbonbini avatar Nov 13 '25 15:11 sailingbonbini

I reproduced the issue with podman 5.7.0 on Fedora CoreOS 44.20251112.91.1 (fedora-coreos-44.20251112.91.1-applehv.aarch64.raw.gz)

click me
% ssh [email protected]
Fedora CoreOS 44.20251112.91.1
Tracker: https://github.com/coreos/fedora-coreos-tracker
Discuss: https://discussion.fedoraproject.org/tag/coreos

Last login: Thu Nov 13 06:44:13 2025 from 192.168.64.1
core@localhost:~$ sudo -i
root@localhost:~# cd /root
root@localhost:~# podman pull docker.io/library/alpine
Trying to pull docker.io/library/alpine:latest...
Getting image source signatures
Copying blob 6b59a28fa201 done   | 
Copying config 171e65262c done   | 
Writing manifest to image destination
171e65262c8018f8f09a360006af2acbb2c0c494cb2be933025b466ea3d672dc
root@localhost:~# useradd test
root@localhost:~# podman image scp root@localhost::alpine test@localhost::
Copying blob 0e64f2360a44 done   | 
Copying config 171e65262c done   | 
Writing manifest to image destination
cannot chdir to /var/roothome: Permission denied
Error: setting up the process
Error: exit status 125
root@localhost:~# rpm -q podman
podman-5.7.0-1.fc44.aarch64
root@localhost:~# 

eriksjolund avatar Nov 13 '25 17:11 eriksjolund

I reproduced the issue with podman 6.0.0 on Fedora CoreOS 45.20260627.91.1 (fedora-coreos-45.20260627.91.1-qemu.x86_64.qcow2.xz)

eriksjolund avatar Jun 29 '26 07:06 eriksjolund

/assign

Garvity avatar Oct 07 '26 08:10 Garvity