Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Running singularity from within a singularity container #5348

Closed
sntgluca opened this issue Jun 8, 2020 · 4 comments
Closed

Running singularity from within a singularity container #5348

sntgluca opened this issue Jun 8, 2020 · 4 comments

Comments

@sntgluca
Copy link

sntgluca commented Jun 8, 2020

Dear all,
I am walking the first steps with singularity, and I have a use case I am not able to handle.

I am supporting a complex Jupyter environment with a Jupyter server and several backend kernels to connect to. Each component is a separate (conda) environment.
The Jupyter server starts one or more backend kernels on demand.

I am evaluating rebuilding the individual parts as containers.
For this to work I wish to run singularity from the Jupyter container:

shell --singularity--> jupyter container --singularity--> kernel container

Unfortunately I am always having issues with suid when trying to run singularity exec from the first container

Singularity> singularity exec <container> ls
ERROR : Failed to set effective UID to 0

or

Singularity> sudo mount -o remount,suid /
sudo: effective uid is not 0, is /usr/bin/sudo on a file system with the 'nosuid' option set or an NFS file system without root privileges?

May anyone suggest a configuration to mount / or another directory (/opt, /usr/local) with suid, or any other approach to overcome this problem?

Many thanks

Version of Singularity:

What version of Singularity are you using? Run:

$ singularity version
v3.5.2-1.el7.centos

Expected behavior

What did you expect to see when you do...?

I would expect the following command to work from within a container

Singularity> singularity exec <container> ls

Actual behavior

What actually happend? Why was it incorrect?

I experience issues with root permissions and SUID

ERROR : Failed to set effective UID to 0

Steps to reproduce this behavior

How can others reproduce this issue/problem?

AFAIK this applies to any image by default. For instance,

Bootstrap: docker

    From: continuumio/miniconda3

%runscript
    exec "$*"

What OS/distro are you running

$ cat /etc/os-release

NAME="CentOS Linux"
VERSION="7 (Core)"
ID="centos"
ID_LIKE="rhel fedora"
VERSION_ID="7"
PRETTY_NAME="CentOS Linux 7 (Core)"
ANSI_COLOR="0;31"
CPE_NAME="cpe:/o:centos:centos:7"
HOME_URL="https://www.centos.org/"
BUG_REPORT_URL="https://bugs.centos.org/"

CENTOS_MANTISBT_PROJECT="CentOS-7"
CENTOS_MANTISBT_PROJECT_VERSION="7"
REDHAT_SUPPORT_PRODUCT="centos"
REDHAT_SUPPORT_PRODUCT_VERSION="7"
@DrDaveD
Copy link
Collaborator

DrDaveD commented Jun 8, 2020

Privileged singularity is never going to work inside of a singularity container, because singularity prevents it from happening for security reasons. Is enabling unprivileged user namespaces an option for you, and using a sandbox container (that is, unpacked in a directory tree) for the inner singularity invocation? If so you can run singularity unprivileged inside of another singularity container.

@sntgluca
Copy link
Author

Gosh, I could not follow up for more than 20 days, sorry.
Thank you for the explanation, and suggesting two different ways to get around the issue.
I will try using a sandbox container. It seems the right strategy.

May I ask where I can find detailed documentation about enabling unprivileged user namespaces and/or running singularity unprivileged?

@dtrudg
Copy link
Contributor

dtrudg commented Jun 29, 2020

May I ask where I can find detailed documentation about enabling unprivileged user namespaces and/or running singularity unprivileged?

See: https://sylabs.io/guides/3.5/admin-guide/user_namespace.html

@DrDaveD
Copy link
Collaborator

DrDaveD commented Jun 29, 2020

To be clear, I wasn't suggesting 2 different ways to get around the issue. You need both both unprivileged user namespaces and a sandbox container for the inner invocation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants