Earlier today I ran into an issue where a software package was failing with “too many open files”. I made several attempts at changing this using various settings in “/etc/security/limits.conf”, but they just weren't taking hold.
After some digging, I found a Debian and Ubuntu set of bugs such as “'nofile' limit set in limits.conf not applied”. However, those reports indicated that they could decrease the limit just not increase it. I couldn't change it up or down, despite verifying that PAM was configured to pull in the limits module for ssh, su, and cron.
I ended up doing a work-around, which was to start the process from a root shell after doing “ulimit -Sn 10240; ulimit -Hn 10240”, and calling the process as “su -c 'bash -c script' username”. This caused it to inherit the root shell limits. Since the end goal is to start up the process via an init script, this should work out fine.comments powered by Disqus