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

0

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!!

sirlion

Posted 2011-08-25T20:05:31.823

Reputation: 43

Answers

0

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).

polynomial

Posted 2011-08-25T20:05:31.823

Reputation: 1 424

0

/etc/security/limits.conf

  • soft core unlimited
  • hard core unlimited

or

  • soft core 10000
  • hard core 10000

do NOT work on my Debian Squeeze servers.

After reboot : root@sla:~# ulimit -c 0

This is annoying

:'(

root@sla:~# sysctl kernel.core_pattern

kernel.core_pattern = /var/log/dumps/core.%t.%e.%p_%u-%g

I FOUND THE PROBLEM :

inside /etc/profile at end :

The line below set the soft limit to stop creation of coredumps for

all users

ulimit -S -c 0 > /dev/null 2>&1

I replaced with :

ulimit -c unlimited > /dev/null 2>&1

And now it work:D

Pascal

Serveurperso

Posted 2011-08-25T20:05:31.823

Reputation: 1