19

I have enabled a unlimited core file size using ulimit:

ulimit -a
core file size          (blocks, -c) unlimited
...

I believe I have triggered a core dump but I can't locate the core file in my home, var/... etc...

Do you know where Ubuntu configures the core dump location?

jcalfee314
  • 765
  • 4
  • 10
  • 23

3 Answers3

31

By default, the Ubuntu kernel is configured to use apport to log coredumps. You can override this by overwriting /proc/sys/kernel/core_pattern, check the "Naming of core dump files" section in man core for details. For example:

echo '/tmp/core.%e.%p.%t' | sudo tee /proc/sys/kernel/core_pattern

Apport writes core dumps to /var/crash/_path_to_program.userid.crash, BUT it will only do so for applications installed from the main ubuntu apt repositories.

More info on apport: https://wiki.ubuntu.com/Apport

maccam94
  • 411
6

I think this is a more Linux kernel thing than a specific Ubuntu thing. Check out

cat /proc/sys/kernel/core_pattern

Check out the core file man page

Rich Homolka
  • 32,350
1

On Ubuntu 16.04.3 LTS, my core dump was located at:

/var/lib/systemd/coredump/core.application-name.0.24d47e89526c4c7e90953998d2c33d1e.19672.1516049424000000000000

So, to run it in gdb, you can run:

apt install gdb gdb /path/to/your/binary/application-name /var/lib/systemd/coredump/core.application-name.0.24d47e89526c4c7e90953998d2c33d1e.19672.1516049424000000000000

Homer6
  • 468