Core dumps aren't generated after reboot in El Captain

I used `ulimit -c unlimted` in terminal to get core dumps in the `/cores` folder.

However, after reboot (kernel panic) I no longer can get any core dumps regardless what I try - `ulimit -c unlimted` or `sudo sysctl -w kern.coredump=1` - core dumps just don't get generated.


How should I enable core dumps for the terminal session?


OSX 10.11.5

Accepted Reply

That doesn't quite match mine:

drwxrwxr-t@ 2 root  admin    68B Aug 24  2015 /cores/


Yours is missing the stick bit. The following should fix it:

sudo chmod 1775 /cores


I have no idea if that's what's preventing cores from being dumped, though.

Replies

In what scope do you want to enable core dumps? For all processes on the machine? For stuff started by one particular user? For stuff started directly from one Terminal session?

Share and Enjoy

Quinn “The Eskimo!”
Apple Developer Relations, Developer Technical Support, Core OS/Hardware

let myEmail = "eskimo" + "1" + "@apple.com"

For debugging the application I'm wokring on.

It is a console application

This is working for me. In one Terminal window I type:

$ ulimit -c unlimited
$ cat

In another I type:

$ killall -SEGV cat

And back in the first window I see this:

$ ulimit -c unlimited
$ cat
Segmentation fault: 11 (core dumped)
$

I also see the core show up in the expected place:

$ ls -lh /cores
total 1245648
-r--------  1 quinn  admin  608M Jul 29 02:29 core.715

This is all on a stock 10.11.5 machine (a freshly restored VM). If this is not working on your machine, there’s clearly something broken. Breaking core dumps at this level is tricky. The most obvious possibilities are:

  • something wrong, perhaps permissions, with the

    /cores/
    directory
  • running out of disk space

Share and Enjoy

Quinn “The Eskimo!”
Apple Developer Relations, Developer Technical Support, Core OS/Hardware

let myEmail = "eskimo" + "1" + "@apple.com"

Here are the rights for "/cores" folder:


$ ls -lh /

...

drwxr-xr-x 2 root admin 68B Jul 29 09:55 cores/

...


And there at least 40gb of free space on my harddrive.

What else should I check?

That doesn't quite match mine:

drwxrwxr-t@ 2 root  admin    68B Aug 24  2015 /cores/


Yours is missing the stick bit. The following should fix it:

sudo chmod 1775 /cores


I have no idea if that's what's preventing cores from being dumped, though.

That was it! Thank you!

I actually never heard of what is the sticky bit about.

You're welcome. I'm glad that fixed it.


From the man page for "sticky":

A directory whose `sticky bit' is set becomes an append-only directory, or, more accurately, a directory in which the deletion of files is restricted. A file in a sticky directory may only be removed or renamed by a user if the user has write permission for the directory and the user is the owner of the file, the owner of the directory, or the super-user. This feature is usefully applied to directories such as /tmp which must be publicly writable but should deny users the license to arbitrarily delete or rename each others' files.