limits.conf
I'm having a bit of a problem setting number open files limit - setting 'ulimit -n 65535' works, which tells me the kernel supports it, but it does not survive a reboot. When I put it in limits.conf it does not seem to have any effect
limits.conf:
soft nofile 65535
hard nofile 65535
It always worked on my other servers, but not on linodes for some reason…
Thanks!
Art
8 Replies
$ ulimit -a
Are you wanting to set a per process limit (ulimit -n), or set a limit allowed by the kernel (/proc/sys/fs/file-max)?
If you are wanting to set the maximum open file descriptors allowed by the kernel, then you need to do it in __/proc/sys/fs/file-max__. For example:
$ echo "65535" > /proc/sys/fs/file-max
You can check this the open and allowed file descriptors:
$ cat /proc/sys/fs/file-nr
````
core file size (blocks, -c) 0
data seg size (kbytes, -d) unlimited
scheduling priority (-e) 20
file size (blocks, -f) unlimited
pending signals (-i) 16382
max locked memory (kbytes, -l) 64
max memory size (kbytes, -m) unlimited
open files (-n) 1024
pipe size (512 bytes, -p) 8
POSIX message queues (bytes, -q) 819200
real-time priority (-r) 0
stack size (kbytes, -s) 8192
cpu time (seconds, -t) unlimited
max user processes (-u) unlimited
virtual memory (kbytes, -v) unlimited
file locks (-x) unlimited
the /proc/sys/fs/file-max contains some insanely large number…
I'm trying to set 'ulimit -n'
$ cat /etc/security/limits.conf
* soft nofile 65535
* hard nofile 65535
$ ulimit -a
core file size (blocks, -c) 0
data seg size (kbytes, -d) unlimited
scheduling priority (-e) 0
file size (blocks, -f) unlimited
pending signals (-i) 8192
max locked memory (kbytes, -l) 32
max memory size (kbytes, -m) unlimited
open files (-n) 65535
pipe size (512 bytes, -p) 8
POSIX message queues (bytes, -q) 819200
real-time priority (-r) 0
stack size (kbytes, -s) 8192
cpu time (seconds, -t) unlimited
max user processes (-u) 8192
virtual memory (kbytes, -v) unlimited
file locks (-x) unlimited
Also, after modifying your /etc/security/limits.conf, did you issue a reboot? A reboot is required for that to have any effect.
wouldn't bashrc only have effect upon interactive login?
Thanks!
Art
root soft nofile 65535
root hard nofile 65535
I'm glad you got it worked out!