coredumps don't work after enabling them in /etc/security/limits.conf on Debian

5,655

You need to set soft core too. There are two sets of limits. From the man page:

# cat /etc/debian_version 
6.0.1
# man limits.conf:

           <type>

               hard
                   for enforcing hard resource limits. These limits are set by the superuser and enforced by the Kernel. The user cannot raise his requirement of system resources above such values.

               soft
                   for enforcing soft resource limits. These limits are ones that the user can move up or down within the permitted range by any pre-existing hard limits. The values specified with this token can be
                   thought of as default values, for normal system usage.

               -
                   for enforcing both soft and hard resource limits together.

You can just change 'hard' in your limits.conf to '-' and it should fix it. Or you can be more verbose and add a specific line for soft (maybe setting it smaller).

Share:
5,655

Related videos on Youtube

thelaumix
Author by

thelaumix

Updated on September 18, 2022

Comments

  • thelaumix
    thelaumix over 1 year

    I have some init scripts that launch some daemons that I wrote. I want Linux to generate a coredump anytime something crashes. I activated coredumps in /etc/security/limits.conf by adding the next line:

    * hard core 100000

    After rebooting, I run ulimit -a and I can see that coredumps are not activated:

    > root@computer:~# ulimit -a
    > core file size          (blocks, -c) 0
    

    First, I checked if there is any file script on my system that deactivates coredumps (greping ulimit -c 0 ), but I didn't find anything so far.

    Then, I created a bogus c program..to double check if it's working, and I can confirm that it's not. The program is this

    int main() {
      int *p;
      return *p;
    }
    

    After running it, no coredump is generated

    root@computer:~# ./a.out 
    Segmentation fault
    

    I know that coredump works (and it's activated in the kernel), because after running ulimit -c 100000 and repeating the test above, a coredump is generated.

    root@computer:~# ulimit -c 100000
    root@computer:~# ./a.out 
    Segmentation fault (core dumped)
    root@computer:~# ls
    a.out  core
    

    I'm really out of ideas. Any help?

    Thanks in advanved!!