53

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?

dcds
  • 982

2 Answers2

55

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

StefanQ
  • 761
  • 7
    /var/lib/systemd/coredump/ will not contain any core files unless you have installed systemd-coredump and then re run the program that crashes. – Aidan Gallagher Jun 13 '22 at 13:18
53

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

wurtel
  • 16,115
  • 6
    I have checked ulimit -c its unlimited, but still there is nothing in current directory of process. – dcds Jan 20 '15 at 08: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 08:35
  • 1
    Its definitely a crash coz I knowingly doing a null pointer. – dcds Jan 20 '15 at 09:19