podman icon indicating copy to clipboard operation
podman copied to clipboard

Podman doesn't create .bp.sock in long path when rootless

Open zv0n opened this issue 5 years ago • 4 comments

Is this a BUG REPORT or FEATURE REQUEST? (leave only one on its own line)

/kind bug

Description

When running podman in rootless mode with long XDG_RUNTIME_DIR with option -p 8080:8080, socket file .bp.sock isn't created, causing podman to fail. In my testing I've found that max path length for XDG_RUNTIME_DIR seems to be 66 characters, after libpod/tmp/rootlessport[0-9]{9} directory is created the resulting path has 99 characters, with this podman still runs fine, but once the resulting path reaches 100 characters (67 char XDG_RUNTIME_DIR) the socket isn't created.

However .bp-ready.pipe is created.

I have also tried creating a sock file using python sockets in the long path and that worked fine, so I don't think there are any problems with filesystem/OS.

Steps to reproduce the issue:

  1. Create a directory with absolute path that has at least 67 characters, e.g. /tmp/thisisasuperlongdirectorythatcausespodmantonotcreateasockandfail

  2. set XDG_RUNTIME_DIR to this newly created directory

  3. run podman in rootless mode and publish a port

Describe the results you received: Error: rootlessport dial unix $XDG_RUNTIME_DIR/libpod/tmp/rootlessport747710965/.bp.sock: connect: invalid argument

Describe the results you expected: .bp.sock should be created in the directory

Output of podman version:

podman version 3.0.1

Output of podman info --debug:

host:
  arch: amd64
  buildahVersion: 1.19.4
  cgroupManager: systemd
  cgroupVersion: v1
  conmon:
    package: 'conmon: /usr/libexec/podman/conmon'
    path: /usr/libexec/podman/conmon
    version: 'conmon version 2.0.26, commit: '
  cpus: 32
  distribution:
    distribution: debian
    version: "10"
  eventLogger: journald
  hostname: podmanmachine
  idMappings:
    gidmap: null
    uidmap: null
  kernel: 4.19.0-6-amd64
  linkmode: dynamic
  memFree: 503232901120
  memTotal: 507234414592
  ociRuntime:
    name: crun
    package: 'crun: /usr/bin/crun'
    path: /usr/bin/crun
    version: |-
      crun version 0.17.7-5502-dirty
      commit: fd582c529489c0738e7039cbc036781d1d039014
      spec: 1.0.0
      +SYSTEMD +SELINUX +APPARMOR +CAP +SECCOMP +EBPF +CRIU +YAJL
  os: linux
  remoteSocket:
    path: /run/podman/podman.sock
  security:
    apparmorEnabled: true
    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
    selinuxEnabled: false
  slirp4netns:
    executable: ""
    package: ""
    version: ""
  swapFree: 0
  swapTotal: 0
  uptime: 1h 25m 52.87s (Approximately 0.04 days)
registries:
  search:
  - docker.io
  - quay.io
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: 'fuse-overlayfs: /usr/bin/fuse-overlayfs'
      Version: |-
        fusermount3 version: 3.4.1
        fuse-overlayfs: version 1.1.0
        FUSE library version 3.4.1
        using FUSE kernel interface version 7.27
  graphRoot: /var/lib/containers/storage
  graphStatus:
    Backing Filesystem: extfs
    Native Overlay Diff: "false"
    Supports d_type: "true"
    Using metacopy: "false"
  imageStore:
    number: 0
  runRoot: /var/run/containers/storage
  volumePath: /var/lib/containers/storage/volumes
version:
  APIVersion: 3.0.0
  Built: 0
  BuiltTime: Thu Jan  1 01:00:00 1970
  GitCommit: ""
  GoVersion: go1.14
  OsArch: linux/amd64
  Version: 3.0.1

Have you tested with the latest version of Podman and have you checked the Podman Troubleshooting Guide?

Yes

zv0n avatar Feb 23 '21 12:02 zv0n

I don't think there are any problems with filesystem/OS.

The max length of socket path is 108 on Linux, so the error is expected.

https://man7.org/linux/man-pages/man7/unix.7.html

AkihiroSuda avatar Feb 23 '21 12:02 AkihiroSuda

Oh, I see, when I was testing in python I did bind("./.bp.sock") in the directory thinking that it might result in a similar error, but it worked. When I tried bind with absolute path it also failed on path too long. Thanks for pointing that out!

zv0n avatar Feb 23 '21 13:02 zv0n

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

github-actions[bot] avatar Mar 26 '21 00:03 github-actions[bot]

Closing as this is not a podman issue.

rhatdan avatar Mar 26 '21 10:03 rhatdan