Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have an init.d script that starts an app using start-stop-daemon --chuid SOME_SYSTEM_USER. That is, the app runs under a different user, not root.

Problem is, the app needs special limit settings (namely ulimit -n 64000), which I set in limits.conf. This works quite nicely when I run it directly from shell: su - SOME_SYSTEM_USER + start app from shell.

But when run through the start-stop-daemon --chuid from /etc/init.d, these limits are ignored. Then the app fails to work, obviously.

How do I force start-stop-daemon to honour the ulimit settings?

Debian Squeeze, 2.6.32-5-686 #1 SMP Sat May 5 01:33:08 UTC 2012 i686 GNU/Linux

share|improve this question
up vote 19 down vote accepted

At this time, you can't. limits.conf(5) is the configuration for pam_limits(8), which is activated by the PAM stack according to the configuration in /etc/pam.d. However, start-stop-daemon(8) as launched from an init.d script doesn't pass through the PAM stack, so those kinds of settings are never applied.

Debian bug #302079 contains a patch to enable setting limits from start-stop-daemon(8), but the bug has been open since 2005 and the patch hasn't been merged yet.

While not ideal, AFAIK the recommended way to accomplish this right now is to add a ulimit call in your init.d script.

share|improve this answer
Just add the ulimit setting right before the start-stop-daemon command. (i.e ulimit -n 64000) ... for the ignorant like me. – Ryan Schumacher Nov 4 '13 at 1:07
If, unlike the OP, you don't know which daemon's crashing, I just got good results on Debian Wheezy restarting daemons after: echo "ulimit -c unlimited" | sudo tee /lib/lsb/init-functions.d/core-limit – Martin Dorey Jul 7 '15 at 18:59
Some more valuable background information can be found here: – sehe May 24 at 11:40

You can also use the 'limit' command in the upstart script.

In the file /etc/init/foo.conf, add the line:

limit nofile 64000 64000

The first 64000 is the soft limit, and the second is the hard limit.

You can find more information here:

share|improve this answer

You must log in to answer this question.

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