Closed WKabza closed 4 years ago
What does your %runscript
section look like? Do you get the same error with singularity exec
?
What does your
%runscript
section look like? Do you get the same error withsingularity exec
?
I am having the same error with singularity exec
/.singularity.d/actions/exec: exec: line 21: Delly_script.sh: not found
I have not defined a runscript and I was importing a Docker container.
The script is in the same place as my container.
# Recipe
Bootstrap: docker
From: dellytools/delly
%runscript
singularity exec Delly.simg/ Delly_script.sh
.
isn't in the PATH ... try putting ./Delly_script.sh
(or full path) instead of just the name of the script.
I just built that image with the following definition file:
$ cat delly.def
# Recipe
Bootstrap: docker
From: dellytools/delly
And ran the following:
$ /usr/local/singularity/3.5.3/bin/singularity exec delly.sif ./delly_script.sh
Hello world from ./delly_script.sh running in delly.sif
The delly_script.sh
file looks like:
#!/bin/sh
echo "Hello world from $0 running in ${SINGULARITY_NAME}"
The delly_script.sh
is in my working directory and gets bind mounted in (current working directory mount). Where is your Delly_script.sh
file at? run
also works because of how the default runscript is created on this container:
$ /usr/local/singularity/3.5.3/bin/singularity run delly.sif ./delly_script.sh
Hello world from ./delly_script.sh running in delly.sif
.
isn't in the PATH ... try putting./Delly_script.sh
(or full path) instead of just the name of the script.I just built that image with the following definition file:
$ cat delly.def # Recipe Bootstrap: docker From: dellytools/delly
And ran the following:
$ /usr/local/singularity/3.5.3/bin/singularity exec delly.sif ./delly_script.sh Hello world from ./delly_script.sh running in delly.sif
The
delly_script.sh
file looks like:#!/bin/sh echo "Hello world from $0 running in ${SINGULARITY_NAME}"
The
delly_script.sh
is in my working directory and gets bind mounted in (current working directory mount). Where is yourDelly_script.sh
file at?run
also works because of how the default runscript is created on this container:$ /usr/local/singularity/3.5.3/bin/singularity run delly.sif ./delly_script.sh Hello world from ./delly_script.sh running in delly.sif
I forgot to mention that I am trying to run this script with bash, not dash
#!/bin/bash
I am having this problem when running with bash:
/.singularity.d/actions/exec: exec: line 21: Delly_script.sh: not found
and this problem when running with dash sh
Delly_script.sh: line 13: syntax error: unexpected "("
Of course I get the case that other interpreter (in this case dash) does not support arrays as Bash does.
Can you try run your script with #!/bin/bash
interpreter, please?
Also
.
isn't in the PATH ... try putting./Delly_script.sh
(or full path) instead of just the name of the script.
this didn't work :(
Bash isn't in the container image... The delly base image is alpine which has a busybox root. /bin/sh
in the image points to busybox
which IIRC is an ash
shell.
Singularity> delly -v
delly -v
Delly version: v0.8.3
using Boost: v1.65.1
using HTSlib: v1.10.2
Singularity> ls -l /bin/sh
ls -l /bin/sh
lrwxrwxrwx 1 root root 12 May 29 09:20 /bin/sh -> /bin/busybox
I think in a %post
section you need to do something like:
apk update
apk add bash
But I haven't used Alpine / apk much, so that's a guess....
Thank you for this information! That was very helpful to understand.
Also I have checked what interpreters are on my server
cat /etc/shells
/bin/sh
/bin/bash
/sbin/nologin
/usr/bin/sh
/usr/bin/bash
/usr/sbin/nologin
/bin/ksh
/bin/rksh
/bin/tcsh
/bin/csh
/bin/zsh
bash --version
GNU bash, version 4.2.46(2)-release (x86_64-redhat-linux-gnu)
Copyright (C) 2011 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
and tried:
singularity run --writable Delly.simg/ apk add --no-cache bash
but I have this error:
fetch http://dl-cdn.alpinelinux.org/alpine/v3.12/main/x86_64/APKINDEX.tar.gz
fetch http://dl-cdn.alpinelinux.org/alpine/v3.12/community/x86_64/APKINDEX.tar.gz
10 errors; 8 MiB in 18 packages
Maybe that deserves a new issue to make on forum.
singularity run --writable Delly.simg/ apk add --no-cache bash
Use sudo
.... I'm assuming the image was created as root, so you would have root owned files. I'm not sure if apk
can be ran as a non-root user, or if it may fail.
singularity run --writable Delly.simg/ apk add --no-cache bash
Use
sudo
.... I'm assuming the image was created as root, so you would have root owned files. I'm not sure ifapk
can be ran as a non-root user, or if it may fail.
I have not use sudo
command because from the beginning I am having problem with it
sudo: singularity: command not found
In the /etc/sudoers file, the secure_path
value is probably set and doesn't have the path to the singularity binary in it.
Eventually my problem was not solved because I got information that users of my server are not allowed to use sudo
command and probably this is the cause I can't add bash to my container. Nonetheless all those information here were very helpful for me, thank you!!
Bootstrap: docker From: dellytools/delly
%runscript singularity exec Delly.simg/ Delly_script.sh
change the content of %runscript into: exec /path/to/Delly_script.sh
Version of Singularity:
3.5.3
Expected behavior
I am trying to run a bash script using a container within singularity
singularity run Delly.simg Delly_script.sh
Actual behavior
/.singularity.d/runscript: exec: line 39: Delly_script.sh: not found
How did you install Singularity
It was already on the server :/