Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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

share|improve this question

2 Answers 2

up vote 0 down vote accepted

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|improve this answer

/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

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.