35

I am trying to find out the reason of crash for one of my Linux application. But I don't know where core is going.

cat /proc/sys/kernel/core_pattern
core.%e.%p

Any Idea?

1
39

Systems using systemd are usually configured to dump cores to

/var/lib/systemd/coredump/

You may use the coredumpctl command to list core dumps. See also no-more-coredumps-after-migrating-to-systemd

38

The core dump is written in the current directory of the process at the time of the crash.

Of course core dumps need to be enabled, by default those are usually disabled. Check the output of ulimit -c, if that's 0 then no core file will be written. Run ulimit -c unlimited to enable core dumps; this is a per-process setting which is inherited by processes started by that process.

If a core dump should have been generated but you don't know where, then you could start the process again (if it will without crashing immediately), then check its working directory by doing ls -l /proc/$pid/cwd where $pid is the process ID of the process. That link will point to the current working directory of that process. Chances are the core dump will be there. Otherwise you need to run find on the entire system...

7
  • 3
    I have checked ulimit -c its unlimited, but still there is nothing in current directory of process.
    – dcds
    Jan 20 '15 at 8:31
  • 1
    It's possible that the application detected a fatal error itself and aborted, i.e. it's not a "real" crash such as a segmentation violation or similar, which would generate a core dump. As you give no information about the application it's not possible to know.
    – wurtel
    Jan 20 '15 at 8:35
  • 1
    Its definitely a crash coz I knowingly doing a null pointer.
    – dcds
    Jan 20 '15 at 9:19
  • The core dump is written in the current directory of the process at the time of the crash. Not quite true. Rather, The core dump is written in the directory you were in when you called the process at the time of the crash.. Jun 30 at 4:22
  • @GabrielStaples are you sure? In my experience, if a process changes current working directory to wherever, that is where the core dump is written. It (or the kernel) does not remember what the cwd was when the process was started.
    – wurtel
    Jun 30 at 11:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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