apptainer / apptainer

Apptainer: Application containers for Linux
https://apptainer.org
Other
955 stars 120 forks source link

Fusemount option does not work with fuse-zip #2191

Closed jackerschott closed 1 month ago

jackerschott commented 1 month ago

Version of Apptainer

1.2.5

Expected behavior

I have a program which I need to run (about 100 times in parallel) in apptainer that creates a massive output directory with around 80000 files and 10GB disk space. For me, the number of files is the biggest bottleneck so I want to mount one host file instead as a directory and write to that directory within the container in a way such that the file on the host grows dynamically. My solution now was to use fuse-zip, such that I still have easy access to the programs output, but can also run it without creating way to many temporary files on the physical disk. So what I tried is

apptainer --fusemount "container:fuse-zip <path-to-zip-on-host> <path-to-mountpoint-on-host>" container.sif

<path-to-zip> and <path-to-mountpoint-on-host> are both paths to the directory I run apptainer in, which is mounted as the home directory, so they exist as the same paths in the container. I also verified that fuse-zip is installed in the container and that it exists as a binary.

Actual behavior

I obtain the following error:

fusermount: mountpoint /dev/fuse is not a directory or a regular file

It seems like the actual command that is executed is

fuse-zip <path-to-zip-on-host> /dev/fd/3

where file descriptor 3 points to /dev/fuse which fuse-zip is expected to read the mountpoint from, which it can't do. Note that this works without problems if I try to use --fusemount with sshfs as described in the apptainer docs.

Steps to reproduce this behavior

I did test this with multiple containers, hence I'm assuming this will be sufficient: Create any (ubuntu-based) singularity container, install fuse-zip in it, create a zip file and an empty directory and run the above command.

What OS/distro are you running

Tested on Arch Linux and Rocky Linux 8.9.

How did you install Apptainer

From the Arch repository.

DrDaveD commented 1 month ago

I never heard of fuse-zip but see it is in EPEL. I installed it, and it is linked with libfuse2. That's the problem. The --fusemount option requires a fuse program linked with libfuse3.

I suggest instead using mksquashfs to make a squashfs file and mounting it with /usr/libexec/apptainer/bin/squashfuse_ll.

jackerschott commented 1 month ago

Ah I see, so there is no way to get this to work I guess. Thanks for the suggestion, unfortunately squashfs is readonly so I don't think it will work for my application.

DrDaveD commented 1 month ago

fuse-zip isn't read only? If you need read-write then use /usr/libexec/apptainer/bin/fuse2fs with apptainer-1.3.0. That is patched to use libfuse3. In fact with that you can just use --bind image-src instead of --fusemount.