why do I need to be root user to shell into a container (or exec)??

516 views
Skip to first unread message

Joshua Studen

unread,
Nov 16, 2017, 6:16:13 PM11/16/17
to singularity
I am following the instructions here:


I do this:

$ singularity pull --name hello-world.simg shub://vsoch/hello-world

No issues. Then I do this:

singularity shell hello-world.simg

ERROR  : Base home directory does not exist within the container: /nfshome                                                                                                                                  
ABORT  : Retval = 255


Do I need sudo access to *use* containers or something? Also, why don't the quickstart instructions clearly indicate which operations you need sudo and which you don't?

also, if I do this:

sudo singularity shell hello-world.simg

it "works." However, if I do this: 

sudo singularity shell -w hello-world.simg

I get: 

ERROR  : Unable to open squashfs image in read-write mode: Read-only file system


Joshua Studen

unread,
Nov 16, 2017, 6:26:34 PM11/16/17
to singularity
Also, if I try to go back to singularity 2.3.1, I get the following errors.

$ singularity import ubuntu-latest.img docker://ubuntu:latest                         
                                                                                                     
Docker image path: index.docker.io/library/ubuntu:latest                                                                                                                                                    
ERROR Improperly formed manifest, layers or fsLayers must be present 

lol. 

Jeff Kriske

unread,
Nov 16, 2017, 9:16:33 PM11/16/17
to singularity
The squashfs image should be read-only so that makes sense.

When you are going to use the container as a user, since /nfshome doesn't exist it's trying to use overlay... check your configuration in /etc/singularity/singularity.conf or in /usr/local/etc/singularity/singularity.conf  depending on how you configured it. Check if you have overlay disabled. You may simply be using a kernel that's too old. It's more than likely too, that your root home /root is not on NFS.

You need that directory to exist so one way to do this is:
sudo singularity build -s hello-world shub://vsoch/hello-world

then go into that hello-world folder and create the directory /nfshome. You can then run it with
singularity run hello-world

If you want, once you've made the change you can turn it back into a squashfs image with
sudo singularity build hello-world.simg hello-world

if you were to delete /root then you'll get the same behavior when trying to shell in as root. You can avoid it by specifying an alternate home directory such as:
singularity shell --home / hello-world.simg
this doesn't work with exec or run though as one might assume.

to troubleshoot you can always try:
singularity -vvv --debug shell hello-world.simg
that will provide more info.
Reply all
Reply to author
Forward
0 new messages