How to the address the "Too many open files" issue?

This problem was reported in issue #6007 (currently closed). The solution given involves the concept of “sandboxes” and seems to apply to share environments. I am simply creating ad hoc environments for a single user.

I started using Nix a few weeks ago and if at first this wasn’t much of a problem, as the environments I need require larger number of packages I am hitting it all the time. Any environment with more than 3 or 4 packages usually fails with this error.

I already increased the limit to open files, but the issue remains. Sounds like some sort of “leak” is at play.

$ ulimit -u
62155
$ ulimit -n
2048

Any strategies to work around this problem? Thank you.

Update: This problem is prevalent with the latest unstable release:

$ nix --version
nix (Nix) 2.25.0pre20240807_cfe66dbe

$ nix-shell -p pandoc haskellPackages.pandoc-crossref pandoc-include librsvg texliveFull
[...]
error: creating pipe: Too many open files

As explained at the GitHub issue thread, this problem was solved in a pull request merged into version 2.24.5. The challenge for a novice user like me was to get a particular Nix version installed.

Over the weekend a friend that is proficient with Nix suggested me to install the software from zero-to-nix. From that website I got precisely version 2.24.5, and indeed the “too many open files” is done with.

1 Like