WelcomeWelcome | FAQFAQ | DownloadsDownloads | WikiWiki

Author Topic: How to increase the max # of open file descriptors?  (Read 7028 times)

Offline qopit

  • Jr. Member
  • **
  • Posts: 81
How to increase the max # of open file descriptors?
« on: May 02, 2012, 01:00:59 PM »
How do you increase the hard limit on the maximum number of open file descriptors in Core?  Right now the hard limit is 4096 for me.  Where is this being set?

On other systems I've been able to adjust /etc/security/limits.conf, but that seems to be a "pam" thing, which is not in use with Core, and I don't see a pam extension (nor am I sure I want one).

With ulimit being a shell thing, I've been looking into busybox, but no luck so far.  Same goes for pam, which is a new thing for me.

Code: [Select]
tc@box:~$ cat /proc/sys/fs/file-max
50644
tc@box:~$ ulimit -Hn
4096
tc@box:~$ ulimit -Sn 4096
tc@box:~$ ulimit -n
4096

Offline curaga

  • Administrator
  • Hero Member
  • *****
  • Posts: 11044
Re: How to increase the max # of open file descriptors?
« Reply #1 on: May 02, 2012, 01:17:31 PM »
No support for a limits file in busybox, based on a quick look. The 4096 is a linux default, likely.

Only root can raise the limits, so if you need higher, set them as root and then switch user (su tc).
The only barriers that can stop you are the ones you create yourself.

Offline Rich

  • Administrator
  • Hero Member
  • *****
  • Posts: 11619
Re: How to increase the max # of open file descriptors?
« Reply #2 on: May 02, 2012, 01:47:20 PM »
Hi qopit
Don't know if this helps, but there is an extension called   Linux-PAM.tcz   and under the  Files  tab in AppBrowser it lists:
Quote
usr/local/etc/security/limits.conf

Offline qopit

  • Jr. Member
  • **
  • Posts: 81
Re: How to increase the max # of open file descriptors?
« Reply #3 on: May 03, 2012, 01:58:57 AM »
Curaga: thanks!  I hadn't considered that root could change the hard limits and they would stick on an su.  Even the soft limit/setpoint carries through...

Code: [Select]
tc@box:~$ ulimit -Hn
4096
tc@box:~$ sudo su
root@box:~# ulimit -Hn 10000
root@box:~# ulimit -Sn 10000
root@box:~# su tc
tc@box:~$ ulimit -Sn
10000

For anyone else looking for this, this is very convenient for adding to bootlocal.sh (which runs with root privs) to run an application with more than 4096 possible open file descriptors.  Something like this works perfectly:

Code: [Select]
ulimit -Hn 65535
ulimit -Sn 65535
su -c "some_program" tc

Also, Rich: thanks for the PAM link... I feel like an idiot not finding it. :(

Offline Rich

  • Administrator
  • Hero Member
  • *****
  • Posts: 11619
Re: How to increase the max # of open file descriptors?
« Reply #4 on: May 03, 2012, 02:19:37 AM »
Hi qopit
Changing the Search option to Provides in AppBrowser and entering  pam  in the search field finds it quickly.

Offline qopit

  • Jr. Member
  • **
  • Posts: 81
Re: How to increase the max # of open file descriptors?
« Reply #5 on: May 03, 2012, 09:11:58 AM »
Rich: Big thanks for that, too... I didn't know ab had that "Provides" option either.  Now that I see provides.sh behind it, I'll definitely be using that more!

This is probably a consequence of me never using anything other than MicroCore/Core... I expect that the existence of the "provides" option is more prominent in the GUI version.  That's my excuse and I'm sticking to it.