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.54k stars 426 forks source link

container creation failed: hook function returns error #4302

Closed pavaninguva closed 5 years ago

pavaninguva commented 5 years ago

Version of Singularity:

3.3.0

Expected behavior

Just installed singularity locally on Ubuntu 18.04 LTS on windows. Able to build containers from docker fine

Cloned the github repo and followed the commands given on the documentation

./mconfig && \
    make -C ./builddir && \
    sudo make -C ./builddir install
singularity build lolcow.sif docker.io/godlovedc/lowcow

Expected behaviour after installation when running singularity exec lolcow.sif cowsay moo would be the standard output

Actual behavior

Immediately after installation, running singularity exec lolcow.sif cowsay moo for the first time:

WARNING: failed to set O_CLOEXEC flags on image
FATAL:   container creation failed: hook function for tag sessiondir returns error: failed to create /usr/local/var/singularity/mnt/session/rootfs directory: mkdir /usr/local/var/singularity/mnt/session/rootfs: permission denied

2nd time, I ran sudo singularity exec lolcow.sif cowsay moo:

WARNING: failed to set O_CLOEXEC flags on image
FATAL:   container creation failed: mount /proc/self/fd/3->/usr/local/var/singularity/mnt/session/rootfs error: can't mount image /proc/self/fd/3: failed to find loop device: could not attach image file to loop device: no loop devices available

3rd time:

WARNING: failed to set O_CLOEXEC flags on image
FATAL:   container creation failed: hook function for tag sessiondir returns error: failed to create /usr/local/var/singularity/mnt/session/rootfs directory: mkdir /usr/local/var/singularity/mnt/session/rootfs: file exists

Steps to reproduce behavior

singularity installation

git clone https://github.com/sylabs/singularity.git && \
    cd singularity && \
    git checkout v3.3.0

./mconfig && \
    make -C ./builddir && \
    sudo make -C ./builddir install

running lolcow

[sudo] singularity exec lolcow.sif cowsay moo
cclerget commented 5 years ago

Hi @pavaninguva , not sure you installed it in a VM or using WSL ?

pavaninguva commented 5 years ago

Hi @cclerget So sorry for the lack of clarity. Im running the ubuntu distro on WSL. Hope that helps! Thank you!

cclerget commented 5 years ago

Ok Singularity can't work with WSL1 (same for docker or other container runtimes), and looks like you are using WSL1 based on your first post. IIRC Singularity doesn't work actually with WSL2 but it's just because the default kernel doesn't provide the squashfs module

pavaninguva commented 5 years ago

Ah yea! I saw the various threads about wsl1 and containerisation and squashfs and wsl2. Thanks for that info! Really helps clarify things. So besides either running a pure linux machine or finding a suitable remote workstation, are there any hacks that could be done in the interim?

jscook2345 commented 5 years ago

@pavaninguva At the moment we do not work with WSL1. Once WSL2 includes the sqaushfs kernel module there will be more time to take look. We'll try to keep the docs up to date as support changes there. Thanks!