How do you get core dumps to current directory (ie the standard Unix way)

All Gurus once were Newbies
Forum rules
There are no such things as "stupid" questions. However if you think your question is a bit stupid, then this is the right place for you to post it. Please stick to easy to-the-point questions that you feel people can answer fast. For long and complicated questions prefer the other forums within the support section.
Before you post please read how to get help
Post Reply
rweed
Level 1
Level 1
Posts: 4
Joined: Sun Feb 17, 2019 3:54 pm

How do you get core dumps to current directory (ie the standard Unix way)

Post by rweed »

I just built a new system and decided to move up to Mint 19.3
from 18.3 (I prefer to wait until a version gets to dot 3 before
I install so no Mint 20 yet). I unfortunately discovered after
several futile attempts to find where the heck my core dumps
were going that in the brave new world of systemd core files
are dumped in a compressed format to /var/lib/systemd/coredump.
To access them I have to do coredumpctl list, get the PID number
and then do something like coredumpctl gdb PID.

Can someone give me a step-by-step procedure to revert core dumps
to the way I've expected them for the last 20 or so years of using
Unix/Linux. Mainly,

1. I want an uncompressed core file (preferrably named core.PID) dumped
into the current directory where I ran the executable that triggered the dump so
I can use it directly with gdb or igdb.
2. I want this to be persistent so I don't revert the systemd nonsense if/when I
have to reboot.

Note: googleing around I see a couple of different options but am not sure what
if any side effects they will cause so I'm reluctant to try them until I
find out what the best way to revert to old core dumps is.

One suggested in the core(5) man pages is:

# echo "kernel.core_pattern=core.%p" > \
/etc/sysctl.d/50-coredump.conf
# /lib/systemd/systemd-sysctl

I guess another would be to revert core_pattern to use apport like 18.3 does instead systemd-coredump.

Not sure why someone thinks that putting core dumps into a single dir and forcing users who
are unaware there has been a change to go through several unecessary steps just to access
the core files is a good idea. This is a perfect example of "If it ain't broke, don't fix it". Plus I
don't need backups of core files. I delete them as soon as I don't have a need for them anymore.
If it's standard policy now to dump to the /var dir, can we at least modify the core dumped message
when a program encounters a seg fault etc to say "core dumped to /var/lib/systemd/coredump"
Also, It would be nice if users could override the systemd coredump with a simple environment
variable or two.

Thanks
RW
Post Reply

Return to “Newbie Questions”