[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: How to increase hard NOFILE limit in debian 11?



On Sun, Nov 13, 2022 at 08:25:33PM -0800, Thomas Nyberg wrote:
> $ ulimit -Hn
> 1048576
> ```
> 
> I would like to increase that

The hard limit you're seeing is capped by the sysctl fs.nr_open value.
If you want to increase the hard limit, you first have to increase the
sysctl value.

unicorn:~$ sysctl fs.nr_open
fs.nr_open = 1048576
unicorn:~$ sudo sysctl -w fs.nr_open=2097152
fs.nr_open = 2097152
unicorn:~$ ulimit -Hn
1048576
unicorn:~$ sudo -s
unicorn:~# ulimit -Hn
1048576
unicorn:~# ulimit -Hn 2097152
unicorn:~# ulimit -Hn
2097152

To make these changes permanent, you'll need to put the new sysctl value
in /etc/sysctl.conf (or some equivalent file).  I'm not sure if that'll
do the whole job by itself.  You may also need to set the hard limit
value in /etc/security/limits.conf -- but I'd try with just the sysctl
change first, and see if it works following a reboot.


Reply to: