unofficial mirror of help-guix@gnu.org 
 help / color / mirror / Atom feed
From: Sebastian Gibb via <help-guix@gnu.org>
To: help-guix@gnu.org
Subject: Unable to run host commands with singularity in a `guix pack -f squashfs` conainer
Date: Thu, 08 Jul 2021 21:29:07 +0200	[thread overview]
Message-ID: <162577254731.334077.10363679869099326954@x1> (raw)

Hi,

I am trying to use `guix pack` to create a reproducible container that could be
used on an HPC. Unfortunately I am not able to schedule jobs from within the
container or run any command from the host system.

The HPC uses Cent OS 8.1. It offers slurm 20.02.5 for job scheduling and
singularity 3.4.2 for virtualisation/own software bundles.

I generated my container as follows:
```
cp $(/usr/local/bin/guix time-machine --commit=c78d6c6 -- pack \
	--relocatable --relocatable \
	--format=squashfs \
	--entry-point=bin/bash \
	--symlink=/bin=bin \
	--symlink=/lib=lib \
	--symlink=/share=share \
	--save-provenance \
    bash coreutils) mwe.squashfs
```

Next I try to use the host's `ssh` or slurms `sinfo`/`sbatch` from within the
container but I got the error `No such file or directory`. Using `ls` or `cat` I
could access these files but I am not able to execute them:

```
SINGULARITY_BIND="/usr" singularity run mwe.squashfs
> /usr/bin/ssh
runscript: /usr/bin/ssh: No such file or directory

> ls /usr/bin/ssh
/usr/bin/ssh

> cat /usr/bin/ssh
ELF>�@($
        @8
...
```

I could workaround the `ssh` problem by putting `openssh-sans-x` into the
`guix pack` command and binding `/etc/group`, `/etc/passwd` and `/var/run` to
my singularity container. But if I include `slurm` I always got an error for
`sinfo`/`sbatch`:
"slurm_partitions: Zero Bytes were transmitted or received"
(maybe I need to bind some more pathes to singularity?)

1. Is there a way to use the host commands from within the singularity/squashfs
container generated by `guix pack`?
2. Or can I bind some more files/directory to my singularity command to get
`slurm` commands working?

By the way: I am not able to modify the PATH variable with `guix pack` generated
containers. It seems that SINGULARITY_PREPEND_PATH/SINGULARITY_APPEND_PATH are
ignored:
```
> SINGULARITY_PREPEND_PATH="/usr/bin" \
    singularity exec container/mwe.squashfs /bin/bash -c 'echo $PATH'
WARNING: passwd file doesn't exist in container, not updating
WARNING: group file doesn't exist in container, not updating
/gnu/store/266jw5fcbygya3fkfbxkaa4yl23hrwci-profile/bin
```

3. How to modify the PATH variable?
(I know I could create a wrapper start script like
`export PATH=$PATH:/usr/bin; /bin/bash` but even than I can't execute
`ssh`/`sinfo`/`sbatch` and other host commands.)

Best wishes,

Sebastian


             reply	other threads:[~2021-07-08 20:43 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-08 19:29 Sebastian Gibb via [this message]
2021-07-15 19:39 ` Unable to run host commands with singularity in a `guix pack -f squashfs` conainer Sebastian Gibb via

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://guix.gnu.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=162577254731.334077.10363679869099326954@x1 \
    --to=help-guix@gnu.org \
    --cc=mail@sebastiangibb.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).