Score:1

How do I find core files for my own code in Ubuntu 20.04?

ru flag

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?

Score:4
ru flag

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).

br flag
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 :)
JPvRiel avatar
mx flag
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`
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.