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?

2
  • @djf the OP didn't specify what program was causing core dumps. It may not be programmers code. It may be Unity for all we know. Jan 26, 2015 at 23:48
  • 1
    How is this a SuperUser question? This is about running a debugger which only programmers use. This should be migrated back to SO.
    – Homer6
    Mar 1, 2018 at 5:04

3 Answers 3

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

4
  • 13
    That does not tell you where it puts the file. The question named Ubuntu 14.04. It is not clear at all by following the command in /proc/sys/kernel/core_pattern where one would find the file.
    – jcalfee314
    Feb 20, 2015 at 1:49
  • 1
    For me, that core_pattern kernel pseudofile references a program called 'apport'... which has no man page nor much helpful output. So still searching for my dumped cores. :(
    – gojomo
    Jun 9, 2015 at 14:34
  • 1
    apport is the standard linux desktop core handler it reports back to your distro usually.
    – kkron
    Sep 9, 2015 at 2:16
  • How to open this folder? cd /usr/share/apport/apport don't work.
    – mrgloom
    Feb 9, 2016 at 20:04
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

2
  • 1
    To write core dumps for non-package programs as well, create a file named ~/.config/apport/settings with the following contents: [main] unpackaged=true
    – greuze
    Oct 31, 2018 at 9:01
  • Modifying the /proc/sys/kernel/core_pattern does not work for me in Ubuntu 18.04
    – greuze
    Oct 31, 2018 at 9:03
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

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .