API service returns 500 "unable to open a handle to the library" on the first journald log read after a container teardown in the same process
Issue Description
submitter's note: I hit this working on a personal project outside of CI, and have included my local repro steps. I haven't isolated the root cause yet. I saw @vtushar06's earlier investigation in #29528 and their work in coreos/go-systemd#527, hopefully this adds useful information to the thread in #29528. I'm time constrained, so the report is generated but it reflects an interactive debugging Claude Code TUI session. I'm a real podman user and will read and respond personally.
Running podman system service sometimes responds to a container logs request with an HTTP 500: {"cause":"unable to open a handle to the library","message":"unable to open a handle to the library"}. It is the same failure as the apiv2 suite failures in #29528. There, a run with coreos/go-systemd#527 substituted in showed the underlying error is ENOENT for every libsystemd name, on a thread whose mount namespace, root, library file, and ld cache were all checked and fine, and a retry on the same thread failed the same way. The merged workaround restarts the service before the affected tests.
I hit it rootful, on a podman machine, through k3d, and it correlates with something the same process did earlier: every failing service process had force-removed running journald-logged containers before the logs request. A fresh process for the bring-up never failed. Four failures and two passes over three days, same machine, same versions.
Steps to reproduce the issue
- On a podman machine (rootful), with k3d 5.8.3, create a k3d cluster with journald logging:
k3d cluster create t --servers 1 --agents 1(the nodes' log driver is journald, the machine default). This is the "teardown target." k3d cluster delete t, then immediately, within the API service's 5 second idle timeout so the samepodman system serviceprocess stays alive,k3d cluster create t --servers 1 --agents 1again.- Observe k3d's wait for "k3s is up and running" on server-0, which is a
GET /v1.41/containers/<id>/logs?follow=1...request.
The whole cycle takes under a minute and failed three of three times for me today with steps 2 and 3 back to back. With an 8 second pause between delete and create, so the service exits on idle and a fresh process serves the create, it passed two of two.
Describe the results you received
k3d reports docker failed to get logs from node 'k3d-t-server-0' ... Error response from daemon: failed to obtain logs for Container '<id>': unable to open a handle to the library, and rolls the cluster back. The service's journal shows the request answered 500 and nothing at error level. The same process had, seconds earlier, handled DELETE /containers/...?force=1 for the previous cluster's nodes (two of them needing SIGKILL after the 10 second stop timeout), then image builds, then the new cluster's create and start calls. Any later logs request in that process fails the same way until it exits.
Describe the results you expected
The logs request to succeed, as it does from a fresh service process on the same machine seconds later.
podman info output
Client 5.8.5 on darwin/amd64, server 5.6.2 (podman-5.6.2-1.20250930151302203561.pr27198.8.9dd5e1ed33.fc42) on Fedora CoreOS 42.20250901.3.0, kernel 6.15.10-200.fc42.x86_64, systemd 257.7, crun 1.23.1, netavark 1.16.1.
Full podman info on request.
Podman in a container
No
Privileged Or Rootless
Privileged (rootful machine connection)
Upstream Latest Release
No, the machine image's 5.6.2
Additional environment details
podman machine on macOS (applehv), 4 CPUs, 8 GiB. The API service is socket activated with the shipped unit (podman.service, Type=exec, exits after 5 s idle).
Additional information
Intermittent. Related: coreos/go-systemd#527 (reports the dlerror text; would make this message say ENOENT) and #528 (same fix), k3d-io/k3d#1706 (retries the log open; given that a retry against the same service process fails identically per #29528, that retry is not expected to help this case).
Source: podman-container-tools/podman