28

On Debian Wheezy, ulimit -a gives:

open files                      (-n) 1024

I add this to /etc/security/limits.conf

*                hard    nofile          64000

then reboot.

And ulimit -a still gives a maximum number of open files of 1024. Anyone could throw some light on it?

Icu
  • 1,495

4 Answers4

26

Option one: You did not set the softlimit higher aswell.

Possible solution:

in /etc/security/limits.conf add

* soft nofile 2048

test with

ulimit -n 2048 

Option two: You are logged in as user and in some "config" file (profile, bashrc, something like this) the soft limit is set to a lower value.

Possible solution f.e. grep for ulimit in your etc folder and/or home folder.

Warning: Depending on the amount of files/directorys you have in there you might want to consider only specific directorys/files

ps: there are a lot of similiar question here you might want to read up.

Specially Hard vs Soft Limit

Read here for possible other solution which go more into detail Too Many Open Files

Dennis Nolte
  • 2,966
26

There is a bug in Debian. To increase ulimit you need to add this into the /etc/pam.d/common-session file:

session required pam_limits.so

and in /etc/security/limits.conf add:

*               soft    nofile          65535
*               hard    nofile          65535

Then reboot the system.

Jakub Maj
  • 373
1

On more modern systemd-based distros, limits are often set by systemd. See man systemd-system.conf.

So for example, to raise the file descriptor limit for root, this is what I would do:

/etc/systemd/system.conf.d/10-filelimit.conf:

[Manager]
DefaultLimitNOFILE=16384:524288

Make sure to read the manual for details.


As an aside, the limits within containers are usually further restricted by the container engine. This needs to be configured separately; see this answer.

cyqsimon
  • 365
1

In my case of Apache on Debian 10 the above didn't help though this worked:

echo "APACHE_ULIMIT_MAX_FILES='ulimit -n 16384'" >> /etc/apache2/envvars
service apache2 restart

I checked with:

cat /proc/$pid/limits

..where $pid is the process ID of one of the Apache processes.