apptainer / singularity

Singularity has been renamed to Apptainer as part of us moving the project to the Linux Foundation. This repo has been persisted as a snapshot right before the changes.
https://github.com/apptainer/apptainer
Other
2.53k stars 424 forks source link

Cannot run post scriptlet when using /bin/sh is a symlink (busybox) #558

Closed hcraT closed 7 years ago

hcraT commented 7 years ago

Hi, when I try to use a boootstrap post script in an image based on alpine that have /bin/sh symlinked to /bin/busybox.

The error is this:

ERROR: Could not run post scriptlet, /bin/sh not found in container

I've digged a bit and pinned down the problem due to line 203 in postbootstrap.sh:

if [ -x "$SINGULARITY_ROOTFS/bin/sh" ]; then

If the line could be changed to:

if [ -x "$SINGULARITY_ROOTFS/bin/sh" -o -L "$SINGULARITY_ROOTFS/bin/sh" ]; then

this could be fixed.

For the record I was able to correctly bootstrap the image anyway with this script:

Bootstrap: docker
From: alpine:3.5

%setup
rm $SINGULARITY_ROOTFS/bin/sh
cat > "$SINGULARITY_ROOTFS/bin/sh" << EOF
#!/bin/busybox sh
exec /bin/busybox sh "\$@"
EOF
chmod 0755 "$SINGULARITY_ROOTFS/bin/sh"

%post
echo "hello world"
gmkurtzer commented 7 years ago

hi @hcraT,

What version of Singularity are you testing with?

Thanks!

hcraT commented 7 years ago

Hi @gmkurtzer, the version is 2.2.1

gmkurtzer commented 7 years ago

Can you test with the development github branch? I think this is fixed, but I would feel better with your confirmation.

Thanks!

hcraT commented 7 years ago

Hi @gmkurtzer, I've tested the development version and it works ok.

Thanks!

gmkurtzer commented 7 years ago

Excellent, thanks for letting me know!