Configuring and Verifying Rust‑Based conmon v3 with Podman
By the end of this guide, readers will be able to install the Rust‑implemented conmon v3 monitor, configure Podman to use it system‑wide or per‑user, verify the active monitor version, and understand the operational differences and trade‑offs compared with the previous C implementation.
Understanding conmon and Its Role in Podman
Podman delegates the low‑level container lifecycle to an OCI runtime such as crun or runc. Once the runtime has started the container process, a small helper called conmon remains attached to that process. Conmon’s responsibilities include:
- Relaying standard input, output, and error streams between the container and the invoking Podman command.
- Providing the endpoint for
podman attachoperations. - Collecting and forwarding container logs to the configured logging driver.
- Recording the container’s exit status so that Podman can report it to the user.
Historically conmon was written in C (conmon v2). The new conmon v3 replaces that codebase with Rust, aiming to eliminate memory‑safety bugs common in low‑level C programs. Additionally, the Rust version introduces a unified logging‑backend interface, simplifying future extensions and testing of log drivers.
Installing conmon v3
The Rust implementation is packaged as conmon-v3. Installation uses the system package manager; on Fedora the command is:
sudo dnf install conmon-v3
This command adds the /usr/bin/conmon-v3 binary to the system and registers the package in the RPM database. To revert the installation, the same package manager can be used to remove the package:
sudo dnf remove conmon-v3
System‑Wide Configuration
Podman reads its configuration from /etc/containers/containers.conf and any drop‑in files located in /etc/containers/containers.conf.d/. To make conmon v3 the default monitor for all users, create a drop‑in file with the following content:
# /etc/containers/containers.conf.d/99-conmon-v3.conf
[engine]
conmon_path = ["/usr/bin/conmon-v3"]
The conmon_path key expects a JSON‑style array; the array allows future extensions for multiple monitors, but a single entry is sufficient for now. After creating the file, Podman will resolve the monitor path during the next container start. Existing containers continue to use the monitor that was active when they were launched; they are not retroactively switched.
To undo the change, simply delete the drop‑in file:
sudo rm /etc/containers/containers.conf.d/99-conmon-v3.conf
Podman will fall back to the monitor defined in the main configuration file or the compiled default, which is typically the C‑based conmon binary.
Per‑User Override
Individual users may prefer a different monitor without affecting the system default. User‑specific configuration resides in $HOME/.config/containers/containers.conf (or the containers.conf.d directory). To select conmon v3 for a single user, create the following drop‑in:
# $HOME/.config/containers/containers.conf.d/99-conmon-v3.conf
[engine]
conmon_path = ["/usr/bin/conmon-v3"]
The precedence order is: user drop‑ins → user main file → system drop‑ins → system main file. Removing the user drop‑in restores the previous behavior for that account.
Verifying the Active Monitor
Podman provides the podman info command, which reports the path and version of the monitor currently in use. Run the command as a regular user to see the user‑level configuration, and with sudo to inspect the rootful configuration:
podman info --format json | jq '.store.conmon.path, .store.conmon.version'
The expected output should show /usr/bin/conmon-v3 as the path and a version string beginning with “3”. For rootful verification:
sudo podman info --format json | jq '.store.conmon.path, .store.conmon.version'
If the path points to the older binary (commonly /usr/bin/conmon) or the version does not start with “3”, the configuration has not been applied correctly. Double‑check the drop‑in file syntax and ensure the file is readable by the Podman process (typically owned by root with mode 0644).
Testing Conmon v3 Behavior
After confirming that Podman is using conmon v3, start fresh containers to exercise the new monitor. The following checklist helps identify regressions or differences relative to conmon v2:
- Hangs or missing output: Run a container that produces continuous stdout (e.g.,
podman run --rm alpine sh -c "while true; do echo tick; sleep 1; done") and attach to it. Verify that output appears promptly and thatCtrl+Cterminates cleanly. - Incorrect exit status: Execute a container that exits with a non‑zero code (e.g.,
podman run --rm alpine false) and check thatpodman ps -areports the same exit code. - CPU usage spikes: Monitor the host’s CPU while a container runs a CPU‑intensive workload (e.g.,
podman run --rm alpine stress --cpu 2 --timeout 30s). Compare the usage to a baseline run with conmon v2 to spot abnormal consumption. - Logging consistency: Enable a logging driver (e.g.,
journald) and confirm that logs appear in the expected destination without duplication or loss. - Interactive sessions: Start an interactive shell (
podman run -it --rm alpine sh) and test attach/detach cycles. Ensure that the session remains stable after multiple attach operations.
When a discrepancy is observed, capture the following data for reporting:
# Detailed Podman debug output
podman info --debug
# System journal entries for the container
journalctl -u podman -b | grep
The collected logs, along with the Fedora version, package versions, and a concise reproduction script, constitute a useful bug report for the conmon v3 issue tracker.
Trade‑offs Between conmon v2 and v3
Switching to the Rust implementation offers clear safety benefits. Rust’s ownership model eliminates many classes of memory errors (buffer overflows, use‑after‑free, null dereferences) that have historically required patches in the C codebase. This reduces the attack surface for privilege‑escalation exploits that target the monitor process.
The unified logging backend also simplifies the addition of new log drivers. Projects that need custom log handling can now implement a single interface rather than adapting multiple code paths.
However, administrators should be aware of the following considerations:
- Binary size and start‑up latency: The Rust binary includes the standard library and may be slightly larger than the C counterpart. In most workloads the difference is negligible, but environments with extremely tight storage constraints should verify the footprint.
- Maturity of the codebase: Conmon v3 is newer and may still have edge‑case bugs not yet discovered. Maintaining the ability to revert to v2 (by removing the drop‑in) ensures continuity during troubleshooting.
- Compatibility with third‑party tools: Some external tools parse the monitor path from
podman infoand may have assumptions about the binary name. Verify that any automation scripts handle the new path gracefully.
Overall, the safety improvements outweigh the modest trade‑offs for most production and development environments. Administrators are encouraged to adopt conmon v3 on a test machine or VM before rolling it out fleet‑wide, using the verification steps described earlier.
Rolling Back to the Previous Monitor
If testing reveals incompatibilities, restoring the original monitor is straightforward. Remove the configuration file that points to conmon v3, then restart any affected containers so that they are launched with the default monitor. The steps are:
# System‑wide revert
sudo rm /etc/containers/containers.conf.d/99-conmon-v3.conf
# User‑specific revert (if applicable)
rm $HOME/.config/containers/containers.conf.d/99-conmon-v3.conf
After removal, new containers will automatically use the monitor defined by the remaining configuration (typically the C‑based conmon). Existing containers continue with the monitor they were started with; stopping and restarting them applies the change.
Source: fedoramagazine.org