You are not logged in.

#1 2021-04-02 14:52:12

0BADC0DE
Member
From: Regnum Utriusque Siciliae
Registered: 2018-02-21
Posts: 342

How can I have my core dumps back? [SOLVED]

Hi all.
I don't want to enter the systemd battle. Not now at least. I want to have my core dumps back.

To be more precise:

Whenever a process dumps the core I want it to be written wherever the kernel thinks it should go.
This can be, almost always, within my home directory. It could be also somewhere else in the case it's a system program to dump the core.
I would call this "the good ol' way". Which is perfectly OK to me and I don't want to discuss whether this is considered good or not.

I see a number of posts all discussing about the philosophy of letting systemd grab your core dumps and the such. Well, I am not interested in.

[SOLVED] See message #8.

Last edited by 0BADC0DE (2021-04-02 16:30:47)


Maybe Computers Will Never Become As Intelligent
As Humans. Surely They Won't Ever Become So Stupid.

Offline

#2 2021-04-02 15:00:25

seth
Member
From: Won't reply 2 private help req
Registered: 2012-09-03
Posts: 77,546

Online

#3 2021-04-02 15:14:15

0BADC0DE
Member
From: Regnum Utriusque Siciliae
Registered: 2018-02-21
Posts: 342

Re: How can I have my core dumps back? [SOLVED]

Thanks @seth, But I cannot get my cores back.
I simply avoid systemd-coredump to store it within its journals/directories.
But core dumps just vanish as it looks like systemd is hijacking them.
I have manually crashed a program I started from cli by sending it a SIGBUS (kill -7 <process ID>.
I even get the message: "Bus error               (core dumped) firefox".
But there's no core file!


Maybe Computers Will Never Become As Intelligent
As Humans. Surely They Won't Ever Become So Stupid.

Offline

#4 2021-04-02 15:19:19

seth
Member
From: Won't reply 2 private help req
Registered: 2012-09-03
Posts: 77,546

Re: How can I have my core dumps back? [SOLVED]

I don't think you can fix that from systemd at all.
Shadow /usr/lib/sysctl.d/50-coredump.conf in /etc/sysctl.d/50-coredump.conf and alter the pattern, eg.

kernel.core_pattern = /var/cache/coredumps/core_%e.%p
kernel.core_uses_pid = 0

Online

#5 2021-04-02 15:30:28

0BADC0DE
Member
From: Regnum Utriusque Siciliae
Registered: 2018-02-21
Posts: 342

Re: How can I have my core dumps back? [SOLVED]

I ended up by completely disabling systemd-coredump altogether:

systemctl disable systemd-coredump.socket
systemctl stop systemd-coredump.socket

Last edited by 0BADC0DE (2021-04-02 15:33:17)


Maybe Computers Will Never Become As Intelligent
As Humans. Surely They Won't Ever Become So Stupid.

Offline

#6 2021-04-02 15:57:02

Ropid
Member
Registered: 2015-03-09
Posts: 1,069

Re: How can I have my core dumps back? [SOLVED]

The way I understood things, disabling the systemd units shouldn't help? The program will still be started by the kernel because of the value that's set in kernel.core.pattern?

$ cat /proc/sys/kernel/core_pattern 
|/usr/lib/systemd/systemd-coredump %P %u %g %s %t %c %h

That "|" character at the start makes the kernel start the program according to the "man 5 core" man-page.

Last edited by Ropid (2021-04-02 15:58:50)

Offline

#7 2021-04-02 16:06:25

0BADC0DE
Member
From: Regnum Utriusque Siciliae
Registered: 2018-02-21
Posts: 342

Re: How can I have my core dumps back? [SOLVED]

Ropid wrote:

The way I understood things, disabling the systemd units shouldn't help? The program will still be started by the kernel because of the value that's set in kernel.core.pattern?

$ cat /proc/sys/kernel/core_pattern 
|/usr/lib/systemd/systemd-coredump %P %u %g %s %t %c %h

That "|" character at the start makes the kernel start the program according to the "man 5 core" man-page.

You are right. The service is re-enabled at the reboot!
This is totally insane to me: if I disable a service it's because I want it not to start!


Maybe Computers Will Never Become As Intelligent
As Humans. Surely They Won't Ever Become So Stupid.

Offline

#8 2021-04-02 16:15:16

0BADC0DE
Member
From: Regnum Utriusque Siciliae
Registered: 2018-02-21
Posts: 342

Re: How can I have my core dumps back? [SOLVED]

To really really bring your core dumps back you have to:

sudo ln -fs   /dev/null /etc/sysctl.d/50-coredump.conf

to avoid systemd-coredump do whatever it thinks it's good for you and to add this command:

echo core > /proc/sys/kernel/core_pattern

to your booting process. I have it in /etc/rc.local now.

See here and here for more details.

Last edited by 0BADC0DE (2021-04-02 16:30:06)


Maybe Computers Will Never Become As Intelligent
As Humans. Surely They Won't Ever Become So Stupid.

Offline

Board footer

Powered by FluxBB