10

Generating coredumps used to work fine, but after switching over to systemd, I only see the message

Aborted (core dumped)

but no core file is generated. Has it something to do with systemd?

(Background: My original question can be found here. Thanks schaiba for finding the solution. I provide this Q&A, so others can find the solution easier if they already know that it is a systemd issue.)

  • just a note for whom it may concert: on Windows Subsystem for Linux the core file generation is not still supported – piertoni Jun 16 '21 at 15:41

2 Answers2

10

Per default, systemd writes coredumps to the journal. coredumpctl list lists the missing coredumps.

The files are stored in /var/lib/systemd/coredump. Use coredumpctl dump to get access to the core files.

For instance, if the PID was 10666, you can use

coredumpctl dump 10666 --output /tmp/core.10666

Not related to systemd, but if it is still not working, make sure that the coredump limit is turned off:

# ulimit -c unlimited

Also verify that you can write to the working directory.

9

The /proc/sys/ kernel settings are manged by sysctl(8), the system defaults live in /usr/lib/sysctl.d/, overridden by /etc/sysctl.conf or /etc/sysctl.d/. They define the name of the core files and such. Not their writing (unless the kernel is configured to allow core dumps from SUID binaries). The writing is controlled by ulimit(1), i.e., ulimit -c unlimited gives no limits. Under systemd(1) core files generated by stuff under its control are written to the journal, can be retrieved by coredumpctl(1). Normal user stuff is unchanged.

systemd's systemd-sysctl.service just runs sysctl at the proper point of boot, and handles rerunning on changes.

vonbrand
  • 18,253