Where do I find the core dump in ubuntu 16.04LTS?

In Ubuntu the core dumps are handled by Apport and can be located in /var/crash/. But it is disabled by default in stable releases.

To enable Apport, run: sudo systemctl enable apport.service or sudo service apport start.


To disable, run: sudo systemctl disable apport.service or sudo service apport stop in order to back to regular core dumping method. See: How do I enable or disable Apport?.

To disable permanently, edit /etc/apport/crashdb.conf file and comment the following line:

'problem_types': ['Bug', 'Package'],

by adding a hash symbol (#) in the beginning of the line.

To disable crash reporting (back to normal), remove the hash symbol (the same as it was).


You can also check core_pattern, how core dumps are handled by the kernel:

$ cat /proc/sys/kernel/core_pattern
|/usr/share/apport/apport %p %s %c

So even core files are disabled by ulimit, apport will still capture the crash.

See also:

  • How to generate a core dump in Linux?
  • Core dumped, but core file is not in the current directory?
  • for macOS, see: How to generate core dumps in Mac OS X?

For those googlin': ( in my case -- Ubuntu 16.04 and 18.04 and a custom app ) /var/crash was still empty, so a quick way to handle core creation ( provided that you are e.g. using a relevant ulimit builtin setting ) was

sudo sysctl -w kernel.core_pattern=core.%u.%p.%t # to enable core generation

and

systemctl restart apport # to restore default apport settings
# which, by the way, were "|/usr/share/apport/apport %p %s %c %d %P" (without quotes)


Sources:

  • https://utcc.utoronto.ca/~cks/space/blog/linux/CoreDumpsOnServers
  • http://man7.org/linux/man-pages/man5/core.5.html

Tags:

C++

16.04