Yes I know this question has been asked before and I have tried all the solutions I have seen and none of them work for me. We are running Ubuntu 12, and we have a process that automatically gets launched by upstart every time the machine boots up. I have gone into /etc/security/limits.conf and have added these lines:

*                hard    nofile          65000
*                soft    nofile          32000
root             hard    nofile          65000
root             soft    nofile          32000

I also went into /etc/pam.d/common-session and added this line:

session required        pam_limits.so

In order to make this work for non-interactive processes, I also went into /etc/pam.d/common-session-noninteractive and added the exact same line.

When I login as our adminstrator user (who is on the sudo list, and I'll call this user SUDOUSER), I see that the limits are now 32000 as expected when I do a ulimit -a.

Then I do a reboot of the entire machine, to make sure the limits stick for new processes, like the process that gets launched by upstart after reboot.

However, after the reboot, when I look at the persistent process that starts at runtime, I get the process ID (say 12345) and then do cat /proc/12345/limits and I see the limits are still the defaults (1024 soft, 4096 hard).

So what am I doing wrong?

  • None of the solutions mentioned that /etc/security/limits.conf only affects logins? Dec 4, 2015 at 19:31

1 Answer 1


OK I found the solution. Turns out that upstart ignores all the limits in pam.d and limits.conf. The way to do this in upstart is to explicitly set the limits in the upstart conf script for the process. So, suppose the process is myproc and you have a file /etc/init/myconf.conf. Inside this script just include this line somewhere near the top:

limit nofile 32000 65000

Make sure this line stands by itself - it is NOT placed inside script or pre-start script, etc - it is a main line (or "stanza") all by itself.

Now just restart the process and see the limits with cat /proc/12345/limits


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .