How to mount /run/shm as a tmpfs file system in a container

572 views
Skip to first unread message

Ivan Raikov

unread,
Jul 11, 2016, 5:03:40 PM7/11/16
to singularity
Hello,

   I am a new user of Singularity, and I just realized that several applications I wish to run require the creation of temporary files in /run/shm and /run/lock.
For instance, the Python multiprocessing library cannot create semaphores if /dev/shm (symlinked to /run/shm in recent distros) is not mounted.
As far as I can tell, these are not mounted as tmpfs filesystems in the default Debian configuration. I was wondering if this is by design,
and what would be the appropriate workaround/solution. Thanks and best regards,

  -Ivan Raikov

Gregory M. Kurtzer

unread,
Jul 11, 2016, 8:30:06 PM7/11/16
to singularity
Hi Ivan,

There are several ways to handle this depending on your goal. If you want /run to be isolated from the host system, I would recommend just creating /run inside your container, and create the necessary directories and links that your application will require. But if you don't mind the blur between host and container, I would recommend adding /run to the bind path in host's singularity.conf.

Let me know how that works for you!

Greg

--
You received this message because you are subscribed to the Google Groups "singularity" group.
To unsubscribe from this group and stop receiving emails from it, send an email to singularity...@lbl.gov.



--
Gregory M. Kurtzer
High Performance Computing Services (HPCS)
University of California
Lawrence Berkeley National Laboratory
One Cyclotron Road, Berkeley, CA 94720

Ivan Raikov

unread,
Jul 11, 2016, 10:47:08 PM7/11/16
to singularity
Hi Greg,

   Thanks for your reply. If I go with option 1, does that mean I will always have to run the container with the --writable option? Unfortunately my only use case for Singularity at the moment is to run it on an HPC cluster as a regular user. Or I am completely misunderstanding your suggestion? Thanks,

  -Ivan

Gregory M. Kurtzer

unread,
Jul 11, 2016, 11:04:59 PM7/11/16
to singularity
Hi Ivan,

Yes you are 100% correct about that. So I would recommend using the bind path directive in the config file to point at /run. That way you can use the host's /run directory which has other benefits (well,.. not for HPC but other factors e.g. audio support) haha.

Does that option seem reasonable to you? If not, I'm open to other ideas if something special needs to be coded in (e.g. mount /run as a tmpfs on container invocation).

Thanks!

Ivan Raikov

unread,
Jul 11, 2016, 11:26:32 PM7/11/16
to singularity
Hi Greg,

   Thanks, I will ask the administrator of my university's HPC cluster if they can add a bind directive for /run. If not, then perhaps it will be necessary to mount /run with tmpfs, but let me try using bind first. Thanks for your help,

  -Ivan

Gregory M. Kurtzer

unread,
Jul 11, 2016, 11:49:34 PM7/11/16
to singularity
Do you know what version of Singularity they are running?

If it is 2.0, they will need to upgrade to the very soon to be released 2.1. If it is a 2.1 pre-release, have them check /etc/singularity/singularity.conf and add a line that says "bind path = /run"

Hope that helps!

Greg

Ivan Raikov

unread,
Jul 11, 2016, 11:56:51 PM7/11/16
to singularity
Oh thanks for pointing this out, it looks like they have installed 2.0, so perhaps we will have to wait for the 2.1 release.

  -Ivan
Reply all
Reply to author
Forward
0 new messages