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 remote windows cannot mount volume: invalid container path "/data", must be an absolute path #10900

Closed
faitz opened this issue Jul 12, 2021 · 11 comments · Fixed by containers/common#731 or #11231
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

@faitz
Copy link

faitz commented Jul 12, 2021

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

/kind bug

Description

Cannot create a container with mounted volume, podman is validating destination path using absolute path, on UNIX system absolute path always starts with a slash /, but on windows, it started with a drive letter. so podman always give an error Error: invalid container path "/data", must be an absolute path

Steps to reproduce the issue:

Create and run container using podman remote windows

podman run -it --rm -v /mnt/i/source:/data fedora bash

Describe the results you received:

Got an error:

Error: invalid container path "/data", must be an absolute path

Describe the results you expected:

container should be running and /mnt/i/soruce mounted to /data

Additional information you deem important (e.g. issue happens only occasionally):

Output of podman version:

Client:
Version:      3.2.1
API Version:  3.2.1
Go Version:   go1.15.11
Git Commit:   152952fe6b18581615c3efd1fafef2d8142738e8
Built:        Fri Jun 18 22:54:25 2021
OS/Arch:      windows/amd64

Server:
Version:      3.2.1
API Version:  3.2.1
Go Version:   go1.16.4
Built:        Wed Jul  7 11:32:49 2021
OS/Arch:      linux/amd64

Output of podman info --debug:

host:
  arch: amd64
  buildahVersion: 1.21.0
  cgroupControllers:
  - cpuset
  - cpu
  - cpuacct
  - blkio
  - memory
  - devices
  - freezer
  - net_cls
  - perf_event
  - net_prio
  - hugetlb
  - pids
  - rdma
  cgroupManager: systemd
  cgroupVersion: v1
  conmon:
    package: conmon-2.0.29-1.el8.3.7.x86_64
    path: /usr/bin/conmon
    version: 'conmon version 2.0.29, commit: '
  cpus: 4
  distribution:
    distribution: '"centos"'
    version: "8"
  eventLogger: journald
  hostname: container.vbox
  idMappings:
    gidmap: null
    uidmap: null
  kernel: 4.18.0-305.7.1.el8_4.x86_64
  linkmode: dynamic
  memFree: 7469297664
  memTotal: 8145641472
  ociRuntime:
    name: crun
    package: crun-0.20.1-1.el8.3.4.x86_64
    path: /usr/bin/crun
    version: |-
      crun version 0.20.1
      commit: 0d42f1109fd73548f44b01b3e84d04a279e99d2e
      spec: 1.0.0
      +SYSTEMD +SELINUX +APPARMOR +CAP +SECCOMP +EBPF +YAJL
  os: linux
  remoteSocket:
    exists: true
    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: /usr/share/containers/seccomp.json
    selinuxEnabled: true
  serviceIsRemote: true
  slirp4netns:
    executable: ""
    package: ""
    version: ""
  swapFree: 2218782720
  swapTotal: 2218782720
  uptime: 4m 42.67s
registries:
  search:
  - registry.fedoraproject.org
  - registry.access.redhat.com
  - registry.centos.org
  - docker.io
store:
  configFile: /etc/containers/storage.conf
  containerStore:
    number: 0
    paused: 0
    running: 0
    stopped: 0
  graphDriverName: overlay
  graphOptions:
    overlay.mountopt: nodev
  graphRoot: /var/lib/containers/storage
  graphStatus:
    Backing Filesystem: xfs
    Native Overlay Diff: "true"
    Supports d_type: "true"
    Using metacopy: "false"
  imageStore:
    number: 2
  runRoot: /var/run/containers/storage
  volumePath: /var/lib/containers/storage/volumes
version:
  APIVersion: 3.2.1
  Built: 1625632369
  BuiltTime: Wed Jul  7 00:32:49 2021
  GitCommit: ""
  GoVersion: go1.16.4
  OsArch: linux/amd64
  Version: 3.2.1

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

No

Additional environment details (AWS, VirtualBox, physical, etc.):

Podman server running on VirtualBox using Centos Stream 8

@openshift-ci openshift-ci bot added the kind/bug Categorizes issue or PR as related to a bug. label Jul 12, 2021
@mheon
Copy link
Member

mheon commented Jul 12, 2021

Theory: we're probably validating client-side, using the Go filepath library, which is using Windows path standards instead of Linux, so expecting drive letters and backslash separators. Easiest solution is probably to move the validation to the server.

@github-actions
Copy link

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

@rhatdan
Copy link
Member

rhatdan commented Aug 12, 2021

@flouthoc PTAL

@flouthoc
Copy link
Collaborator

flouthoc commented Aug 16, 2021

@rhatdan
Destination path inside containers should be always validated as
*nixtype absolute path. So I think check should be fixed.

So its recommended to use path.IsAbs() instead of filtepath.IsAbs() for destination checks. Since filepath.IsAbs() will use path_windows on windows host but destination path inside the containers should always be of *nix type.

Reference:
https://cs.opensource.google/go/go/+/refs/tags/go1.16.7:src/path/path.go;l=219
https://cs.opensource.google/go/go/+/refs/tags/go1.16.7:src/path/filepath/path_windows.go
https://cs.opensource.google/go/go/+/refs/tags/go1.16.7:src/path/filepath/path_unix.go

@flouthoc
Copy link
Collaborator

but we should also move this to server side as @mheon suggested but above PR fixes the use case.

@flouthoc
Copy link
Collaborator

We can prefer as final fix #11231 i.e what @mheon suggested.

@asbachb
Copy link

asbachb commented Dec 27, 2021

Can someone double check if this is fixed in 3.4.4? I still get this error on windows (remote client) and linux (via TCP).

@flouthoc
Copy link
Collaborator

@asbachb Is your client and remote both on 3.4.4. Could you show the command and the error.

@asbachb
Copy link

asbachb commented Dec 27, 2021

@flouthoc

PS C:\dev\src\java\amadeus-bahn-jboss-migration\nps2> podman version
Client:
Version:      3.4.4
API Version:  3.4.4
Go Version:   go1.16.8
Git Commit:   f6526ada1025c2e3f88745ba83b8b461ca659933
Built:        Wed Dec  8 22:14:28 2021
OS/Arch:      windows/amd64

Server:
Version:      3.4.4
API Version:  3.4.4
Go Version:   go1.16.10
Built:        Tue Jan  1 01:00:00 1980
OS/Arch:      linux/amd64
PS C:\dev\tmp\podman-test> podman run --mount=type=bind,source=C:\dev\tmp\podman-test\hello.txt,destination=/tmp/hello.txt alpine cat
Error: invalid container path "\\tmp\\hello.txt", must be an absolute path
PS C:\dev\tmp\podman-test> podman run --mount=type=bind,source=C:\dev\tmp\podman-test\hello.txt,destination=/tmp/ alpine cat
Error: invalid container path "\\tmp", must be an absolute path
PS C:\dev\tmp\podman-test> podman run --mount=type=bind,source=C:\dev\tmp\podman-test\hello.txt,destination=/tmp alpine cat
Error: invalid container path "\\tmp", must be an absolute path
PS C:\dev\tmp\podman-test> podman run --mount=type=bind,source=C:\dev\tmp\podman-test\hello.txt,destination=/ alpine cat
Error: invalid container path "\\", must be an absolute path
PS C:\dev\tmp\podman-test> podman run --mount=type=bind,source=C:\dev\tmp\podman-test\hello.txt,destination=/ alpine cat

@flouthoc
Copy link
Collaborator

@asbachb What you are trying is bind mounting from a windows host into linux podman machine. This feature is currently not supported and more on mounting files from host to remote is being discussed here: #8016

@asbachb
Copy link

asbachb commented Dec 27, 2021

@flouthoc Ah thanks for clarification. I guess the error message was kind of confusing for me as it indicates a problem on guest side.

@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 21, 2023
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 21, 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
5 participants