0

I am trying to set the value of maximum number of open files in Ubuntu in etc/security/limits.conf, but i am not getting the same value reflected when i fire the command ulimit -a. I am adding the following values in the limits.conf :

*          soft     nproc          65535
*          hard     nproc          65535
*          soft     nofile         65535
*          hard     nofile         65535

but on firing ulimit -a, i am getting :

core file size          (blocks, -c) 0
data seg size           (kbytes, -d) unlimited
max nice                        (-e) 0
file size               (blocks, -f) unlimited
pending signals                 (-i) 139264
max locked memory       (kbytes, -l) 32
max memory size         (kbytes, -m) unlimited
open files                      (-n) 30048
pipe size            (512 bytes, -p) 8
POSIX message queues     (bytes, -q) 819200
max rt priority                 (-r) 0
stack size              (kbytes, -s) 10240
cpu time               (seconds, -t) unlimited
max user processes              (-u) 139264
virtual memory          (kbytes, -v) unlimited
file locks                      (-x) unlimited
Abhishek
  • 1
  • 1
  • 2

2 Answers2

2

If your services is managed by systemd, then you will need to update your service file with following

LimitNOFILE=32768

e.g. tomcat.service

0

You need change * to username. Here is the reference.


where are the default ulimit values set? (linux, centos)

Ok, I figured this out. It seems to be an issue either with CentOS 6 or perhaps my machine configuration. On the CentOS 5 configuration, I can set in /etc/security/limits.conf:

* - nproc unlimited

and that would effectively update the accounts and cron limits. However, this does not work in my CentOS 6 box. Instead, I must do:

myname1 - nproc unlimited  
myname2 - nproc unlimited
...

And things work as expected. Maybe the UID specification works to, but the wildcard (*) definitely DOES NOT here. Oddly, wildcards DO work for the 'nofile' limit.

I still would love to know where the default values are actually coming from, because by default, this file is empty and I couldn't see why I had different defaults for the two CentOS boxes, which had identical hardware and were from the same provider.


Community
  • 1
  • 1
BMW
  • 42,880
  • 12
  • 99
  • 116
  • Thanks. I tried this. It works fine on CentOS. But i am using Ubuntu. The changes are saved in the file but they do not get reflected when i do ulimit -a. Any suggestions ?? – Abhishek Apr 10 '14 at 10:15
  • did you restart the server and try again? Are there any ulimit setting customized in your profile files, such as .profile, .bashrc, etc ? – BMW Apr 10 '14 at 10:22
  • restarted a few number of times. but i didnt go thru the profile files. thnx for the prompt reply. will check them and try again. – Abhishek Apr 10 '14 at 11:23