Preparing for a core dump

Security enhancements on Linux-based platforms may prevent a core dump from being generated when you are expecting one. If you are using the core_on_error=1, core_on_error=2, or signal_regime tunables, you need to perform the following steps to override the security, and then run the application from which you require the core dump. (If you are using core_on_error=3, a core dump file will always be created, regardless of this security enhancement; follow the details in To create a core dump instead.)

Note: The following commands must be run with root privileges.
  1. Disable any size limitations that could stop the core dump file from being created in its entirety:
    ulimit -c unlimited
    Tip: To keep the size limits in place after a reboot, add the following for each appropriate <user>, to /etc/security/limits.conf:
    <user>    soft    core    unlimited
    <user>    hard    core    unlimited
  2. Specify the format and location in which the core dump is to be created - to create the core dump file in the format core.process-id, in the same directory as your application:
    echo "core.%p"> /proc/sys/kernel/core_pattern
    Note: This is only set for the current session; to ensure the format and location persists after a reboot, add the following line to your /etc/sysctl.conf configuration file:
    kernel.core_pattern=core.%p
  3. Disable the AppArmor application (SUSE platforms), Automatic Bug Reporting Tool (Red Hat platforms), or Apport (Ubuntu platforms) that is preventing the generation of a core dump file:

    SUSE:

    rcapparmor stop

    Red Hat:

    chkconfig abrt off

    Ubuntu:

    systemctl stop apport.service 
    systemctl disable apport.service
  4. Ensure that the core dump contains information resulting from processes that were granted permission via setuid and setgid:
    sysctl -w kernel.suid_dumpable=2
    Note: This permission override is only set for the current session; to ensure it persists after a reboot, add the following line to your /etc/sysctl.conf configuration file:
    kernel.suid_dumpable=2

If required, configure the run-time environment, so that when the run-time system receives an unhandled signal, a core dump file in created in the same directory as the application; alternatively, if the application is set to programmatically invoke a core dump (CBL_CREATE_CORE), you can just run the application.