Repository navigation
Description
Summary
When a task uses image: <registry-image-resource> (i.e. a get step result as the task image via image: key), files in the image that are owned by uid 1001 end up with uid 1002 on the worker's btrfs subvolume after extraction. Files owned by uid 1000 are unaffected. This causes Permission denied at runtime for any task that runs as that user and tries to write to its home directory.
How to reproduce
- Build an image using
oci-build-task(i.e. viaconcourse/oci-build-task) with aDockerfilelike:
FROM ubuntu
RUN useradd non-root-user --shell /bin/bash --create-homeThe Ubuntu base image (ubuntu:noble / ubuntu:resolute) includes a pre-created ubuntu user at uid 1000, so useradd non-root-user assigns uid 1001.
-
Push the image via a
registry-imageput step. -
Use the image in a task:
- task: my-task
image: my-registry-image-resource
config:
run:
path: bash
args: [-c, "mkdir -p $HOME/.config/gcloud/"]
user: non-root-user- Task fails:
mkdir: Permission denied
Diagnostic data
Inside the failing container (captured via fly hijack):
whoami=non-root-user id=uid=1001(non-root-user)
stat /home/non-root-user: Uid: ( 1002/ UNKNOWN) Gid: ( 1001/non-root-user)
writable check: NOT writable
The process runs as uid 1001 but the home directory is owned by uid 1002 on disk. The uid_map in the container is identity (1 1 N), so this is NOT a runtime namespace issue — the file literally has inode uid 1002 on the worker's btrfs.
Image tar layer inspection confirms the layer header has the correct uid 1001:
$ tar -tzvf home-layer.tar
drwxr-x--- 0 1001 1001 0 home/non-root-user/
So the +1 shift is introduced during extraction, not during image build.
Key observations
- uid 1000 is unaffected:
/home/ubuntu(uid 1000 in the same layer) is correctly uid 1000 on disk. - Only uid 1001 shifts to 1002: the shift is specific to this uid range.
- Image content is identical between a working
docker-image-resource-built image and a non-workingoci-build-task-built image. Both have uid 1001 in the tar header. image_resource:(inline fetch) works correctly: afly executetask withimage_resource:pointing at the same image digest sees uid 1001 correctly. Onlyimage: <resource>(volume-based path) exhibits the bug.- The bug is on the btrfs worker: the inode on the btrfs subvolume has uid 1002, not 1001. The problem is in the extraction path, not at runtime.
Hi @taylorsilva,
I think I was able to find the root cause. It's not btrfs extraction - it's the way baggageclaim streams volumes between workers with tar without --numeric-owner, combined with workers that have divergent /etc/passwd (same username → different uid on each worker VM).
Analysis with the help of AI:
What was observed:
- Image built by
oci-build-taskwith a usernon-root-userat uid 1001. - Consumed in a downstream job via
image: <get-resource>(volume-mounted, not inlineimage_resource:). - Intermittently,
$HOMEon disk was owned by 1002 / 1003 / 1004 / 1005 (it crept up by one over several days), while/etc/passwdinside the image still said1001. Process runs as 1001, can't wri…
Activity
taylorsilva commentedon Jun 12, 2026
Thanks for the report. I'll take a look at this since since it might affect how #9593 is implemented.
taylorsilva commentedon Jun 15, 2026
I locally built and pushed the image with
docker build. Used this test pipeline:The build passed:
Maybe it's an issue with building the image? Docker and oci-build-task both use buildx to create the container image.
I'll try building and then using the image in a single job:
Same result as before, ownership is correct in the final task and build passes.
Maybe the issue is with the
registry-imageextracting the rootfs? Feels unlikely at this point as we've separately tested that with the first pipeline, and tested oci-build-task with this second. I guess we can combine the two to see if anything changes. Feels unlikely at this point though.Same result, everything works, there's no off-by-one UID for the new user.
Just re-read the title and noted you have your workers using btrfs. Let's try everything again with that!
I locally deployed a worker with
CONCOURSE_BAGGAGECLAIM_DRIVER: btrfsand ran that last pipeline again. It still worked, couldn't reproduce it.@neddp I'm having no luck reproducing your issue even though you gave plenty of details. What version of Concourse are you on? Are there any other non-default settings on your worker? I did all my initial tests on 8.2.3 and did that last one with btrfs with the latest commit on
master.neddp commentedon Jun 16, 2026
Hi @taylorsilva,
Thank you for looking into this!
We are using version 8.2.3 and I need to check the worker settings. In the meantime, I'll work on a minimal repro and repro back.
neddp commentedon Jun 22, 2026
Hi @taylorsilva, I think I managed to isolate the issue with the help of Claude.
Minimal reproduction
Two
registry-imageresources fetched inin_parallelin the same job causes a uid shift on one of the image volumes:Result:
/home/non-root-useris owned by an unexpected uid (shifted from 1001), not writable.Replace the
in_parallelwith sequentialgetsteps, or fetch onlyimg-aalone → correct uid, writable.Key observations
in_parallel: uid shifted (+1 or +2 depending on worker state), not writable ✗fly clear-resource-cacheforces a fresh extraction0 4294967294 1 / 1 1 4294967293(identity for uid 1+), so this is not a runtime namespace issue — the wrong uid is physically on disk in the btrfs subvolumeEnvironment
gdn-initowned by uid 65534 on the host)taylorsilva commentedon Jun 22, 2026
Based on the info you provided I made this pipeline:
The two images I'm using are:
These images are similar, but the
concourse/bashone includesapkwhile chainguard's does not. Both have anonrootuser with the following entry in/etc/passwd:With this setup I was unable to reproduce the issue.
/home/nonrootwas properly owned by the nonroot user in both images:The only difference I see here is that my nonroot user has a higher UID than 1001.
Let's go back to the Dockerfile you initially shared:
Update user to
notrootin my pipeline and see what happens.Still works. Not seeing shifted UID's here. I made sure I was using the btrfs driver on my worker too. I ran this multiple times, clearing resource cache, but couldn't get it to reproduce.
I will point out that the registry-image does not do any chown'ing. The only place I know of that does this is in baggageclaim here: https://github.com/concourse/concourse/blob/4874cf0abe2aef98cab79431749f5a0c47e4b50e/worker/baggageclaim/uidgid/translator.go
If there is a bug, I'd suspect it would be there, not in the registry-image.
Are you able to make the images you used public? Or share their full Dockerfile content? I'm currently not sure what we're missing here. I think I've replicated your setup but clearly I'm still missing something.
I did notice this final point in your last comment:
The worker is not designed or tested to run as a non-root user. I'm not sure what you mean by this point here. I also don't think we ship a
gdn-initbinary. We ship thegdnbinary and aninitbinary. I don't think we have agdn-initbinary anywhere though.More details about your worker setup may help:
neddp commentedon Jun 30, 2026
Hi @taylorsilva,
I'm still looking into this. Now I'm also unable to reproduce it, will report back once I have any progress.
Thanks again for your time on this, I really appreciate it.
neddp commentedon Jul 24, 2026
Hi @taylorsilva,
I think I was able to find the root cause. It's not btrfs extraction - it's the way baggageclaim streams volumes between workers with
tarwithout--numeric-owner, combined with workers that have divergent/etc/passwd(same username → different uid on each worker VM).Analysis with the help of AI:
What was observed:
oci-build-taskwith a usernon-root-userat uid 1001.image: <get-resource>(volume-mounted, not inlineimage_resource:).$HOMEon disk was owned by 1002 / 1003 / 1004 / 1005 (it crept up by one over several days), while/etc/passwdinside the image still said1001. Process runs as 1001, can't write its own home → failure.Crucially:
mountinfoconfirmedoverlay), not just btrfs. So it's not an extraction quirk of the btrfs driver.Uid: 1005 / Gid: 1001). A user-namespace remap would move both./proc/<worker>/uid_mapis identity (0 0 4294967295), so baggageclaim's uid mapper isn't remapping 1001 - it maps 1001→1001.streaming volume for image from worker <uuid>).Root cause
baggageclaim streams volumes as
tararchives. In worker/baggageclaim/volume/stream_in_out_linux.go,tarCmdbuilds:with no
--numeric-owner. GNU tar therefore records the owner name in the header and re-resolves it against/etc/passwdon extraction. We confirmed this directly by tarring a streamed volume on the source worker:On our BOSH-deployed workers the same set of named accounts exists on every worker, but each VM assigns them different uids (the uid ordering isn't stable across workers). For example
jumpboxis uid 1001 on one worker and 1005 on another:So a file owned by uid 1001 on the source is tarred as
jumpbox, then restored to uid 1005 on the destination (wherejumpbox= 1005). The image's passwd still says 1001 → mismatch →mkdir: Permission denied.This explains every property we saw: driver-independence, uid-only drift (the group
bosh_sshersis fixed at gid 1001 on all our workers, so the group name resolves back to 1001 everywhere), the slow +1 climb (more host users added over time).Minimal reproduction (no Concourse needed)
taylorsilva commentedon Jul 24, 2026
Wow, okay, so the issue is when the worker's
/etc/passwdon the host disk is different between workers. If we include--numeric-ownerin our tar commands when streaming then we shouldn't have this issue anymore, right?Moving this issue over to the
concourse/concourserepo.neddp commentedon Jul 25, 2026
Hi @taylorsilva,
Thanks for following up with a PR. It's a small change and it should address the issue.
I want to add a clarification. Our deployment is running on GCP and I found that we have compute SSH-key metadata entries. It appears those are added by the
GCE guest agenton the VMs with no fixed uid and this is where the drift comes from.Thanks again!