14

I've run ulimit -n 65536, added the following lines to /etc/security/limits.conf:

*    soft nofile 65536
*    hard nofile 65536
alix soft nofile 65536
alix hard nofile 65536
root soft nofile 65536
root hard nofile 65536

And added session required pam_limits.so to both:

  • /etc/pam.d/common-session
  • /etc/pam.d/common-session-noninteractive

And fs.file-max = 65536 to /etc/sysctl.d/60-file-max.conf.

Still, after restarting and running ulimit -n on my session, I only get 4096 (was 1024 before).

What am I missing?

10

From the manual:

 -n     The maximum number of open file descriptors (most
        systems do not allow this value to be set)

systemd has an option for this:

$ more /etc/systemd/system.conf | grep NOFILE
#DefaultLimitNOFILE=

But this is also only for the graphical user settings. Remove the # and you can set it to 65536.

  • 1
    Forgot to mention, I also did that. – Alix Axel Jun 23 '18 at 12:03
  • 1
    @AlixAxel : This answer worked for me, in addition to * - nofile 16384 ( I was only attempting 16384) in /etc/security/limits.conf. – Doug Smythies Jun 23 '18 at 14:45
  • The 65k is an assumption and it would be expected that there are hard coded limits to the upper side of what is allowed. You might want to start lower as Doug indicated ;) – Rinzwind Jun 23 '18 at 14:58
  • What do you mean by "But this is also only for the graphical user settings"? – sinan Aug 16 '18 at 7:12
  • It will not change unlimit for anything that is not graphical (login through tty, ssh etc). Only for the desktop. – Rinzwind Aug 16 '18 at 7:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.