Could not create /dev/loop8: Permission denied
Version of Singularity:
$ singularity --version 2.4-dist
Expected behavior
$ singularity shell shub://vsoch/hello-world Progress |===================================| 100.0% Singularity: Invoking an interactive shell within container...
Singularity vsoch-hello-world-master-latest.simg:~/simgs>
Actual behavior
ERROR : Could not create /dev/loop8: Permission denied ABORT : Retval = 255
Steps to reproduce behavior
$ singularity shell shub://vsoch/hello-world Progress |===================================| 100.0% ERROR : Could not create /dev/loop8: Permission denied ABORT : Retval = 255
###system $ lsb_release -a No LSB modules are available. Distributor ID: Ubuntu Description: Ubuntu 16.04.3 LTS Release: 16.04 Codename: xenial
Did you try the --containall flag?
Thanks for fast reply...do you mean like this?
$ singularity shell --containall shub://vsoch/hello-world ERROR : Could not create /dev/loop8: Permission denied ABORT : Retval = 255
maybe it's a server issue, but I don't know why...both running same version of ubuntu and same singularity, /dev/loop* permissions are also same...
$ ll /dev/loop* brw-rw---- 1 root disk 7, 0 Feb 7 22:16 /dev/loop0 brw-rw---- 1 root disk 7, 1 Dec 21 23:21 /dev/loop1 brw-rw---- 1 root disk 7, 2 Dec 21 23:21 /dev/loop2 brw-rw---- 1 root disk 7, 3 Dec 21 23:21 /dev/loop3 brw-rw---- 1 root disk 7, 4 Dec 21 23:21 /dev/loop4 brw-rw---- 1 root disk 7, 5 Dec 21 23:21 /dev/loop5 brw-rw---- 1 root disk 7, 6 Dec 21 23:21 /dev/loop6 brw-rw---- 1 root disk 7, 7 Dec 21 23:21 /dev/loop7 crw-rw---- 1 root disk 10, 237 Dec 21 23:21 /dev/loop-control
my sysadmin fixed something on the server, the problem is solved. not software related seems. closed.
awesome! Glad to hear.
Sorry for hijacking the thread. Just wondering if this is related to something I experience:
@lidaof, would you know what your admins did? I'm having the same problems on AWS's cfncluster. Surprisingly loopback devices are not part of the AMI (ami-306b194c). Anyway, even after running
modprobe loop max_loop=64
yum install -y MAKEDEV
MAKEDEV -v /dev/loop
I get
ERROR : No more available loop devices, try increasing 'max loop devices' in singularity.conf
The overall problem remains when changing the permissions:
chmod g+w /dev/loop*
usermod -a -G disk ec2-user# plus logging in and out
...
DEBUG [U=500,P=7821] singularity_image_bind() Setting loop device flags
ERROR [U=500,P=7821] singularity_image_bind() Failed to set loop flags on loop device: Operation not permitted
ABORT [U=500,P=7821] singularity_image_bind() Retval = 255
Here's the setup:
[ec2-user@ip-172-31-30-117 ~]$ groups
disk wheel
[ec2-user@ip-172-31-30-117 ~]$ ll /dev/loop* | grep -v loop[0-9][0-9]
brw-rw---- 1 root disk 7, 0 Feb 12 08:52 /dev/loop0
brw-rw---- 1 root disk 7, 1 Feb 12 08:16 /dev/loop1
brw-rw---- 1 root disk 7, 2 Feb 12 08:16 /dev/loop2
brw-rw---- 1 root disk 7, 3 Feb 12 08:16 /dev/loop3
brw-rw---- 1 root disk 7, 4 Feb 12 08:16 /dev/loop4
brw-rw---- 1 root disk 7, 5 Feb 12 08:16 /dev/loop5
brw-rw---- 1 root disk 7, 6 Feb 12 08:16 /dev/loop6
brw-rw---- 1 root disk 7, 7 Feb 12 08:16 /dev/loop7
brw-rw---- 1 root disk 7, 8 Feb 12 08:16 /dev/loop8
brw-rw---- 1 root disk 7, 9 Feb 12 08:16 /dev/loop9
crw--w---- 1 root root 10, 237 Feb 12 08:16 /dev/loop-control
Would anyone have any pointers?
Andreas
See also #1278
Stupid question - if the default max loop devices is 256 and you are setting max_loop to 64, wouldn't that mean Singularity thinks it can use 192 that it actually can't? Although on second thought, it's a silly for loop:
https://github.com/singularityware/singularity/blob/e480d9640f5e76a51af7a9f43e87b77f008f6652/src/lib/image/bind.c#L82
so if the higher numbers indexed aren't used, they theoretically never get there! But still it might be something relevant.
Sorry, I might have copy and pasted the wrong combination in here. I've tried the default as well though (256) with the same effect.
Andreas
Hi @andreas-wilm , I asked my sysadmin, if he respond I will paste what he replied here.
Hi @andreas-wilm - In repsonse to @lidaof, our issue ended up being improper setuid bits on the installed binaries.
Thanks! Since I work with a user installation setuid is not an option, and I furthermore thought it was unnecessary in general to set setuid on Singularity?!
Andreas
On 13 Feb 2018 04:07, "Eric" [email protected] wrote:
Hi @andreas-wilm https://github.com/andreas-wilm - In repsonse to @lidaof https://github.com/lidaof, our issue ended up being improper setuid bits on the installed binaries.
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/singularityware/singularity/issues/1290#issuecomment-365045980, or mute the thread https://github.com/notifications/unsubscribe-auth/ABC5CaapB5tnjaUd7cYGWc4f9yvywj0rks5tUJoVgaJpZM4R9xn0 .
Anyway, an installation as root with setuid components fixes the problem, so this is clearly not a Singularity issue but an inconvenience on systems with user installations and a certain unusual (?) /dev/loop setup
This happens for me on a variety of servers managed by different sysadmins running RHEL 7.4 and Ubuntu 14.04. In both cases I tried installing as a non-root user in the home directory.
Is this not supported? The docs do refer to sudo make install, but it would be really great to try things out on certain machines before asking a sysadmin to install singularity.
[UPDATE: Ah, I see this question is answered in #1258.]
@rrnewton - With a non-root install you will need to use sandbox directories for containers, as we don't have privilege to perform the loop mount of container image files. Additionally, unfortunately, RHEL7.4 doesn't support using user namespaces (which is required to run singularity unprivileged) unless certain configuration is made to the system. The open science grid has some notes:
http://opensciencegrid.github.io/docs/worker-node/install-singularity/#enabling-unprivileged-mode-for-singularity
This is a general issue for container runtimes as non-root users. The required features were included in newer kernel versions, and may or may not have been backported, and may be optionally enabled (as for RHEL7.4)
@dctrud I see the same(?) issue with Fedora/4.11.9-200
singularity -d shell --pid --userns centos7.simg
...
VERBOSE [U=1000,P=1] singularity_image_bind() Could not open loop device /dev/loop5: Permission denied
VERBOSE [U=1000,P=1] singularity_image_bind() Could not open loop device /dev/loop6: Permission denied
DEBUG [U=1000,P=1] singularity_image_bind() Instantiating loop device: /dev/loop7
ERROR [U=1000,P=1] singularity_image_bind() Could not create /dev/loop7: Permission denied
ABORT [U=1000,P=1] singularity_image_bind() Retval = 255
DEBUG [U=1000,P=29073] wait_child() SIGCHLD raised, parent is exiting
Hi @thdesy - sorry my previous reply may have been a bit of a side-track, r.e. the RHEL7.4 stuff for user ns, as there's another consideration. I've edited it.
Regardless of which OS your are using, non-root install --userns execution needs the container to be a sandbox directory. We don't have privilege, with a non-root install, to perform a loop mount of container image files. The following will work:
08:38 AM $ singularity-nosuid/bin/singularity build -s alpine_sandbox docker://alpine:latest
WARNING: Building sandbox as non-root may result in wrong file permissions
Docker image path: index.docker.io/library/alpine:latest
Cache folder set to /home/dave/.singularity/docker
Importing: base Singularity environment
WARNING: Building container as an unprivileged user. If you run this container as root
WARNING: it may be missing some functionality.
Singularity container built: alpine_sandbox
Cleaning up...
08:38 AM $ singularity-nosuid/bin/singularity shell --pid --userns alpine_sandbox/
Singularity: Invoking an interactive shell within container...
@dctrud sorry to revive this issue, but the --userns exec fails for arch (running under virtualbox).
$ singularity build -s alpine_sandbox docker://alpine:latest
WARNING: Building sandbox as non-root may result in wrong file permissions
Building into existing container: alpine_sandbox
Docker image path: index.docker.io/library/alpine:latest
Cache folder set to /home/walz/.singularity/docker
Importing: base Singularity environment
Exploding layer: sha256:ff3a5c916c92643ff77519ffa742d3ec61b7f591b6b7504599d95a4a41134e28.tar.gz
Exploding layer: sha256:1f6d219d0077f6af480398f264117d2e74c03ec5f12d09b7b29b1eefbba872eb.tar.gz
WARNING: Building container as an unprivileged user. If you run this container as root
WARNING: it may be missing some functionality.
Singularity container built: alpine_sandbox
Cleaning up...
$ singularity shell --pid --userns alpine_sandbox/
ERROR : Failed invoking the NEWUSER namespace runtime: Operation not permitted
ABORT : Retval = 255
$ singularity --version
2.5.1-master.gba7cf79
Hi @DavidWalz - various distributions need some config to allow unprivileged namespace creation. It looks like on arch the process is documented here:
https://wiki.archlinux.org/index.php/Linux_Containers#Enable_support_to_run_unprivileged_containers_.28optional.29
Right, thanks!