LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Slackware (https://www.linuxquestions.org/questions/slackware-14/)
-   -   Changing File Descriptor Limits on Slackware 14.2 (https://www.linuxquestions.org/questions/slackware-14/changing-file-descriptor-limits-on-slackware-14-2-a-4175648485/)

dalacor 02-17-2019 05:47 AM

Changing File Descriptor Limits on Slackware 14.2
 
My main question is about changing the hard and soft limits for file descriptors, but I have a couple of other questions as well.

File descriptors issue - so need to change hard and soft limits

According to Slackware Resource Limits

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.

Thank you for any help gratefully received.

teoberi 02-18-2019 12:04 AM

Quote:

My main question is about changing the hard and soft limits for file descriptors, ...
Slackware-current:
Code:

cp /usr/doc/sysvinit-2.93/initscript.sample /etc/initscript
For Squid I use:
Code:

ulimit -Sn 2048
ulimit -Hn 4096

Quote:

Most reliable File System
I've been using ext4 for some years and did not have any boot problems yet.

coralfang 02-18-2019 01:19 AM

Quote:

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>


ehartman 02-18-2019 07:03 AM

Quote:

Originally Posted by coralfang (Post 5963471)
You can set ulimits system-wide using sysctl;

This is Slackware the OP is talking about (it is even in the subject line) so:
no systemd and no sysctl, your advice is not applicable.

abga 02-18-2019 07:57 AM

Quote:

Originally Posted by ehartman (Post 5963551)
This is Slackware the OP is talking about (it is even in the subject line) so:
no systemd and no sysctl, your advice is not applicable.

You can create /etc/sysctl.conf in Slackware and put your configuration there, then, for the current session, run:
Code:

/sbin/sysctl -e -p /etc/sysctl.conf
On the next boot /etc/sysctl.conf will be used automatically.

bassmadrigal 02-18-2019 10:38 AM

Quote:

Originally Posted by ehartman (Post 5963551)
This is Slackware the OP is talking about (it is even in the subject line) so:
no systemd and no sysctl, your advice is not applicable.

sysctl is not related to systemd. It is part of the procps-ng package and is included with Slackware.

dalacor 02-18-2019 12:11 PM

Quote:

Originally Posted by teoberi (Post 5963458)
Slackware-current:
Code:

cp /usr/doc/sysvinit-2.93/initscript.sample /etc/initscript
For Squid I use:
Code:

ulimit -Sn 2048
ulimit -Hn 4096

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.

dalacor 02-18-2019 12:17 PM

Quote:

Originally Posted by coralfang (Post 5963471)
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.

dalacor 02-18-2019 12:20 PM

Quote:

Originally Posted by abga (Post 5963569)
You can create /etc/sysctl.conf in Slackware and put your configuration there, then, for the current session, run:
Code:

/sbin/sysctl -e -p /etc/sysctl.conf
On the next boot /etc/sysctl.conf will be used automatically.

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?

dalacor 02-18-2019 12:31 PM

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.

coralfang 02-18-2019 12:40 PM

Quote:

Originally Posted by ehartman (Post 5963551)
This is Slackware the OP is talking about (it is even in the subject line) so:
no systemd and no sysctl, your advice is not applicable.

Yes, i am running slackware... and sysctl has been around long before systemd (and has nothing to do with systemd!)

coralfang 02-18-2019 12:46 PM

Quote:

Originally Posted by dalacor (Post 5963659)
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

slacktroll 02-18-2019 12:53 PM

Quoting myself:

Create /etc/initscript

This is what the file should look like

/etc/initscript
Code:

ulimit -Hn 1048576
eval exec "$4"


bassmadrigal 02-18-2019 01:05 PM

Quote:

Originally Posted by dalacor (Post 5963659)
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.

dalacor 02-18-2019 01:14 PM

Quote:

Originally Posted by bassmadrigal (Post 5963678)
/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


All times are GMT -5. The time now is 03:45 PM.