Skip to content

Podman unshare Error: please use unshare with rootless #529

@Igortorrente

Description

@Igortorrente

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

/kind bug

Description

Following the instruction in the documentation I tried the new podman unshare become_method, but it didn't worked for me.

It seems to be running sudo podman unshare <cmd> under the hood instead of podman unshare <cmd> for some reason.

Steps to reproduce the issue:

  1. Create a task with podman unshare

  2. Run it

  3. Face the error message

Describe the results you received:

failed: [instance] (item=/home/vagrant/containers_cache/redis) => {"ansible_loop_var": "item", "changed": false, "item": "/home/vagrant/containers_cache/redis", "module_stderr": "", "module_stdout": "Error: please use unshare with rootless\r\n", "msg": "MODULE FAILURE\nSee stdout/stderr for the exact error", "rc": 125}
failed: [instance] (item=/home/vagrant/containers_config/redis/) => {"ansible_loop_var": "item", "changed": false, "item": "/home/vagrant/containers_config/redis/", "module_stderr": "", "module_stdout": "Error: please use unshare with rootless\r\n", "msg": "MODULE FAILURE\nSee stdout/stderr for the exact error", "rc": 125}

Describe the results you expected:

Success

Or version from ansible-galaxy if installed from galaxy: ansible-galaxy collection list | grep containers.podman

$ ansible-galaxy collection list | grep containers.podman
containers.podman             1.9.4  

Output of ansible --version:

$ ansible --version
ansible [core 2.13.5]
  config file = /home/igor/projects/cloud/Caedrium-Playbooks/ansible.cfg
  configured module search path = ['/home/igor/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /home/igor/projects/cloud/python3_venv/lib/python3.10/site-packages/ansible
  ansible collection location = /home/igor/.ansible/collections:/usr/share/ansible/collections
  executable location = /home/igor/projects/cloud/python3_venv/bin/ansible
  python version = 3.10.8 (main, Nov  4 2022, 09:21:25) [GCC 12.2.0]
  jinja version = 3.1.2
  libyaml = True

Output of podman version:

$ podman version
Version:      3.0.1
API Version:  3.0.0
Go Version:   go1.15.15
Built:        Thu Jan  1 00:00:00 1970
OS/Arch:      linux/amd64

Output of podman info --debug:

host:
  arch: amd64
  buildahVersion: 1.19.6
  cgroupManager: cgroupfs
  cgroupVersion: v2
  conmon:
    package: 'conmon: /usr/bin/conmon'
    path: /usr/bin/conmon
    version: 'conmon version 2.0.25, commit: unknown'
  cpus: 4
  distribution:
    distribution: debian
    version: "11"
  eventLogger: journald
  hostname: instance
  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: 5.10.0-18-amd64
  linkmode: dynamic
  memFree: 5475975168
  memTotal: 6229622784
  ociRuntime:
    name: crun
    package: 'crun: /usr/bin/crun'
    path: /usr/bin/crun
    version: |-
      crun version 0.17
      commit: 0e9229ae34caaebcb86f1fde18de3acaf18c6d9a
      spec: 1.0.0
      +SYSTEMD +SELINUX +APPARMOR +CAP +SECCOMP +EBPF +YAJL
  os: linux
  remoteSocket:
    path: /run/user/1000/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: true
    seccompEnabled: true
    selinuxEnabled: false
  slirp4netns:
    executable: /usr/bin/slirp4netns
    package: 'slirp4netns: /usr/bin/slirp4netns'
    version: |-
      slirp4netns version 1.0.1
      commit: 6a7b16babc95b6a3056b33fb45b74a6f62262dd4
      libslirp: 4.4.0
  swapFree: 0
  swapTotal: 0
  uptime: 1m 57.04s
registries: {}
store:
  configFile: /home/vagrant/.config/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.10.3
        fuse-overlayfs: version 1.4
        FUSE library version 3.10.3
        using FUSE kernel interface version 7.31
  graphRoot: /home/vagrant/.local/share/containers/storage
  graphStatus:
    Backing Filesystem: extfs
    Native Overlay Diff: "false"
    Supports d_type: "true"
    Using metacopy: "false"
  imageStore:
    number: 0
  runRoot: /run/user/1000/containers
  volumePath: /home/vagrant/.local/share/containers/storage/volumes
version:
  APIVersion: 3.0.0
  Built: 0
  BuiltTime: Thu Jan  1 00:00:00 1970
  GitCommit: ""
  GoVersion: go1.15.15
  OsArch: linux/amd64
  Version: 3.0.1

Package info (e.g. output of rpm -q podman or apt list podman):

$ apt list podman
Listing... Done
podman/stable,now 3.0.1+dfsg1-3+deb11u1 amd64 [installed]

Playbok you run with ansible (e.g. content of playbook.yaml):

- name: Create all redis folders.
  ansible.builtin.file:
    path: "{{ item }}"
    owner: 104
    group: 104
    state: directory
    mode: 0700
  become_method: containers.podman.podman_unshare
  become: true
  loop:
    - "{{ cache_dir }}/redis"
    - "{{ config_dir }}/redis/"

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

Debian 11 running inside of Vagrant-libvirt VM.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions