計一次podman無法啓動問題排查

錯誤信息

[root@localhost ~]# podman start node
ERRO[0000] Error adding network: failed to allocate for range 0: 10.88.0.137 has been allocated to c17c6b3c9abad320bd7009b261e77af9c2474aa16acf5131f8c47f56a81e52c1, duplicate allocation is not allowed
ERRO[0000] Error while adding pod to CNI network "podman": failed to allocate for range 0: 10.88.0.137 has been allocated to c17c6b3c9abad320bd7009b261e77af9c2474aa16acf5131f8c47f56a81e52c1, duplicate allocation is not allowed
Error: unable to start container "node": error configuring network namespace for container c17c6b3c9abad320bd7009b261e77af9c2474aa16acf5131f8c47f56a81e52c1: failed to allocate for range 0: 10.88.0.137 has been allocated to c17c6b3c9abad320bd7009b261e77af9c2474aa16acf5131f8c47f56a81e52c1, duplicate allocation is not allowed

觸發原因

  • 升級了podman
[root@localhost ~]# yum history
ID     | 命令行                   | 日期和時間       | 操作           | 更改
-------------------------------------------------------------------------------
     6 | reinstall podman         | 2020-05-10 21:22 | R              |    2
     5 | update podman            | 2020-05-08 00:54 | I, U           |    9 EE
     4 | install telnet           | 2019-12-26 14:34 | Install        |    1
     3 |                          | 2019-11-30 01:27 | Install        |    1
     2 |                          | 2019-11-30 01:26 | I, U           |    2
     1 |                          | 2019-11-30 01:04 | Install        | 1318 EE
[root@localhost ~]# yum history list podman
ID     | 命令行                   | 日期和時間       | 操作           | 更改
-------------------------------------------------------------------------------
     6 | reinstall podman         | 2020-05-10 21:22 | R              |    2
     5 | update podman            | 2020-05-08 00:54 | I, U           |    9 E<
     2 |                          | 2019-11-30 01:26 | I, U           |    2 >
     1 |                          | 2019-11-30 01:04 | Install        | 1318 EE
[root@localhost ~]# yum history info 5
事務 ID: 5
起始時間    : 2020年05月08日 星期五 00時54分47秒
起始 RPM 數據庫     : 1306:dd4746f34319aa93d15ffd57fc28167886c5e1ea
結束時間       : 2020年05月08日 星期五 00時54分54秒 (7 秒)
結束 RPM 數據庫      : 1309:c49b6de09a868c80c4e4ba4cf4a8e065c52a2702
用戶           : root <root>
返回碼    : 成功
Releasever     : 8
命令行   : update podman
已改變的包:
    安裝     conmon-2:2.0.6-1.module_el8.1.0+298+41f9343a.x86_64                              @AppStream
    安裝     podman-manpages-1.6.4-4.module_el8.1.0+298+41f9343a.noarch                       @AppStream
    安裝     libvarlink-18-3.el8.x86_64                                                       @BaseOS
    Upgrade  containernetworking-plugins-0.8.3-4.module_el8.1.0+298+41f9343a.x86_64           @AppStream
    Upgraded containernetworking-plugins-0.7.4-3.git9ebe139.module_el8.0.0+58+91b614e7.x86_64 @@System
    Upgrade  podman-1.6.4-4.module_el8.1.0+298+41f9343a.x86_64                                @AppStream
    Upgraded podman-1.0.5-1.gitf604175.module_el8.0.0+194+ac560166.x86_64                     @@System
    Upgrade  podman-docker-1.6.4-4.module_el8.1.0+298+41f9343a.noarch                         @AppStream
    Upgraded podman-docker-1.0.5-1.gitf604175.module_el8.0.0+194+ac560166.noarch              @@System
    Upgrade  runc-1.0.0-64.rc9.module_el8.1.0+298+41f9343a.x86_64                             @AppStream
    Upgraded runc-1.0.0-55.rc5.dev.git2abd837.module_el8.0.0+58+91b614e7.x86_64               @@System
    Upgrade  slirp4netns-0.4.2-3.git21fdece.module_el8.1.0+298+41f9343a.x86_64                @AppStream
    Upgraded slirp4netns-0.1-2.dev.gitc4e1bc5.module_el8.0.0+58+91b614e7.x86_64               @@System
    Upgrade  libseccomp-2.4.1-1.el8.x86_64                                                    @BaseOS
    Upgraded libseccomp-2.3.3-3.el8.x86_64                                                    @@System
Scriptlet 輸出:
   1 /var/tmp/rpm-tmp.hW2QKt:行1: /usr/bin/podman: 權限不夠
[root@localhost ~]# yum history info 2
事務 ID: 2
起始時間    : 2019年11月30日 星期六 01時26分17秒
起始 RPM 數據庫     : 1303:6605b8b7fc9e4d18455acb1314ea9477b94b0439
結束時間       : 2019年11月30日 星期六 01時26分20秒 (3 秒)
結束 RPM 數據庫      : 1304:6eb00bd598038a50d03f4350bd30521a7d697fb2
用戶           : root <root>
返回碼    : 成功
Releasever     :
命令行   :
已改變的包:
    安裝     podman-docker-1.0.5-1.gitf604175.module_el8.0.0+194+ac560166.noarch @AppStream
    Upgrade  podman-1.0.5-1.gitf604175.module_el8.0.0+194+ac560166.x86_64        @AppStream
    Upgraded podman-1.0.0-2.git921f98f.module_el8.0.0+58+91b614e7.x86_64         @@System

[root@localhost ~]# yum info podman
上次元數據過期檢查:0:17:56 前,執行於 2020年05月10日 星期日 21時21分10秒。
已安裝的軟件包
名稱         : podman
版本         : 1.6.4
發佈         : 4.module_el8.1.0+298+41f9343a
架構         : x86_64
大小         : 55 M
源           : podman-1.6.4-4.module_el8.1.0+298+41f9343a.src.rpm
倉庫         : @System
來自倉庫     : AppStream
小結         : Manage Pods, Containers and Container Images
URL          : https://podman.io/
協議         : ASL 2.0
描述         : podman (Pod Manager) is a fully featured container engine that is a simple daemonless tool.  podman provides a Docker-CLI comparable command line that eases the transition from other container engines and allows the management of pods, containers and
             : images.  Simply put: alias docker=podman.  Most podman commands can be run as a regular user, without requiring additional privileges.
             :
             : podman uses Buildah(1) internally to create container images. Both tools share image (not container) storage, hence each can use or manipulate images (but not containers) created by the other.
             :
             : Manage Pods, Containers and Container Images
             : libpod Simple management tool for pods, containers and images
  • 關閉又開啓了firewalld,並開放了tcp端口,[不應該開啓firewall,docker走的是iptable系的]
  • selinux開放了ssh端口
    semanage port -a -t ssh_port_t -p tcp

podman詳情

[root@localhost ~]# podman info --debug
debug:
  compiler: gc
  git commit: ""
  go version: go1.13.4
  podman version: 1.6.4
host:
  BuildahVersion: 1.12.0-dev
  CgroupVersion: v1
  Conmon:
    package: conmon-2.0.6-1.module_el8.1.0+298+41f9343a.x86_64
    path: /usr/bin/conmon
    version: 'conmon version 2.0.6, commit: 2721f230f94894671f141762bd0d1af2fb263239'
  Distribution:
    distribution: '"centos"'
    version: "8"
  MemFree: 5398528
  MemTotal: 500600832
  OCIRuntime:
    name: runc
    package: runc-1.0.0-64.rc9.module_el8.1.0+298+41f9343a.x86_64
    path: /usr/bin/runc
    version: 'runc version spec: 1.0.1-dev'
  SwapFree: 1979969536
  SwapTotal: 2147479552
  arch: amd64
  cpus: 1
  eventlogger: journald
  hostname: localhost.localdomain
  kernel: 4.18.0-80.el8.x86_64
  os: linux
  rootless: false
  uptime: 9m 28.96s
registries:
  blocked: null
  insecure: null
  search:
  - registry.redhat.io
  - quay.io
  - docker.io
store:
  ConfigFile: /etc/containers/storage.conf
  ContainerStore:
    number: 23
  GraphDriverName: overlay
  GraphOptions: {}
  GraphRoot: /var/lib/containers/storage
  GraphStatus:
    Backing Filesystem: xfs
    Native Overlay Diff: "true"
    Supports d_type: "true"
    Using metacopy: "false"
  ImageStore:
    number: 30
  RunRoot: /var/run/containers/storage
  VolumePath: /var/lib/containers/storage/volumes

問題排查

1) 切換老版本

[root@localhost ~]# yum downgrade podman
上次元數據過期檢查:0:20:56 前,執行於 2020年05月10日 星期日 21時21分10秒。
軟件包 podman 的最低版本已經安裝,無法再進行降級。
錯誤:沒有標記要降級的軟件包。

無法自動降級

[root@localhost ~]# yum search --showduplicates podman
上次元數據過期檢查:0:23:51 前,執行於 2020年05月10日 星期日 21時21分10秒。
============================================================================================================================ 名稱 精準匹配:podman ============================================================================================================================
podman-1.6.4-4.module_el8.1.0+298+41f9343a.x86_64 : Manage Pods, Containers and Container Images
podman-1.6.4-4.module_el8.1.0+298+41f9343a.x86_64 : Manage Pods, Containers and Container Images
========================================================================================================================== 小結 和 名稱 匹配:podman ==========================================================================================================================
python-podman-api-1.2.0-0.2.gitd0a45fe.module_el8.1.0+298+41f9343a.noarch : Podman API
podman-tests-1.6.4-4.module_el8.1.0+298+41f9343a.x86_64 : Tests for podman
podman-docker-1.6.4-4.module_el8.1.0+298+41f9343a.noarch : Emulate Docker CLI using podman
podman-docker-1.6.4-4.module_el8.1.0+298+41f9343a.noarch : Emulate Docker CLI using podman
podman-manpages-1.6.4-4.module_el8.1.0+298+41f9343a.noarch : Man pages for the podman commands
podman-manpages-1.6.4-4.module_el8.1.0+298+41f9343a.noarch : Man pages for the podman commands
cockpit-podman-11-1.module_el8.1.0+298+41f9343a.noarch : Cockpit component for Podman containers
pcp-pmda-podman-4.3.2-2.el8.x86_64 : Performance Co-Pilot (PCP) metrics for podman containers
pcp-pmda-podman-4.3.2-3.el8_1.x86_64 : Performance Co-Pilot (PCP) metrics for podman containers
podman-remote-1.6.4-4.module_el8.1.0+298+41f9343a.x86_64 : (Experimental) Remote client for managing podman containers
============================================================================================================================== 小結 匹配:podman ==============================================================================================================================
toolbox-0.0.4-1.module_el8.1.0+293+ad8ef41f.x86_64 : Script to launch privileged container with podman

使用yum回退

[root@localhost ~]# yum history podman
ID     | 命令行                   | 日期和時間       | 操作           | 更改
-------------------------------------------------------------------------------
     6 | reinstall podman         | 2020-05-10 21:22 | R              |    2
     5 | update podman            | 2020-05-08 00:54 | I, U           |    9 E<
     2 |                          | 2019-11-30 01:26 | I, U           |    2 >
     1 |                          | 2019-11-30 01:04 | Install        | 1318 EE
[root@localhost ~]# yum history undo 5
上次元數據過期檢查:0:30:11 前,執行於 2020年05月10日 星期日 21時21分10秒。
撤銷事務 5,從 2020年05月08日 星期五 00時54分47秒
    安裝     conmon-2:2.0.6-1.module_el8.1.0+298+41f9343a.x86_64                              @AppStream
    安裝     podman-manpages-1.6.4-4.module_el8.1.0+298+41f9343a.noarch                       @AppStream
    安裝     libvarlink-18-3.el8.x86_64                                                       @BaseOS
    Upgrade  containernetworking-plugins-0.8.3-4.module_el8.1.0+298+41f9343a.x86_64           @AppStream
    Upgraded containernetworking-plugins-0.7.4-3.git9ebe139.module_el8.0.0+58+91b614e7.x86_64 @@System
    Upgrade  podman-1.6.4-4.module_el8.1.0+298+41f9343a.x86_64                                @AppStream
    Upgraded podman-1.0.5-1.gitf604175.module_el8.0.0+194+ac560166.x86_64                     @@System
    Upgrade  podman-docker-1.6.4-4.module_el8.1.0+298+41f9343a.noarch                         @AppStream
    Upgraded podman-docker-1.0.5-1.gitf604175.module_el8.0.0+194+ac560166.noarch              @@System
    Upgrade  runc-1.0.0-64.rc9.module_el8.1.0+298+41f9343a.x86_64                             @AppStream
    Upgraded runc-1.0.0-55.rc5.dev.git2abd837.module_el8.0.0+58+91b614e7.x86_64               @@System
    Upgrade  slirp4netns-0.4.2-3.git21fdece.module_el8.1.0+298+41f9343a.x86_64                @AppStream
    Upgraded slirp4netns-0.1-2.dev.gitc4e1bc5.module_el8.0.0+58+91b614e7.x86_64               @@System
    Upgrade  libseccomp-2.4.1-1.el8.x86_64                                                    @BaseOS
    Upgraded libseccomp-2.3.3-3.el8.x86_64                                                    @@System
無可用軟件包 containernetworking-plugins-0.7.4-3.git9ebe139.module_el8.0.0+58+91b614e7.x86_64。
無可用軟件包 libseccomp-2.3.3-3.el8.x86_64。
無可用軟件包 podman-1.0.5-1.gitf604175.module_el8.0.0+194+ac560166.x86_64。
無可用軟件包 podman-docker-1.0.5-1.gitf604175.module_el8.0.0+194+ac560166.noarch。
無可用軟件包 runc-1.0.0-55.rc5.dev.git2abd837.module_el8.0.0+58+91b614e7.x86_64。
無可用軟件包 slirp4netns-0.1-2.dev.gitc4e1bc5.module_el8.0.0+58+91b614e7.x86_64。
錯誤:沒有能夠與之匹配的軟件包

失敗,官方源已經刪除了老版本rpm包,需要自己去找rpm,沒必要,去官網看看這個報錯原因,無果
這個報錯的本身意思是容器id的ip已經分配給自己,而不能再重新分配給自己。。應該是強制關機導致文件lock殘留的問題,但這應該也是一個bug,podman應該有自己修復的功能

查找殘留文件刪除,嘗試刪除run目錄的container失敗

[root@localhost storage]# find / -name c17c6b3c9abad320bd7009b261e77af9c2474aa16acf5131f8c47f56a81e52c1
/run/containers/storage/overlay-containers/c17c6b3c9abad320bd7009b261e77af9c2474aa16acf5131f8c47f56a81e52c1
/var/lib/containers/storage/overlay-containers/c17c6b3c9abad320bd7009b261e77af9c2474aa16acf5131f8c47f56a81e52c1
[root@localhost storage]# cd /run/containers/storage/overlay-containers/c17c6b3c9abad320bd7009b261e77af9c2474aa16acf5131f8c47f56a81e52c1
[root@localhost c17c6b3c9abad320bd7009b261e77af9c2474aa16acf5131f8c47f56a81e52c1]# tree
.
└── userdata

1 directory, 0 files
[root@localhost c17c6b3c9abad320bd7009b261e77af9c2474aa16acf5131f8c47f56a81e52c1]# cd ..
[root@localhost overlay-containers]# rm -rf c17c6b3c9abad320bd7009b261e77af9c2474aa16acf5131f8c47f56a81e52c1/

去查看該容器配置

[root@localhost c17c6b3c9abad320bd7009b261e77af9c2474aa16acf5131f8c47f56a81e52c1]#cd /var/lib/containers/storage/overlay-containers/c17c6b3c9abad320bd7009b261e77af9c2474aa16acf5131f8c47f56a81e52c1
[root@localhost c17c6b3c9abad320bd7009b261e77af9c2474aa16acf5131f8c47f56a81e52c1]# cat userdata/config.json |json_reformat |grep -C 5  network
        "namespaces": [
            {
                "type": "pid"
            },
            {
                "type": "network",
                "path": "/var/run/netns/cni-c27fac7a-fe5a-36bb-3312-3dfdd8747633"
            },
            {
                "type": "ipc"
            },
#找到網絡配置地方/var/run/netns/cni-c27fac7a-fe5a-36bb-3312-3dfdd8747633發現不存在目錄,失敗,去看源碼

最終操作

治標

[root@localhost ~]# podman start node
ERRO[0000] Error adding network: failed to allocate for range 0: 10.88.0.137 has been allocated to c17c6b3c9abad320bd7009b261e77af9c2474aa16acf5131f8c47f56a81e52c1, duplicate allocation is not allowed
ERRO[0000] Error while adding pod to CNI network "podman": failed to allocate for range 0: 10.88.0.137 has been allocated to c17c6b3c9abad320bd7009b261e77af9c2474aa16acf5131f8c47f56a81e52c1, duplicate allocation is not allowed
Error: unable to start container "node": error configuring network namespace for container c17c6b3c9abad320bd7009b261e77af9c2474aa16acf5131f8c47f56a81e52c1: failed to allocate for range 0: 10.88.0.137 has been allocated to c17c6b3c9abad320bd7009b261e77af9c2474aa16acf5131f8c47f56a81e52c1, duplicate allocation is not allowed
#根據錯誤信息的ip
[root@localhost containers]# cat /var/lib/cni/networks/podman/10.88.0.137
c17c6b3c9abad320bd7009b261e77af9c2474aa16acf5131f8c47f56a81e52c1
#重置該虛擬ip
[root@localhost containers]# echo > /var/lib/cni/networks/podman/10.88.0.137
[root@localhost containers]# podman restart c17c6b3c9abad320bd7009b261e77af9c2474aa16acf5131f8c47f56a81e52c1
Error: cannot chown run directory /var/run/containers/storage/overlay-containers/c17c6b3c9abad320bd7009b261e77af9c2474aa16acf5131f8c47f56a81e52c1/userdata: chown /var/run/containers/storage/overlay-containers/c17c6b3c9abad320bd7009b261e77af9c2474aa16acf5131f8c47f56a81e52c1/userdata: no such file or directory
#重建該目錄
[root@localhost containers]# mkdir  -p /var/run/containers/storage/overlay-containers/c17c6b3c9abad320bd7009b261e77af9c2474aa16acf5131f8c47f56a81e52c1/userdata
[root@localhost containers]# podman restart c17c6b3c9abad320bd7009b261e77af9c2474aa16acf5131f8c47f56a81e52c1
c17c6b3c9abad320bd7009b261e77af9c2474aa16acf5131f8c47f56a81e52c1
#啓動成功
#該方法治標不治本,具體解決方案還要再找找

治本

相關文檔

說明 url 其他
podman命令行源碼 https://github.com/containers/libpod 源碼
容器網絡實現源碼 https://github.com/containernetworking/cni 源碼
同類型問題 https://github.com/containers/dnsname/issues/19 檢索語句org:containers "duplicate allocation"該問題還在開啓,應該是新的bug,所以沒有重複提交
路途開始的地方 長鏈接 這個報錯的位置

最終判斷firewall和iptable並存導致該問題
systemctl disable firewalld關閉firewall防火牆,問題解決
以爲docker->podman,centos7->centos8能支持一下firewall,但容器果然還是iptable系的軟件

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章