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

APIError with Podman 3.4.4 #179

Closed
nicolargo opened this issue May 29, 2022 · 4 comments
Closed

APIError with Podman 3.4.4 #179

nicolargo opened this issue May 29, 2022 · 4 comments
Labels
stale-issue Issue that has either waited too long for reporter to respond

Comments

@nicolargo
Copy link

nicolargo commented May 29, 2022

Hi !

I just install a fresh Podman 3.4.4 on my Ubuntu 22.04 system:

host:
  arch: amd64
  buildahVersion: 1.23.1
  cgroupControllers:
  - memory
  - pids
  cgroupManager: systemd
  cgroupVersion: v2
  conmon:
    package: 'conmon: /usr/bin/conmon'
    path: /usr/bin/conmon
    version: 'conmon version 2.0.25, commit: unknown'
  cpus: 4
  distribution:
    codename: jammy
    distribution: ubuntu
    version: "22.04"
  eventLogger: journald
  hostname: XPS13-9333
  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.15.0-30-generic
  linkmode: dynamic
  logDriver: journald
  memFree: 168615936
  memTotal: 7837949952
  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
    seccompProfilePath: /usr/share/containers/seccomp.json
    selinuxEnabled: false
  serviceIsRemote: false
  slirp4netns:
    executable: /usr/bin/slirp4netns
    package: 'slirp4netns: /usr/bin/slirp4netns'
    version: |-
      slirp4netns version 1.0.1
      commit: 6a7b16babc95b6a3056b33fb45b74a6f62262dd4
      libslirp: 4.6.1
  swapFree: 7746674688
  swapTotal: 8082419712
  uptime: 67h 59m 53.68s (Approximately 2.79 days)
plugins:
  log:
  - k8s-file
  - none
  - journald
  network:
  - bridge
  - macvlan
  volume:
  - local
registries:
  search:
  - registry.access.redhat.com
  - registry.fedoraproject.org
  - docker.io
store:
  configFile: /home/nicolargo/.config/containers/storage.conf
  containerStore:
    number: 1
    paused: 0
    running: 1
    stopped: 0
  graphDriverName: overlay
  graphOptions: {}
  graphRoot: /home/nicolargo/.local/share/containers/storage
  graphStatus:
    Backing Filesystem: extfs
    Native Overlay Diff: "true"
    Supports d_type: "true"
    Using metacopy: "false"
  imageStore:
    number: 1
  runRoot: /run/user/1000/containers
  volumePath: /home/nicolargo/.local/share/containers/storage/volumes
version:
  APIVersion: 3.4.4
  Built: 0
  BuiltTime: Thu Jan  1 01:00:00 1970
  GitCommit: ""
  GoVersion: go1.17.3
  OsArch: linux/amd64
  Version: 3.4.4

When i try to connect to Podman with Podman-py 4.0.0 version :

$ python
>>> from podman import PodmanClient
>>> uri = "unix:///run/user/1000/podman/podman.sock"
>>> PodmanClient(base_url=uri).version()

I have the following error:

Traceback (most recent call last):
  File "/home/nicolargo/dev/glances/venv/lib/python3.10/site-packages/podman/api/uds.py", line 43, in connect
    super().connect(netloc)
FileNotFoundError: [Errno 2] No such file or directory

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/home/nicolargo/dev/glances/venv/lib/python3.10/site-packages/urllib3/connectionpool.py", line 703, in urlopen
    httplib_response = self._make_request(
  File "/home/nicolargo/dev/glances/venv/lib/python3.10/site-packages/urllib3/connectionpool.py", line 398, in _make_request
    conn.request(method, url, **httplib_request_kw)
  File "/usr/lib/python3.10/http/client.py", line 1282, in request
    self._send_request(method, url, body, headers, encode_chunked)
  File "/usr/lib/python3.10/http/client.py", line 1328, in _send_request
    self.endheaders(body, encode_chunked=encode_chunked)
  File "/usr/lib/python3.10/http/client.py", line 1277, in endheaders
    self._send_output(message_body, encode_chunked=encode_chunked)
  File "/usr/lib/python3.10/http/client.py", line 1037, in _send_output
    self.send(msg)
  File "/usr/lib/python3.10/http/client.py", line 975, in send
    self.connect()
  File "/home/nicolargo/dev/glances/venv/lib/python3.10/site-packages/podman/api/uds.py", line 88, in connect
    sock.connect()
  File "/home/nicolargo/dev/glances/venv/lib/python3.10/site-packages/podman/api/uds.py", line 45, in connect
    raise APIError(f"Unable to make connection to UDS '{netloc}'") from e
podman.errors.exceptions.APIError: Unable to make connection to UDS '/run/user/1000/podman/podman.sock'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/nicolargo/dev/glances/venv/lib/python3.10/site-packages/requests/adapters.py", line 440, in send
    resp = conn.urlopen(
  File "/home/nicolargo/dev/glances/venv/lib/python3.10/site-packages/urllib3/connectionpool.py", line 785, in urlopen
    retries = retries.increment(
  File "/home/nicolargo/dev/glances/venv/lib/python3.10/site-packages/urllib3/util/retry.py", line 550, in increment
    raise six.reraise(type(error), error, _stacktrace)
  File "/home/nicolargo/dev/glances/venv/lib/python3.10/site-packages/urllib3/packages/six.py", line 769, in reraise
    raise value.with_traceback(tb)
  File "/home/nicolargo/dev/glances/venv/lib/python3.10/site-packages/urllib3/connectionpool.py", line 703, in urlopen
    httplib_response = self._make_request(
  File "/home/nicolargo/dev/glances/venv/lib/python3.10/site-packages/urllib3/connectionpool.py", line 398, in _make_request
    conn.request(method, url, **httplib_request_kw)
  File "/usr/lib/python3.10/http/client.py", line 1282, in request
    self._send_request(method, url, body, headers, encode_chunked)
  File "/usr/lib/python3.10/http/client.py", line 1328, in _send_request
    self.endheaders(body, encode_chunked=encode_chunked)
  File "/usr/lib/python3.10/http/client.py", line 1277, in endheaders
    self._send_output(message_body, encode_chunked=encode_chunked)
  File "/usr/lib/python3.10/http/client.py", line 1037, in _send_output
    self.send(msg)
  File "/usr/lib/python3.10/http/client.py", line 975, in send
    self.connect()
  File "/home/nicolargo/dev/glances/venv/lib/python3.10/site-packages/podman/api/uds.py", line 88, in connect
    sock.connect()
  File "/home/nicolargo/dev/glances/venv/lib/python3.10/site-packages/podman/api/uds.py", line 45, in connect
    raise APIError(f"Unable to make connection to UDS '{netloc}'") from e
urllib3.exceptions.ProtocolError: ('Connection aborted.', APIError("Unable to make connection to UDS '/run/user/1000/podman/podman.sock'"))

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/nicolargo/dev/glances/venv/lib/python3.10/site-packages/podman/api/client.py", line 407, in _request
    self.request(
  File "/home/nicolargo/dev/glances/venv/lib/python3.10/site-packages/requests/sessions.py", line 529, in request
    resp = self.send(prep, **send_kwargs)
  File "/home/nicolargo/dev/glances/venv/lib/python3.10/site-packages/requests/sessions.py", line 645, in send
    r = adapter.send(request, **kwargs)
  File "/home/nicolargo/dev/glances/venv/lib/python3.10/site-packages/requests/adapters.py", line 501, in send
    raise ConnectionError(err, request=request)
requests.exceptions.ConnectionError: ('Connection aborted.', APIError("Unable to make connection to UDS '/run/user/1000/podman/podman.sock'"))

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/nicolargo/dev/glances/venv/lib/python3.10/site-packages/podman/client.py", line 200, in version
    return self.system.version(**kwargs)
  File "/home/nicolargo/dev/glances/venv/lib/python3.10/site-packages/podman/domain/system.py", line 70, in version
    response = self.client.get("/version")
  File "/home/nicolargo/dev/glances/venv/lib/python3.10/site-packages/podman/api/client.py", line 239, in get
    return self._request(
  File "/home/nicolargo/dev/glances/venv/lib/python3.10/site-packages/podman/api/client.py", line 418, in _request
    raise APIError(uri.geturl(), explanation=f"{method.upper()} operation failed") from e
podman.errors.exceptions.APIError: http://%2Frun%2Fuser%2F1000%2Fpodman%2Fpodman.sock/v4.0.0/libpod/version (GET operation failed)

Any idea ?

@naterichman
Copy link

Not sure if this is the same issue, but I ran into this too, and it was because I didn't have podman service running, I got the exact same error, but when I try podman system service --time=0 and retry I get what I expect. Similarly starting a service with systemctl --user start podman works.

@rhatdan
Copy link
Member

rhatdan commented Jun 6, 2022

Podman service is supposed to be socket activated, could you enable the socket and see if this works.

systemctl --user enable podman.socket

@jwhonce jwhonce added the stale-issue Issue that has either waited too long for reporter to respond label Oct 31, 2022
@jwhonce
Copy link
Member

jwhonce commented Oct 31, 2022

Please re-open if problem continues to exist.

@jwhonce jwhonce closed this as completed Oct 31, 2022
@nicolargo
Copy link
Author

Confirme corrected after a restart of the service !

Thanks @naterichman

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
stale-issue Issue that has either waited too long for reporter to respond
Projects
None yet
Development

No branches or pull requests

4 participants