Skip to content

vz: podman "Permission denied" on bind mounts #1882

Closed
@stac47

Description

@stac47

Description

Hello,
I did some tests to run podman against a VM spinned by lima with Apple hypervisor On my M1 machine MacOs Ventura 13.6.

Darwin Kernel Version 22.6.0: Fri Sep 15 13:41:28 PDT 2023; root:xnu-8796.141.3.700.8~1/RELEASE_ARM64_T6000 arm64 arm Darwin

I took the podman template model and adapted it to use vz and mounted everything with virtiofs:

vmType: "vz"

images:
- location: "https://mirror.servaxnet.com/fedora/linux/releases/38/Cloud/x86_64/images/Fedora-Cloud-Base-38-1.6.x86_64.raw.xz"
  arch: "x86_64"
  digest: "sha256:5fe502369737c77e8ed074803ea0e6b34365ed274701f47327fd1f5eb45474ce"
- location: "https://mirror.servaxnet.com/fedora/linux/releases/38/Cloud/aarch64/images/Fedora-Cloud-Base-38-1.6.aarch64.raw.xz"
  arch: "aarch64"
  digest: "sha256:58ea3280f8fcf8adea81ec2d7d26afcc75989ad4021d4e1de22a88e9714477a8"

mountType: "virtiofs"
mounts:
- location: "~"
  writable: true
- location: "/tmp/lima"
  writable: true

containerd:
  system: false
  user: false

provision:
- mode: system
  script: |
    #!/bin/bash
    set -eux -o pipefail
    command -v podman >/dev/null 2>&1 && exit 0
    dnf -y install podman
- mode: user
  script: |
    #!/bin/bash
    set -eux -o pipefail
    systemctl --user enable --now podman.socket

probes:
- script: |
    #!/bin/bash
    set -eux -o pipefail
    if ! timeout 30s bash -c "until command -v podman >/dev/null 2>&1; do sleep 3; done"; then
      echo >&2 "podman is not installed yet"
      exit 1
    fi
  hint: See "/var/log/cloud-init-output.log" in the guest

portForwards:
- guestSocket: "/run/user/{{.UID}}/podman/podman.sock"
  hostSocket: "{{.Dir}}/sock/podman.sock"

message: |
  To run `podman` on the host (assumes podman-remote is installed), run the following commands:
  ------
  podman system connection add lima-{{.Name}} "unix://{{.Dir}}/sock/podman.sock"
  podman system connection default lima-{{.Name}}
  podman{{if eq .HostOS "linux"}} --remote{{end}} run quay.io/podman/hello
  ------

Then, starting this and opening a shell inside this VM:

% limactl create --name podman ~/perso/podman-vm/podman.yaml
% limactl start podman
% limactl shell podman
[stac@lima-podman /]$ podman --version
podman version 4.7.0

I tried to mount /Users inside a container:

[stac@lima-podman /]$ podman run -it --rm -v /Users/:/toto debian bash
root@afeec1ece533:/# ls /toto
ls: cannot open directory '/toto': Permission denied
root@afeec1ece533:/# ls -l / |grep toto
drwxr-xr-x.   1 nobody nogroup  14 Oct  4 15:07 toto

When I do exact same with the official template works fine:

% limactl create --name podman-template template://podman
% limactl start podman-template
% limactl shell podman-template
[stac@lima-podman-template /]$ podman --version
podman version 4.7.0
[stac@lima-podman-template /]$ podman run -it --rm -v /Users/:/toto debian bash
root@c2b11bc38c30:/# ls -l / | grep toto
drwxr-xr-x.   1 nobody nogroup  14 Oct  4 15:19 toto
root@c2b11bc38c30:/# ls /toto
stac

I spent a couple of hours on this and was wondering whether I missed something obvious or if it was a bug.
Thanks in advance for your help and kudo for lima.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions