Coder Perfect

There is no core dump file generated.

Problem

Every time, my application crash a core dump file is not generated. I remember that few days ago, on another server it was generated. I’m running the app using screen in bash like this:

#!/bin/bash
ulimit -c unlimited
while true; do ./server; done

As you can see, I’m using ulimit -c unlimited, which is necessary if I want to generate a core dump, but it didn’t work when I encountered a segmentation failure. I’m not sure how I’m going to make it work.

Asked by Cyclone

Solution #1

This link has a nice summary of reasons why core dumps aren’t generated:

Answered by Philipp Claßen

Solution #2

Make that the current directory is writable (at the time of the crash — the server may change directories). The directory must be writable by that user if the server calls setuid.

Examine /proc/sys/kernel/core pattern as well. This may cause core dumps to be redirected to another location, which must be writable. More info here.

Answered by Employed Russian

Solution #3

Install the systemd-coredump package for systemd systems1. Coredumps are available at:

ls /var/lib/systemd/coredump

These coredumps are also compressed using the lz4 format. To decompress, use the liblz4-tool package with the command lz4 -d FILE. I had to rename the completely long filename into something shorter in order to debug the decompressed coredump using gdb…

1 Stretch Debian 9

Answered by Seth

Solution #4

Check:

$ sysctl kernel.core_pattern

in order to examine how your dumps are made ( percent e will be the process name, and percent t will be the system time).

apport creates dumps in /var/crash for Ubuntu, but in a different format (see inside file).

You can put it to the test by doing the following:

sleep 10 &
killall -SIGSEGV sleep

After the segmentation fault indication, you’ll notice “(core dumped)” if core dumping was successful.

Read more:

Answered by kenorb

Solution #5

Remember that if you start the server from a service, it will launch a separate bash session, hence the ulimit won’t work. Try to include this in your script:

ulimit -c unlimited

Answered by user18853

Post is based on https://stackoverflow.com/questions/7732983/core-dump-file-is-not-generated