On Ubuntu 24 LTS with podman 4.9.3 and podman-compose 1.0.6.
dockerfile:
FROM registry.access.redhat.com/ubi9/ubi-minimal:9.5
ARG user
ARG username
RUN useradd --create-home --gid=${user#*:} --no-user-group --uid=${user%:*} $username
# user created, but home dir owned by root:root
RUN echo chown --recursive ${user} /home/${username}
# looks correct, yet next command fails with 'Invalid Argument'
RUN chown --recursive ${user} /home/${username}
Invocation:
$ podman build --build-arg user=$(id -u):$(id -g) --build-arg username=$USER
emits
chown --recursive 447900762:100 /home/me
yet fails with
chown: changing ownership of '/home/me/.bash_logout': Invalid argument
chown: changing ownership of '/home/me': Invalid argument
Error: building at STEP "RUN chown --recursive ${user} /home/${username}": while running runtime: exit status 1
What do I need to do, to ensure the user directory is created for the correct user to begin with?
If that is unfeasible, how can I allow podman build to chown files that only exist inside the container?
(All similar questions I found deal with mounts, but this is not a mount.)
I am only trying this because I found no solution for preceeding issues.
Might one of these be related and perchance easier to solve?
- For images with a pre-existing user, devcontainer.json ignores
"updateRemoteUserUID": true,and neither VSCode nor CLion manage to map the uid/gid automatically.
(There is no error, but the user keeps their original uid/gid.) - For a spontaneously created user by podman-compose’s
user: 447900762:100, the home directory does not get created. - Not creating the home dir and instead mounting my host home dir into the container as an overlay (
:O) fails with the most cryptic error:$ podman run -it --rm --user=me --userns=keep-id --volume=/home/me:/home/me:O --entrypoint=/bin/bash <container> Error: container create failed (no logs from conmon): conmon bytes "": readObjectStart: expect { or n, but found , error found in #0 byte of ...||..., bigger context ...||...
Some more context:
podman behaves anormal on Ubuntu 24 to begin with. I executed sudo dmesg | grep chown in case it was blocking the command, but saw zero results.
This here is an MVE where I stripped out devcontainer.json and compose.yaml and .env and whathaveyou.
Yet, somehow, some of these tools seem to have greater capacity than the underlying base:
- If I build the container with podman-compose, I can chown in the running container at least, though still not on build.
- CLion creates the missing home directory on start of the dev container, and somehow that works perfectly.
VSCode requires the directory to be pre-existing though, thence I try to create it.
I am very sure that somehow Ubuntu being Ubuntu is to blame for this, but without actionable error messages I have nothing to go on.