1

in this question

The following things are suggested:

ulimit -c unlimited
ulimit -a

to set the limit to something other than zero. It was previously 0 on my system.

No core files after segfault.

So, sudo systemctl enable apport.service (though this seems distro-related, not developer related). No corefiles in /var/crash or working directory after that.

There's also:

sudo sysctl -w kernel.core_pattern=core.%u.%p.%t # to enable core generation
systemctl restart apport # to restore default apport settings

Nothing still.

Looking in /var/log/apport.log shows

ERROR: apport (pid 34940) Fri Dec 24 11:48:47 2021: executable does not belong to a package, ignoring

Oh good! Ubuntu has disabled core dumps for my own code, destroying a valuable debugging tool.

How can get apport off my back and get core dumps for my own executable?

1 Answer 1

5

Got it.

Disable apport

sudo systemctl disable apport

Then, set kernel.core_pattern

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

then change ulimit

ulimit -c unknown

Core dump is in the working directory now.

The changes don't persist past reboot (for me).

2
  • 3
    Disabling apport will persist. To make the sysctl change persist, store it in a custom file in /etc/sysctl.d. To make the ulimit change persist... I'm not sure if it's still /etc/security/limits.conf or if some systemd supersedes that :)
    – hobbs
    Dec 24, 2021 at 20:19
  • Without needing to reboot, once done, you can restore apport as-is with: sudo systemctl enable apport; sudo systemctl start apport; sudo sysctl -w kernel.core_pattern='|/usr/share/apport/apport %p %s %c %d %P %E'; ulimit -S -c 0
    – JPvRiel
    Dec 25, 2021 at 19:53

You must log in to answer this question.

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