containers / podman

Podman: A tool for managing OCI containers and pods.
https://podman.io
Apache License 2.0
23.79k stars 2.42k forks source link

Can't remove container created by podman-compose after upgrade from podman v1 to podman v2 #8168

Closed cbz closed 4 years ago

cbz commented 4 years ago

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

/kind bug

Description

Steps to reproduce the issue:

  1. Upgraded from podman v1 to podman v2 on Ubuntu 18.04.5 LTS. In doing this it appears crun was installed - simply running a single container with either crun or runc works.

  2. After upgrade, the first execution of podman results in a list of locking errors being printed of the form: ERRO[0000] Error refreshing pod d6189b59e8cae5ba449a9631534b949835a0c0b926cb095937a15f83cd3672bf: error retrieving lock 0 for pod d6189b59e8cae5ba449a9631534b949835a0c0b926cb095937a15f83cd3672bf: file exists

Initially there were a lot more relating to local volumes, but after a 'podman volume prune' there is a single line printed as above.

  1. If I run podman-compose down, it appears to freeze at the point it tries to remove the container: podman stop -t=1 unifi_unifi_1 Error: no container with name or ID unifi_unifi_1 found: no such container 125 podman rm unifi_unifi_1 Error: no container with name or ID unifi_unifi_1 found: no such container 1 podman pod rm unifi

    If I run the container via podman compose it errors with the following: 'podman pod create --name=unifi --share net -p 3478:3478/udp -p 8443:8443 -p 8080:8080 -p 10001:10001/udp Error: error adding pod to state: name "unifi" is in use: pod already exists 125 podman create --name=unifi_unifi_1 --pod=unifi -l io.podman.compose.config-hash=123 -l io.podman.compose.project=unifi -l io.podman.compose.version=0.0.1 -l com.docker.compose.container-number=1 -l com.docker.compose.service=unifi -e RUNAS_UID0=false -e UNIFI_UID=996 -e UNIFI_GID=996 --mount type=bind,source=/var/lib/unifi,destination=/unifi/data --mount type=bind,source=/var/log/unifi,destination=/unifi/log --add-host unifi:127.0.0.1 --add-host unifi_unifi_1:127.0.0.1 jacobalberty/unifi Error: pod d6189b59e8cae5ba449a9631534b949835a0c0b926cb095937a15f83cd3672bf cgroup is not set: internal libpod error 125 podman start -a unifi_unifi_1 Error: no container with name or ID unifi_unifi_1 found: no such container 125'

podman ps -a shows the following containers: CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES 47e2e9c93823 k8s.gcr.io/pause:3.2 2 days ago Created 0.0.0.0:3478->3478/udp, 0.0.0.0:8080->8080/tcp d6189b59e8ca-infra

Trying to remove the container results in:

Error: container 47e2e9c93823faa2765ada0d19e525c0bfc591672b2d4dd0868ac610fa066fe5 and pod d6189b59e8cae5ba449a9631534b949835a0c0b926cb095937a15f83cd3672bf share lock ID 0: deadlock due to lock mismatch

Output of podman version:

Version:      2.1.1
API Version:  2.0.0
Go Version:   go1.15.2
Built:        Thu Jan  1 01:00:00 1970
OS/Arch:      linux/amd64

Output of podman info --debug:

host:
  arch: amd64
  buildahVersion: 1.16.1
  cgroupManager: cgroupfs
  cgroupVersion: v1
  conmon:
    package: 'conmon: /usr/libexec/podman/conmon'
    path: /usr/libexec/podman/conmon
    version: 'conmon version 2.0.20, commit: '
  cpus: 2
  distribution:
    distribution: ubuntu
    version: "18.04"
  eventLogger: journald
  hostname: dolphin
  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: 4.15.0-1077-kvm
  linkmode: dynamic
  memFree: 2984476672
  memTotal: 4145926144
  ociRuntime:
    name: runc
    package: 'cri-o-runc: /usr/lib/cri-o-runc/sbin/runc'
    path: /usr/lib/cri-o-runc/sbin/runc
    version: 'runc version spec: 1.0.1-dev'
  os: linux
  remoteSocket:
    path: /run/user/1000/podman/podman.sock
  rootless: true
  slirp4netns:
    executable: /usr/bin/slirp4netns
    package: 'slirp4netns: /usr/bin/slirp4netns'
    version: |-
      slirp4netns version 1.1.4
      commit: unknown
      libslirp: 4.3.1-git
      SLIRP_CONFIG_VERSION_MAX: 3
  swapFree: 10000265216
  swapTotal: 10000265216
  uptime: 11m 5.04s
registries:
  search:
  - docker.io
  - quay.io
store:
  configFile: /home/cbz/.config/containers/storage.conf
  containerStore:
    number: 1
    paused: 0
    running: 0
    stopped: 1
  graphDriverName: vfs
  graphOptions: {}
  graphRoot: /home/cbz/.local/share/containers/storage
  graphStatus: {}
  imageStore:
    number: 12
  runRoot: /run/user/1000
  volumePath: /home/cbz/.local/share/containers/storage/volumes
version:
  APIVersion: 2.0.0
  Built: 0
  BuiltTime: Thu Jan  1 01:00:00 1970
  GitCommit: ""
  GoVersion: go1.15.2
  OsArch: linux/amd64
  Version: 2.1.1

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

Listing... Done
podman/unknown,now 2.1.1~2 amd64 [installed]

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

Yes

Additional environment details (AWS, VirtualBox, physical, etc.): Kernel version 4.15.0-1077-kvm #79-Ubuntu SMP Wed Sep 30 14:25:17 UTC 2020

mheon commented 4 years ago

Please run podman system renumber and try removing the containers via Podman (not podman-compose) again.

cbz commented 4 years ago

Just tried that:

dolphin unifi  ✗ podman system renumber
dolphin unifi  √ podman container ls
CONTAINER ID  IMAGE   COMMAND  CREATED  STATUS  PORTS   NAMES
dolphin unifi  √ podman container ls -a
CONTAINER ID  IMAGE                 COMMAND  CREATED     STATUS   PORTS                                           NAMES
47e2e9c93823  k8s.gcr.io/pause:3.2           2 days ago  Created  0.0.0.0:3478->3478/udp, 0.0.0.0:8080->8080/tcp  d6189b59e8ca-infra
dolphin unifi  √ podman rm -f 47e
Error: container 47e2e9c93823faa2765ada0d19e525c0bfc591672b2d4dd0868ac610fa066fe5 is the infra container of pod d6189b59e8cae5ba449a9631534b949835a0c0b926cb095937a15f83cd3672bf and cannot be removed without removing the pod
dolphin unifi  ✗ podman container rm -f 47e
Error: container 47e2e9c93823faa2765ada0d19e525c0bfc591672b2d4dd0868ac610fa066fe5 is the infra container of pod d6189b59e8cae5ba449a9631534b949835a0c0b926cb095937a15f83cd3672bf and cannot be removed without removing the pod
mheon commented 4 years ago

You'll need to remove the pods in that case - being unable to remove an infra container is expected.

cbz commented 4 years ago

Removing the pods fixed the issue, I'll close it.