Skip to content

feat: accommodate missing /run/user dir in OCI mode #3402

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

Merged
merged 1 commit into from
Nov 21, 2024

Conversation

dtrudg
Copy link
Member

@dtrudg dtrudg commented Nov 20, 2024

Description of the Pull Request (PR):

On systems where pam-systemd is disabled, or there is other configuration preventing the creation of a /run/user/ directory, we need to use a different location for the OCI runtime state.

Change the runtimeStateDir handling to:

  • Use XDG_RUNTIME_DIR if set.
  • Otherwise, try to use /run/user/.
  • Otherwise, use a location under $TMPDIR.

This fixes or addresses the following GitHub issues:

Before submitting a PR, make sure you have done the following:

@dtrudg dtrudg force-pushed the issue-3393 branch 2 times, most recently from 41e2441 to fe8fe93 Compare November 20, 2024 14:17
@dtrudg dtrudg marked this pull request as ready for review November 20, 2024 14:31
@nathanweeks
Copy link

Seems to work as advertised in my environment (with no /run/user/$UID directory)

$ mkdir /tmp/run
$ export XDG_RUNTIME_DIR=/tmp/run
$ singularity exec --oci test.oci-sif grep PRETTY_NAME /etc/os-release
INFO:    System configuration does not support cgroup management - starting container in current cgroup
PRETTY_NAME="Ubuntu 24.04.1 LTS"
$ unset XDG_RUNTIME_DIR
$ mkdir /tmp/foo
$ export TMPDIR=/tmp/foo
$ singularity exec --oci test.oci-sif grep PRETTY_NAME /etc/os-release
INFO:    System configuration does not support cgroup management - starting container in current cgroup
INFO:    No /run/user session directory for user. Using "/tmp/foo/singularity-oci-1000" for runtime state.
PRETTY_NAME="Ubuntu 24.04.1 LTS"
$ unset TMPDIR
$ singularity exec --oci test.oci-sif grep PRETTY_NAME /etc/os-release
INFO:    System configuration does not support cgroup management - starting container in current cgroup
INFO:    No /run/user session directory for user. Using "/tmp/singularity-oci-1000" for runtime state.
PRETTY_NAME="Ubuntu 24.04.1 LTS"

On systems where `pam-systemd` is disabled, or there is other
configuration preventing the creation of a /run/user/<uid> directory, we
need to use a different location for the OCI runtime state.

Change the runtimeStateDir handling to:

* Use XDG_RUNTIME_DIR if set.
* Otherwise, try to use /run/user/<uid>.
* Otherwise, use a location under $TMPDIR.

Fixes sylabs#3393
@dtrudg dtrudg merged commit 011eeab into sylabs:main Nov 21, 2024
1 check passed
@dtrudg dtrudg deleted the issue-3393 branch November 21, 2024 14:59
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

Successfully merging this pull request may close these issues.

singularity exec --oci fails on node without /run/user/<uid> directory
3 participants