Skip to content

Nested Singularity: failed to add as session directory #3217

@deliciouslytyped

Description

@deliciouslytyped
> singularity --version
singularity-ce version 4.1.1

xposted from https://stackoverflow.com/questions/67451148/failed-to-add-as-session-directory-path-is-not-an-absolute-path-in-singularit/78883567#78883567

For me this appears to have happened because I was trying to invoke Singularity in Singularity, where somehow my outer UID/GID was leaking in through wherever Singularity is looking it up from, and presumably was not finding an entry corresponding to the user in /etc/passwd; specifically the error message indicates that something that looks like it should be a directory - is empty (note the two consecutive spaces in add as).

My invocation:

Singularity> singularity shell --fakeroot --userns something.sif
WARNING: Could not lookup the current user's information: user: unknown userid 12345
INFO:    Mounting image with FUSE.
WARNING: squashfuse mount failed, falling back to extraction: use of image "/root/something.sif" as overlay requires fusermount to be installed: exec: "fusermount": executable file not found in $PATH
INFO:    Converting SIF file to temporary sandbox...
INFO:    Cleaning up image...
FATAL:   container creation failed: failed to add  as session directory: path . is not an absolute path

Once I added something like sing:x:12345:12345:Ubuntu:/home/sing:/bin/bash despite not actually using this for anything inside the container, it succeeds:

Singularity> singularity shell --fakeroot --userns something.sif
INFO:    Mounting image with FUSE.
WARNING: squashfuse mount failed, falling back to extraction: use of image "/root/something.sif" as overlay requires fusermount to be installed: exec: "fusermount": executable file not found in $PATH
INFO:    Converting SIF file to temporary sandbox...
Singularity> 
Speculation:

I searched the --debug output for "direc" (as in "directory"), and ran across the following, which is what prompted me to try passwd, knowing from observation that Singularity normally appears to mount the users home directory somewhere;

...
DEBUG   [U=0,P=3034357]    addHomeMount()                Skipping home directory mount by user request.
...
DEBUG   [U=0,P=3034878]    prepareAutofs()               Could not keep file descriptor for home directory /root: no mount point
DEBUG   [U=0,P=3034878]    prepareAutofs()               Could not keep file descriptor for current working directory /root: no mount point
..

Perpaps stuff like #1822 is related.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions