[SOLVED] Changing File Descriptor Limits on Slackware 14.2
SlackwareThis Forum is for the discussion of Slackware Linux.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
I need to create an initscript file within the /etc folder and input
Code:
# Increase the hardlimit for open files
ulimit -Hn 4096
but I cannot find out exactly which file in which directory to put in the Software Limit which is the one I really need to raise.
I am using E2guardian which is a filtering software based on Dansguardian. So it runs as an Mdaemon Service. So I don't know if it uses shell/bash or whatever as nobody is ever logged in. I need to be able to switch on the computer and boot Slackware and have E2guardian use the new software limit without logging into a shell.
What is the recommended Hardware and Software limits for a modern system as 1024 is ridiculously low. E2guardian or Squid is always running out of file descriptors because of this 1024 limit.
Is there anything else that I need to do besides raise hardware limit in initscript file and software limit in whatever file I am supposed to do this in. Do I need to do anything with the kernel for example?
Time stamp
I have noticed that some programs on Slackware are not using daylight saving so are always an hour off. Is there a way to force all programs to use the correct time. When I do date in Slackware, it shows the correct time but e2guardian logs show the wrong hour.
Most reliable File System
I use ReiserFS because I believe that this is the most reliable system in the event of a powercut. However, I have noticed on more than one occasion that I have had to re-install Slackware because Slackware would not boot (presumably after a power cut) or we have issues with running out of file descriptors despite the fact that nothing seems to be using up the file descriptors so I think that something went wonky after a power cut.
What is the recommended Hardware and Software limits for a modern system as 1024 is ridiculously low. E2guardian or Squid is always running out of file descriptors because of this 1024 limit.
You can set ulimits system-wide using sysctl; /etc/sysctl.d/raise-file-descriptors.conf
Code:
fs.file-max = 2097152
You can also set ulimits inside /etc/login.defs
Code:
<snip>
#
# Login configuration initializations:
#
# ERASECHAR Terminal ERASE character ('\010' = backspace).
# KILLCHAR Terminal KILL character ('\025' = CTRL/U).
# ULIMIT Default "ulimit" value.
#
# The ERASECHAR and KILLCHAR are used only on System V machines.
# The ULIMIT is used only if the system supports it.
# (now it works with setrlimit too; ulimit is in 512-byte units)
#
# Prefix these values with "0" to get octal, "0x" to get hexadecimal.
#
ERASECHAR 0177
KILLCHAR 025
ULIMIT 2097152
</snip>
I've been using ext4 for some years and did not have any boot problems yet.
I will try the system using ext4 and see how that goes.
Are you saying that ulimit -Sn 2048 should go in the initscript file? I was under the impression that file was only for setting the hard limit?
I don't have an initscript.sample file in the location mentioned. Only README, Install and a sysvinit-2.86.lsm file so maybe I need to install initscript. I will give it a go tomorrow and see how it goes. Thank you.
You can set ulimits system-wide using sysctl; /etc/sysctl.d/raise-file-descriptors.conf
Code:
fs.file-max = 2097152
Apparently my sytem-wide limit is currently 388748. Do I need to upgrade this. I only run E2guardian and Squid on these boxes and currently the issue is the software limit of 1024 which is way less than the system wide limit. I am actually going to be getting rid of Squid as the new version of E2guardian no longer requires Squid.
What I will do first is fix the hard and soft limit for each user which is the current problem and then I will see what the system wide file descriptor usage is on a machine humming away. If I need to adjust this, I will do that too. Thank you.
Apparently my version of Slackware has the initscript.sample file in the sbin folder. I am not running current. I am running version 14.2. However on the new system, I will be updating to current as I need to update a number of things to get certificates to work properly in E2guardian. So maybe this will change after I upgrade to Current.
What's the difference between having a sysctl.conf file in the /etc directory and having /etc/sysctl.d/raise-file-descriptors.conf
Does sysctl not look in the sysctl.d directory for scripts to run?
There is no difference, other than `sysctl -p` will only try to read /etc/sysctl.conf
From `man sysctl`;
Code:
--system
Load settings from all system configuration files. Files are read from directories in the
following list in given order from top to bottom. Once a file of a given filename is
loaded, any file of the same name in subsequent directories is ignored.
/run/sysctl.d/*.conf
/etc/sysctl.d/*.conf
/usr/local/lib/sysctl.d/*.conf
/usr/lib/sysctl.d/*.conf
/lib/sysctl.d/*.conf
/etc/sysctl.conf
The command; `/sbin/sysctl -e --system` is run at boot from within /etc/rc.d/rc.S
What's the difference between having a sysctl.conf file in the /etc directory and having /etc/sysctl.d/raise-file-descriptors.conf
Does sysctl not look in the sysctl.d directory for scripts to run?
/etc/sysctl.conf is an older style where everything was contained in one conf file. Most things like this have switched from a single conf file to a directory where you can put in individual files ending in .conf and name them based on what they do. This way, if you need to modify something, you can easily find the conf file and adjust it.
A prime example of this style is /etc/profile.d/. We could have everything in a massive profile script (which /etc/profile is still used, but this does help simplify it), but if you break things out into individual files, it can help you maintain them.
For a semi-unrelated note, /etc/sysctl.conf has been deprecated in systemd, but still works with procps-ng that we use in Slackware.
/etc/sysctl.conf is an older style where everything was contained in one conf file. Most things like this have switched from a single conf file to a directory where you can put in individual files ending in .conf and name them based on what they do. This way, if you need to modify something, you can easily find the conf file and adjust it.
A prime example of this style is /etc/profile.d/. We could have everything in a massive profile script (which /etc/profile is still used, but this does help simplify it), but if you break things out into individual files, it can help you maintain them.
For a semi-unrelated note, /etc/sysctl.conf has been deprecated in systemd, but still works with procps-ng that we use in Slackware.
Yes, this was my thinking exactly. It makes sense to have different conf files within the sysctl.d folder. I have used this concept elsewhere in Slackware, so I will stick with that so it's consistent. Thanks
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.