Skip to content

Fix Ubuntu 24.04 systemtest Docker user setup#772

Merged
MakisH merged 1 commit into
precice:developfrom
PranjalManhgaye:fix-766-ubuntu2404-docker-user
May 11, 2026
Merged

Fix Ubuntu 24.04 systemtest Docker user setup#772
MakisH merged 1 commit into
precice:developfrom
PranjalManhgaye:fix-766-ubuntu2404-docker-user

Conversation

@PranjalManhgaye
Copy link
Copy Markdown
Contributor

Summary

This fixes the Ubuntu 24.04 systemtest Docker build when the requested host UID/GID already exists inside the base image.

With "ubuntu:24.04", UID/GID 1000 can already be used by the default ubuntu user/group. The previous Dockerfile always tried to create a new precice group and user with those IDs, which failed with:

groupadd: GID '1000' already exists

Changes

The Dockerfile now checks whether the requested group or user already exists:

  • If the requested GID already exists, it reuses that group by renaming it to precice.
  • If the requested UID already exists, it reuses that user by renaming it to precice.
  • If the UID/GID are unused, it creates the precice group/user as before.
  • It ensures /home/precice exists and is owned by the requested UID/GID.
  • This keeps the later USER precice behavior working while preserving the host UID/GID mapping used by local system tests.
    Fixes System test Docker container for Ubuntu 24.04 fails in groupadd #766.
image
Both builds ran successfully

Checklist:

  • I added a summary of any user-facing changes (compared to the last release) in the changelog-entries/<PRnumber>.md.
  • I will remember to squash-and-merge, providing a useful summary of the changes of this PR.

Reuse existing UID/GID entries in the Ubuntu 24.04 base image so the systemtest Docker build does not fail when GID 1000 already exists.
Copy link
Copy Markdown
Member

@MakisH MakisH left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the fix! This is important for developing/debugging locally.

It runs on my system (Ubuntu 22.04, UID/GID=1000), and the changes make sense to me.

Since I need to get back into context, could you please elaborate on why this is an issue with the Ubuntu 24.04 builds, but not with the 22.04?

@PranjalManhgaye
Copy link
Copy Markdown
Contributor Author

PranjalManhgaye commented May 11, 2026

Thanks @MakisH for a check , the difference seems to come from the base images themselves. " ubuntu:24.04" already includes a default "ubuntu" user/group with UID/GID 1000, while " ubuntu:22.04" does not.
I checked this with :
docker run --rm ubuntu:24.04 bash -lc 'getent passwd 1000; getent group 1000'
which returns :
image
For " ubuntu:22.04", the same command does not return a UID/GID 1000 entry.
So the previous Dockerfile worked on 22.04 because groupadd -g 1000 precice and useradd -u 1000 ... had no collision there. on 24.04, the same commands collide with the existing ubuntu user/group before the precice user can be created , This patch handles both cases : 1) if the requested UID/GID already exists, it reuses that entry for precice; otherwise 2) it keeps the previous behavior and creates the precice user/group normally.

@MakisH MakisH merged commit 26d0b39 into precice:develop May 11, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

System test Docker container for Ubuntu 24.04 fails in groupadd

2 participants