LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices


Reply
  Search this Thread
Old 06-16-2013, 10:16 PM   #1
Z038
Member
 
Registered: Jan 2006
Location: Dallas
Distribution: Slackware
Posts: 912

Rep: Reputation: 174Reputation: 174
How to set open file descriptor hard and soft limits


I have a script ulim.sh in /etc/profile.d that sets my normal unprivileged user account open file descriptors soft limit to 6144. I set it up years ago, but I just noticed that it isn't working anymore. I am not sure when it quit working, but it might have been when I upgraded from 32-bit Slackware 13.37 to 64-bit 14.0 about a month ago.

The /etc/profile.d/ulim.sh script executes "ulimit -Sn 6144". I now get this message when I login:

Code:
-bash: ulimit: open files: cannot modify limit: Invalid argument
Of course I get the same error if I issue the ulimit command directly and specify a soft limit that exceeds the current hard limit of 4096. Apparently the hard limit used to be higher than 4096.

I don't know if the default hard limit changed in 14.0, or if I had increased the hard limit in the past and managed to lose that customization when I did the full install of 64-bit 14.0.

Here are limits as they exist on my system now:

Code:
$ cat /proc/sys/fs/file-max
398972

$ ulimit -Sn
1024

$ ulimit -Hn
4096
I did some searches and found that system-wide limits can be set in /etc/sysctl.conf. I don't have that file, and I never have as far as I know. I also read that per-user/group/process limits can be set in /etc/security/limits.conf, but again, I have never had that file, or even the security subdirectory under /etc.

Where is the default open file descriptor hard limit set in Slackware? Did the default value change between 13.37 and 14.0?
 
Old 06-16-2013, 10:45 PM   #2
guanx
Senior Member
 
Registered: Dec 2008
Posts: 1,177

Rep: Reputation: 235Reputation: 235Reputation: 235
Did you increase the hard limit before increasing the soft limit?
 
Old 06-16-2013, 11:01 PM   #3
Z038
Member
 
Registered: Jan 2006
Location: Dallas
Distribution: Slackware
Posts: 912

Original Poster
Rep: Reputation: 174Reputation: 174
You mean like "ulimit -Hn 10000" or similar? No, that operation isn't permitted for unprivileged users. Unprivileged users can only alter the soft limit up to the value of the hard limit, and can only alter the hard limit down, not up.
 
Old 06-16-2013, 11:37 PM   #4
Z038
Member
 
Registered: Jan 2006
Location: Dallas
Distribution: Slackware
Posts: 912

Original Poster
Rep: Reputation: 174Reputation: 174
Ok, I found it. I had created /sbin/initscript from /sbin/initscript.sample long ago, and updated it to raise the file descriptor hard limit. I dropped that modification when I did the full install from 13.37 to 14.0. I've updated my checklist to make sure I don't lose it again.

One other thing is that the location of initscript changed from 13.37 to 14.0. Up through 13.37 it had to be created in the /sbin directory, but as of 14.0, it has to be in /etc.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Too many file open - How can we define Max limit of file descriptor janeshb Linux - Server 11 09-29-2009 10:41 AM
open local file error when creating file descriptor hellgirl Linux - Newbie 1 09-14-2009 10:03 PM
Can logrotate set limits on archived file size? 0xdefec8 Linux - Server 1 04-05-2008 08:22 PM
getrlimit is setting soft and hard limits to -1, why? FunkMeisterMaz Programming 2 03-22-2004 06:34 AM
How to set timeout value when reading from a file descriptor. George2 Programming 7 10-26-2003 01:15 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware

All times are GMT -5. The time now is 08:46 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration