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!!
Best Answer
You need to set soft core too. There are two sets of limits. From the man page:
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).