Summary
The ansible-devspaces container image has two runtime issues when deployed on OpenShift Dev Spaces:
- Duplicate
/etc/passwd entries for user due to OpenShift UID injection conflicting with the image's existing entry
/var subdirectories are not writable, preventing runtime package installation and some tool operations
Issue 1: Duplicate /etc/passwd entries
Background
PR #735 fixed the original UID mismatch by removing the injected user at UID 10001 and recreating it at UID 1000. This fix is confirmed in ghcr.io/ansible/ansible-devspaces:v26.4.5.
Remaining problem
At runtime on OpenShift, the CRI-O runtime injects a second passwd entry when the SCC assigns a UID from the namespace range:
user:x:1000:1000::/home/user:/bin/bash
user:x:1000860000:0:user user:/home/user:/bin/bash
This creates ambiguity:
getent passwd user returns UID 1000, but the process runs as UID 1000860000
id shows uid=1000860000(user) but passwd lookups by name resolve to UID 1000
- Potential issues with file ownership checks, terminal environment setup, and shell spawning
Possible fixes
- Don't create
user in the image — let OpenShift's runtime injection be the sole entry (may break non-OpenShift use)
- Use a different username in the image (e.g.,
developer) to avoid collision with runtime injection
- Accept the duplicate and ensure tooling handles it gracefully
Issue 2: /var subdirectories not writable
/var/lib, /var/cache, and other subdirectories under /var are not writable by the runtime user. This prevents:
dnf install for new packages at runtime (e.g., pinentry-curses needed for GPG signing with ansible-sign)
- Package manager cache operations
While /usr/bin being read-only is expected for container immutability, /var is traditionally writable for package manager state and caches.
Current workaround
For Python packages, pip install into the .venv works (e.g., pip install cowsay). For system packages that have no pip equivalent, users must bake them into the image.
Suggested fix
Ensure /var/lib/dnf, /var/cache/dnf, and /var/log/dnf are writable by the runtime user, or provide a mechanism to install additional system packages at workspace startup (e.g., via devfile postStart commands with appropriate permissions).
Environment
- OpenShift 4.21.9
- Red Hat OpenShift Dev Spaces 3.27
- che-code 1.104.3
- Image:
ghcr.io/ansible/ansible-devspaces:v26.4.5
- Base: RHEL 9 UBI
- ansible-dev-tools 26.4.5, ansible-core 2.20.5
Related upstream issues and PRs
Downstream tracking
Summary
The
ansible-devspacescontainer image has two runtime issues when deployed on OpenShift Dev Spaces:/etc/passwdentries foruserdue to OpenShift UID injection conflicting with the image's existing entry/varsubdirectories are not writable, preventing runtime package installation and some tool operationsIssue 1: Duplicate
/etc/passwdentriesBackground
PR #735 fixed the original UID mismatch by removing the injected
userat UID 10001 and recreating it at UID 1000. This fix is confirmed inghcr.io/ansible/ansible-devspaces:v26.4.5.Remaining problem
At runtime on OpenShift, the CRI-O runtime injects a second passwd entry when the SCC assigns a UID from the namespace range:
This creates ambiguity:
getent passwd userreturns UID 1000, but the process runs as UID 1000860000idshowsuid=1000860000(user)but passwd lookups by name resolve to UID 1000Possible fixes
userin the image — let OpenShift's runtime injection be the sole entry (may break non-OpenShift use)developer) to avoid collision with runtime injectionIssue 2:
/varsubdirectories not writable/var/lib,/var/cache, and other subdirectories under/varare not writable by the runtime user. This prevents:dnf installfor new packages at runtime (e.g.,pinentry-cursesneeded for GPG signing withansible-sign)While
/usr/binbeing read-only is expected for container immutability,/varis traditionally writable for package manager state and caches.Current workaround
For Python packages,
pip installinto the.venvworks (e.g.,pip install cowsay). For system packages that have no pip equivalent, users must bake them into the image.Suggested fix
Ensure
/var/lib/dnf,/var/cache/dnf, and/var/log/dnfare writable by the runtime user, or provide a mechanism to install additional system packages at workspace startup (e.g., via devfile postStart commands with appropriate permissions).Environment
ghcr.io/ansible/ansible-devspaces:v26.4.5Related upstream issues and PRs
/varpermissions)Downstream tracking