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

podman build with --userns=keep-id results in faccessat keep-id: no such file or directory #25064

Open
Hi-Angel opened this issue Jan 21, 2025 · 5 comments
Labels
kind/feature Categorizes issue or PR as related to a new feature.

Comments

@Hi-Angel
Copy link

Issue Description

Attempting to use --userns=keep-id to make sure the mounted directory is accessible for non-root user results in faccessat keep-id: no such file or directory error.

Steps to reproduce the issue

Steps to reproduce the issue (in terms of terminal commands)

λ cat Dockerfile
FROM docker.io/library/fedora:41
λ podman build -f Dockerfile -v $(pwd):/mnt --userns=keep-id -t test
Error: checking user namespace: faccessat keep-id: no such file or directory

Describe the results you received

Error: checking user namespace: faccessat keep-id: no such file or directory

Describe the results you expected

Build finishes successfully.

podman info output

<details>
    <summary>Details</summary>


╰─λ podman info                                                                                                                                                                                                                                                          125 ↵
host:
  arch: amd64
  buildahVersion: 1.38.0
  cgroupControllers:
  - cpu
  - memory
  - pids
  cgroupManager: systemd
  cgroupVersion: v2
  conmon:
    package: conmon-1:2.1.12-1
    path: /usr/bin/conmon
    version: 'conmon version 2.1.12, commit: e8896631295ccb0bfdda4284f1751be19b483264'
  cpuUtilization:
    idlePercent: 95.34
    systemPercent: 1.46
    userPercent: 3.2
  cpus: 12
  databaseBackend: boltdb
  distribution:
    distribution: arch
    version: unknown
  eventLogger: journald
  freeLocks: 2046
  hostname: dell-g15
  idMappings:
    gidmap:
    - container_id: 0
      host_id: 1000
      size: 1
    - container_id: 1
      host_id: 100000
      size: 65536
    uidmap:
    - container_id: 0
      host_id: 1000
      size: 1
    - container_id: 1
      host_id: 100000
      size: 65536
  kernel: 6.12.9-arch1-1
  linkmode: dynamic
  logDriver: none
  memFree: 1198178304
  memTotal: 16402022400
  networkBackend: netavark
  networkBackendInfo:
    backend: netavark
    dns:
      package: aardvark-dns-1.13.1-1
      path: /usr/lib/podman/aardvark-dns
      version: aardvark-dns 1.13.1
    package: netavark-1.13.1-1
    path: /usr/lib/podman/netavark
    version: netavark 1.13.1
  ociRuntime:
    name: crun
    package: crun-1.19.1-2
    path: /usr/bin/crun
    version: |-
      crun version 1.19.1
      commit: 3e32a70c93f5aa5fea69b50256cca7fd4aa23c80
      rundir: /run/user/1000/crun
      spec: 1.0.0
      +SYSTEMD +SELINUX +APPARMOR +CAP +SECCOMP +EBPF +CRIU +YAJL
  os: linux
  pasta:
    executable: /usr/bin/pasta
    package: passt-2024_12_11.09478d5-1
    version: |
      pasta 2024_12_11.09478d5
      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: true
    path: /run/user/1000/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: true
    seccompEnabled: true
    seccompProfilePath: /etc/containers/seccomp.json
    selinuxEnabled: false
  serviceIsRemote: false
  slirp4netns:
    executable: /usr/bin/slirp4netns
    package: slirp4netns-1.3.1-1
    version: |-
      slirp4netns version 1.3.1
      commit: e5e368c4f5db6ae75c2fce786e31eef9da6bf236
      libslirp: 4.8.0
      SLIRP_CONFIG_VERSION_MAX: 5
      libseccomp: 2.5.5
  swapFree: 5414334464
  swapTotal: 8589930496
  uptime: 87h 51m 28.00s (Approximately 3.62 days)
  variant: ""
plugins:
  authorization: null
  log:
  - k8s-file
  - none
  - passthrough
  - journald
  network:
  - bridge
  - macvlan
  - ipvlan
  volume:
  - local
registries: {}
store:
  configFile: /home/constantine/.config/containers/storage.conf
  containerStore:
    number: 2
    paused: 0
    running: 1
    stopped: 1
  graphDriverName: overlay
  graphOptions: {}
  graphRoot: /home/constantine/.local/share/containers/storage
  graphRootAllocated: 494011416576
  graphRootUsed: 428585119744
  graphStatus:
    Backing Filesystem: btrfs
    Native Overlay Diff: "false"
    Supports d_type: "true"
    Supports shifting: "true"
    Supports volatile: "true"
    Using metacopy: "false"
  imageCopyTmpDir: /var/tmp
  imageStore:
    number: 98
  runRoot: /run/user/1000/containers
  transientStore: false
  volumePath: /home/constantine/.local/share/containers/storage/volumes
version:
  APIVersion: 5.3.1
  Built: 1732225906
  BuiltTime: Fri Nov 22 00:51:46 2024
  GitCommit: 4cbdfde5d862dcdbe450c0f1d76ad75360f67a3c
  GoVersion: go1.23.3
  Os: linux
  OsArch: linux/amd64
  Version: 5.3.1

</details>

Podman in a container

No

Privileged Or Rootless

Rootless

Upstream Latest Release

Yes

Additional environment details

No response

Additional information

No response

@Hi-Angel Hi-Angel added the kind/bug Categorizes issue or PR as related to a bug. label Jan 21, 2025
@Luap99
Copy link
Member

Luap99 commented Jan 22, 2025

buildah does not support any of the advanced podman user namespace modes, from the man page:

--userns=how
Sets the configuration for user namespaces when handling RUN instructions. The configured value can be "" (the empty string) or "container" to indicate that a new user namespace is created, it can be
"host" to indicate that the user namespace in which podman itself is being run is reused, or it can be the path to a user namespace which is already in use by another process.

So that is expected to not work so I mark this as feature

@Luap99 Luap99 added kind/feature Categorizes issue or PR as related to a new feature. and removed kind/bug Categorizes issue or PR as related to a bug. labels Jan 22, 2025
@Hi-Angel
Copy link
Author

Isn't buildah a separate project? This may be a feature for buildah, but I'm reporting it against Podman.

@rhatdan
Copy link
Member

rhatdan commented Jan 22, 2025

Podman vendors in this feature from buildah.

@rhatdan
Copy link
Member

rhatdan commented Jan 22, 2025

Not sure what you goal with this option is though. Does it matter what mapping is used during a build?

@Hi-Angel
Copy link
Author

Not sure what you goal with this option is though. Does it matter what mapping is used during a build?

Yes, it's really the same as in podman run. I have a mount-bound ( -v …) dir with Node's package.json, and I want to run npm i so that npm downloads the necessary packages, and then to mv them into the image. The problem then is that the external dir is seen as owned by root — but I need it to be seen as owned by a non-root user. This is because I am creating a CI image, and inside CI image we're building as non-root (you want CI to run as non-root because that asserts that whatever it is that you're testing is buildable/runnable by a non-root).

As result, the -v is completely useless for my usecase give that keep-id doesn't work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/feature Categorizes issue or PR as related to a new feature.
Projects
None yet
Development

No branches or pull requests

3 participants