Comments (2)
Make sure to go through the cases in #1459 before making changes.
from apptainer.
Indeed I found that the problem in #1459 reappeared. I think adding the fuse allow_other
option helps, but that's not enough to fix the Permission denied
error. With setuid mode it also happens on CentOS7, although not on Rocky9. In user namespace mode it happens on all 3 current systems.
Here's how to reproduce it outside of Apptainer, using just command line commands. Use the test.squashfs from #1459 and for simplicity build a simple squashfs container with
$ apptainer pull test_image.sif docker://alpine
$ apptainer sif dump 4 test_image.sif >test_image.squashfs
Next reproduce the issue privileged on CentOS7 or Rocky8 since it's simpler:
$ cd /tmp
$ mkdir mnt1 mnt2 mnt3
$ sudo unshare -m
[root@localhost tmp]# squashfuse -f -o allow_other,ro,uid=1000,gid=1000 test_image.squashfs mnt1 &
[1] 7617
[root@localhost tmp]# squashfuse -f -o allow_other,ro,uid=1000,gid=1000 test.squashfs mnt2 &
[2] 7622
[root@localhost tmp]# mount -t overlay -o lowerdir=mnt2:mnt1 - mnt3
[root@localhost tmp]# runuser user -c "ls mnt3"
ls: cannot open directory 'mnt3': Permission denied
Replace user
with your own user name and 1000
with your own uid and gid.
Bizarrely, I found that this can be worked around by unmounting and remounting the overlay:
[root@localhost tmp]# umount mnt3
[root@localhost tmp]# mount -t overlay -o lowerdir=mnt2:mnt1 - mnt3
[root@localhost tmp]# runuser user -c "ls mnt3"
This only works when there is also an access to the mnt3 mountpoint after the initial overlay mount and before the umount.
Likewise, for user namespaces, on Rocky8 or Rocky9 in one window create a root-mapped user namespace:
SHELL=/bin/sh unshare -rm
[root@localhost tmp]# squashfuse -f -o allow_other,ro,uid=1000,gid=1000 test_image.squashfs mnt1 &
[root@localhost tmp]# squashfuse -f -o allow_other,ro,uid=1000,gid=1000 test.squashfs mnt2 &
[root@localhost tmp]# mount -t overlay -o lowerdir=mnt2:mnt1 - mnt3
[root@localhost tmp]# echo $$
2793
Then in another window enter that namespace and create a sub user namespace:
$ SHELL=/bin/sh nsenter -t 2793 --preserve-credentials -U -m --
[root@localhost /]# cd tmp
[root@localhost tmp]# unshare -U
[nobody@localhost tmp]$ echo $$
3350
Then back in the root-mapped namespace set it to map root back to the original user:
[nobody@localhost tmp]# echo "1000 0 1" >/proc/3350/gid_map
[nobody@localhost tmp]# echo "1000 0 1" >/proc/3350/uid_map
Then in the nsenter user shell you see Permission denied:
[nobody@localhost tmp]$ id
uid=1000(user) gid=1000(user) groups=1000(user),65534(nobody)
[nobody@localhost tmp]$ cd mnt3
ls: cannot open directory 'mnt3': Permission denied
Until you go back to the original root-mapped space and umount and mount again the overlay.
from apptainer.
Related Issues (20)
- --nvccli does not work correctly on Ubuntu 22.04 HOT 1
- --nvccli fails for NVIDIA_DRIVER_CAPABILITIES=graphics HOT 5
- Squashfuse 0.5.0 causes 32-bit compile failure on Fedora 40
- Embedding Signature History for Multi-Stage Builds [Enhancement] HOT 4
- Slow first execution inside the container HOT 13
- Cannot log into SylabsCloud HOT 2
- Feature request: support for --insecure during apptainer push and pull HOT 1
- Copying of OCI layout before building a sandbox image
- Spawn service in parallel with bash script HOT 2
- Infinite `Overlay mount failed with invalid argument` on Ubuntu 20.04 with sandbox container plus overlay HOT 1
- Invalid bind-mount options give unhelpful error
- 'apptainer build' fails when using signed Docker-style Containers HOT 15
- Putting sandbox on Lustre file system makes apptainer "hang" HOT 3
- /.singularity.d/libs/faked: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.34' not found HOT 1
- Cleanup error stopping fuse-overlayfs driver when background process is running HOT 4
- Singularity crashes when running heudiconv fmri data conversion (FATAL error) HOT 1
- Loopback SSH inside container HOT 1
- container creation failed: mount hook function failure: mount /proc/self/fd/3, kernel reported a bad superblock for squashfs image partition HOT 9
- WIth ORAS source, pull does not show progress bar and push fails on v1.3.0 HOT 1
- Import selected PRs from SingularityCE 4.1.x HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from apptainer.