LinuxQuestions.org
Visit Jeremy's Blog.
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 02-17-2019, 05:47 AM   #1
dalacor
LQ Newbie
 
Registered: Feb 2019
Posts: 24

Rep: Reputation: Disabled
Smile 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.
 
Old 02-18-2019, 12:04 AM   #2
teoberi
Member
 
Registered: Jan 2018
Location: Romania
Distribution: Slackware64-current (servers) / Ubuntu (workstations)
Posts: 76

Rep: Reputation: 18
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.
 
Old 02-18-2019, 01:19 AM   #3
coralfang
Member
 
Registered: Nov 2010
Location: Bristol, UK
Distribution: Slackware, FreeBSD
Posts: 738
Blog Entries: 3

Rep: Reputation: 227Reputation: 227Reputation: 227
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>
 
Old 02-18-2019, 07:03 AM   #4
ehartman
Member
 
Registered: Jul 2007
Location: Delft, The Netherlands
Distribution: Slackware
Posts: 411

Rep: Reputation: 171Reputation: 171
Quote:
Originally Posted by coralfang View Post
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.
 
Old 02-18-2019, 07:57 AM   #5
abga
Member
 
Registered: Jul 2017
Location: EU
Distribution: Slackware
Posts: 950

Rep: Reputation: 493Reputation: 493Reputation: 493Reputation: 493Reputation: 493
Quote:
Originally Posted by ehartman View Post
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.
 
Old 02-18-2019, 10:38 AM   #6
bassmadrigal
LQ Guru
 
Registered: Nov 2003
Location: West Jordan, UT, USA
Distribution: Slackware
Posts: 5,824

Rep: Reputation: 3542Reputation: 3542Reputation: 3542Reputation: 3542Reputation: 3542Reputation: 3542Reputation: 3542Reputation: 3542Reputation: 3542Reputation: 3542Reputation: 3542
Quote:
Originally Posted by ehartman View Post
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.
 
Old 02-18-2019, 12:11 PM   #7
dalacor
LQ Newbie
 
Registered: Feb 2019
Posts: 24

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by teoberi View Post
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.
 
Old 02-18-2019, 12:17 PM   #8
dalacor
LQ Newbie
 
Registered: Feb 2019
Posts: 24

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by coralfang View Post
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.
 
Old 02-18-2019, 12:20 PM   #9
dalacor
LQ Newbie
 
Registered: Feb 2019
Posts: 24

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by abga View Post
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?
 
Old 02-18-2019, 12:31 PM   #10
dalacor
LQ Newbie
 
Registered: Feb 2019
Posts: 24

Original Poster
Rep: Reputation: Disabled
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.
 
Old 02-18-2019, 12:40 PM   #11
coralfang
Member
 
Registered: Nov 2010
Location: Bristol, UK
Distribution: Slackware, FreeBSD
Posts: 738
Blog Entries: 3

Rep: Reputation: 227Reputation: 227Reputation: 227
Quote:
Originally Posted by ehartman View Post
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!)
 
Old 02-18-2019, 12:46 PM   #12
coralfang
Member
 
Registered: Nov 2010
Location: Bristol, UK
Distribution: Slackware, FreeBSD
Posts: 738
Blog Entries: 3

Rep: Reputation: 227Reputation: 227Reputation: 227
Quote:
Originally Posted by dalacor View Post
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
 
Old 02-18-2019, 12:53 PM   #13
slacktroll
Member
 
Registered: May 2011
Distribution: Slackware 14.2
Posts: 122

Rep: Reputation: 21
Quoting myself:

Create /etc/initscript

This is what the file should look like

/etc/initscript
Code:
ulimit -Hn 1048576
eval exec "$4"

Last edited by slacktroll; 02-18-2019 at 12:54 PM. Reason: :-D
 
Old 02-18-2019, 01:05 PM   #14
bassmadrigal
LQ Guru
 
Registered: Nov 2003
Location: West Jordan, UT, USA
Distribution: Slackware
Posts: 5,824

Rep: Reputation: 3542Reputation: 3542Reputation: 3542Reputation: 3542Reputation: 3542Reputation: 3542Reputation: 3542Reputation: 3542Reputation: 3542Reputation: 3542Reputation: 3542
Quote:
Originally Posted by dalacor View Post
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.
 
Old 02-18-2019, 01:14 PM   #15
dalacor
LQ Newbie
 
Registered: Feb 2019
Posts: 24

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by bassmadrigal View Post
/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
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
soft and hard limits for nproc value in /etc/security/limits.conf file kraljic Linux - General 3 07-13-2015 08:13 AM
[SOLVED] How to set open file descriptor hard and soft limits Z038 Slackware 3 06-16-2013 11:37 PM
Setting limits in /etc/security/limits.conf vaibhav.vsk Linux - Security 1 09-20-2012 08:22 AM
difference between socket returned descriptor and accept returned descriptor naveenisback Programming 1 08-29-2009 04:55 AM
limits are not working (limits.conf) PkerC Red Hat 3 06-22-2006 10:14 AM

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

All times are GMT -5. The time now is 07:47 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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration