limits.conf

Hi,

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

What is the result of````
$ 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
````

the ulimit -a outputs this:

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'

Ok. I'm not sure what to tell you… setting the /etc/security/limits.conf persists after a reboot on my servers. What version (OS/kernel) are you using?

$ 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

Ubuntu 10.4 64

(Latest 2.6 Paravirt (2.6.34-x86_64-linode13)

Have you considered setting placing "ulimit -n 65535" inside /etc/bashrc?

Also, after modifying your /etc/security/limits.conf, did you issue a reboot? A reboot is required for that to have any effect.

yes, i did reboot and it says 1024…

wouldn't bashrc only have effect upon interactive login?

Thanks!

Art

Ok, my bad. Ubuntu does not apply * wildcards to root, it must be explicit:

root soft nofile 65535

root hard nofile 65535

Yes, it would only have an effect after an interactive login.

I'm glad you got it worked out!

Reply

Please enter an answer
Tips:

You can mention users to notify them: @username

You can use Markdown to format your question. For more examples see the Markdown Cheatsheet.

> I’m a blockquote.

I’m a blockquote.

[I'm a link] (https://www.google.com)

I'm a link

**I am bold** I am bold

*I am italicized* I am italicized

Community Code of Conduct