sudo, tar --chown, chmod, and chown fail inside srun --container-image sessions. Pre-build images outside Slurm, or use fakeroot for in-container installs. --no-container-remap-root makes file ownership consistent but doesn’t grant real root.
Symptoms
These errors appear only inside a Pyxis or enroot container, not in a baresrun on the same node:
sudo: effective uid is not 0tar: Cannot change ownershipchmod: changing permissions: Operation not permitted- Package installs (
apt,dpkg,conda, andpip) fail while changing ownership or permissions.
Why remapping breaks those commands
By default, enroot starts the container in a user namespace. Inside the container you appear as root (UID 0). On the host, those operations run as your Slurm user ID. Setuid binaries such assudo and ownership changes such as tar --chown therefore fail. This is a multi-tenant security control, not a cluster misconfiguration.
The enroot runtime also ignores the Dockerfile USER instruction. With default remapping, the process appears as root inside the container. With --no-container-remap-root, the process runs as the Slurm user who submitted the job, not as the user named in the image.
Choose a workaround
Pre-build the image
Build and push the image in Docker or your CI pipeline, then run the pre-built image on SUNK. Replace[REGISTRY], [IMAGE], and [TAG] with your image coordinates.
Use fakeroot for in-container installs
Installfakeroot in the image, then wrap the install command:
Disable UID translation
--no-container-remap-root stops UID translation. File ownership on mounted filesystems matches your Slurm user, but sudo still fails because you aren’t root.
Build images outside the login node. To run Docker inside a Slurm allocation, see Use Docker in SUNK.
Related
- How do I run containers with Pyxis and Enroot in Slurm?
- Install software as containers using Pyxis and enroot
- Set up AppArmor profile for enroot
Workload Scheduling