1

While compiling peridigm, I am facing the following error.

/usr/bin/ld: cannot find /usr/local/bin/trilinos-12.12.1/lib/libgaleri-xpetra.a: Too many open files
/usr/bin/ld: cannot find /usr/local/bin/trilinos-12.12.1/lib/libgaleri-epetra.a: Too many open files
/usr/bin/ld: cannot find /usr/local/bin/trilinos-12.12.1/lib/libaztecoo.a: Too many open files
/usr/bin/ld: cannot find /usr/local/bin/trilinos-12.12.1/lib/libisorropia.a: Too many open files
.
.
.
/usr/bin/ld: cannot find /usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/crtn.o: Too many open files
collect2: error: ld returned 1 exit status
src/io/mesh_input/quick_grid/unit_test/CMakeFiles/ut_QuickGrid_solidCylinder_np1.dir/build.make:1465: recipe for target 'src/io/mesh_input/quick_grid/unit_test/ut_QuickGrid_solidCylinder_np1' failed
make[2]: *** [src/io/mesh_input/quick_grid/unit_test/ut_QuickGrid_solidCylinder_np1] Error 1
CMakeFiles/Makefile2:1009: recipe for target 'src/io/mesh_input/quick_grid/unit_test/CMakeFiles/ut_QuickGrid_solidCylinder_np1.dir/all' failed
make[1]: *** [src/io/mesh_input/quick_grid/unit_test/CMakeFiles/ut_QuickGrid_solidCylinder_np1.dir/all] Error 2
.
.
[ 58%] Linking CXX static library libPeridigmLib.a
[ 58%] Built target PeridigmLib
Makefile:138: recipe for target 'all' failed
make: *** [all] Error 2

I used the instructions in link to increase the soft and hard limit of the processes by using the following:

#@student        -       maxlogins       4
  • hard nofile 97816
  • soft nofile 97816

session required pam_limits.so

End of file

However, even after restarting the wsl terminal after updating the limit.conf file as instructed in the link, the ulimit -n still shows 1024 instead of the modified value. Why is it not changing? Any advice?

I am using Windows Subsystem for Linux Ubuntu 16.04.

rcty
  • 111

2 Answers2

4

/etc/security/limits.conf is a PAM construct. Normally PAM would process this during your user login in a "normal" Linux, but ... you don't really "log in" in WSL, so PAM doesn't get called.

The workaround, as described later that same Github thread is to run sudo su $USER, sudo su - $USER, or something along those lines (see the thread for other suggestions). The resulting shell will have processed limits.conf through PAM, and you should be able to raise the limits there as expected (ulimit -n 97816, it sounds like from your question). As long as peridigm's build stays in that subshell, you will hopefully be okay.

Clearly, this isn't ideal, but hopefully it gets you past this hurdle.

NotTheDr01ds
  • 17,888
  • 1
    Can confirm that sudo su $USER worked with WSL2 and Ubuntu. Was having this issue with node js with error EMFILE: too many open files – eemilk Jul 31 '23 at 10:11
0

Just use sudo su $USER --shell /bin/bash --command "ulimit -n"

Eugene W.
  • 101