Repository navigation
Description
What happened
Two tasks in a five-recipe batch died at the same line: rm of a staged input.
== verify staged reads against their pinned sha256 ==
ERR188026_sub_1.fq.gz: OK
ERR188026_sub_2.fq.gz: OK
rm: cannot remove 'star-index.tar': Operation not permitted
Identical failure in the sibling task (rm: cannot remove 'salmon-index.tar': Operation not permitted). Both tasks stage a ~0.6–1.6 GiB tar from S3, untar it, and delete the tar to hold peak disk down inside the 8 GiB root.
Why
Three facts compose into it:
pkg/taskproto/wrapper.go:90stages every input withaws s3 cpon the host, running as the instance user —writeContainerRun's own comment says "The command script runs as the unprivileged instance user (bootstrap runs it viasu - <user>)".- Host
/tmpis1777. It is also the only mount reliably writable from the container whatever user the image runs as, so it is where flat staged paths have to go. - The container runs as the image's user —
wrapper.goemitssudo docker run --rmwith no--userin 0.102.0. Here that ismambauser(uid 57439) from the bioconda base.
Sticky-bit semantics: a user may only unlink files they own in a 1777 directory. So the container can read a staged input, can create and delete its own files, and cannot delete a staged one.
Reproduced on a real Linux filesystem (a macOS bind mount will not show this — Docker Desktop doesn't enforce sticky-bit ownership, which is how it passed seven local dry runs):
$ docker run --rm -u 0:0 --entrypoint bash quay.io/aarchbio/star@sha256:90331f64... -c '
mkdir -p /work && chmod 1777 /work && cd /work && echo payload > staged.tar
setpriv --reuid 57439 --regid 57439 --clear-groups rm -f staged.tar; echo "rm -f exit=$?"'
rm: cannot remove 'staged.tar': Operation not permitted
rm -f exit=1
Note rm -f exits 1: -f suppresses ENOENT, not EPERM. Any task body using set -e therefore dies, after its inputs have already verified — so the failure looks like it is in the science when it is in the plumbing.
#555 / 4a8386f (--user "$(id -u):$(id -g)") does not fix this: it makes the container run as the instance user's numeric uid, which is a different uid from the image's user but still not the owner in the general case — and where it does match, it matches by luck of the AMI, not by construction.
Suggested fix
Make the staged file owned by whoever the container will run as. Either:
chowneach staged destination to the container's uid:gid afteraws s3 cp(needs the uid spawn is about to run as — trivial once spawn task run: container can't write staged dirs when the image USER isn't root or uid 1000 (bioconda images are uid 57439) #555 lands, since spawn then chooses it); or- stage into a per-task directory that is not sticky (e.g.
/var/lib/spawn/tasks/<task_id>/, mode0777or owned by the target uid) and bind-mount that, instead of relying on/tmp.
The second also removes the reason recipes must keep every staged path flat in /tmp.
Mitigation in the meantime
Don't delete staged inputs — budget for holding them. That is what my two recipes now do, with a comment, and the disk arithmetic was comfortable anyway (3.2 of ~6.1 GiB for the larger one). Worth a line in the task docs either way, because the failure mode is invisible until it isn't.
Filed from the scientific-codes-cookbook project, spawn 0.102.0 / 3db242c, AL2023 arm64, c8g.2xlarge.
Activity
Fix both dependent tasks: never rm a staged input
fix(taskproto): create output-only mount dirs and fix staged-input ow…
fix(taskproto): create output-only mount dirs and fix staged-input ow…
fix(taskproto): create bind-mount dirs with privilege, so top-level p…
fix(taskproto): create bind-mount dirs with privilege (#564), and doc…
scttfrdmn commentedon Oct 4, 2026
Confirmed fixed on real hardware, which is the standard this issue deserved — it was reported from a real run and argued specifically that the
#555fix would not be enough.Ran a container task in 942542972736/us-west-2 that stages an input into sticky
/tmpand deletes it withrm -funderset -e— the exact shape that killed your two recipes at thermof an index tar:On the objection in the issue
You wrote that
--user "$(id -u):$(id -g)""does not fix this: it makes the container run as the instance user's numeric uid, which is a different uid from the image's user but still not the owner in the general case — and where it does match, it matches by luck of the AMI, not by construction."That was right about
#555alone, and it is whatc327274closed. Two things now make the ownership hold by construction rather than by luck:--user "$(id -u):$(id -g)"is evaluated in the same shell as stage-in, so the uid passed todocker runis definitionally the uid that ranaws s3 cp.sudo chown "$(id -u):$(id -g)"right after it lands — your own "Suggested fix" option 1. It is a same-uid no-op in practice, emitted unconditionally precisely so the invariant doesn't depend on stage-in anddocker runhappening to share one uninterrupted shell session.Sticky-bit semantics then permit the unlink, because the container owns the file rather than merely sharing the directory.
Your second suggestion — staging into a non-sticky per-task directory instead of relying on
/tmp— turned out to be the more load-bearing one, and for a different reason than ownership: #564, which the same validation run showed was not fixed./tmpwas effectively the only usable staging location because the wrapper'smkdirfor any other path ran unprivileged and failed silently. That is fixed in #649 (merged), so a non-/tmpstaging path now works — which also removes the reason recipes had to keep every staged path flat.The
rm -f/EPERMdetail in this report was the sharpest part of it:-fsuppressesENOENTbut notEPERM, so the failure landed after the science had already succeeded and looked like a tool problem. Worth keeping in mind that the macOS reproduction caveat you noted is real — Docker Desktop doesn't enforce sticky-bit ownership, so this class can only be validated on Linux.Instance terminated and leak-checked; ~$0.002.