On 10/2/15 10:20 AM, Will Senn wrote:
On 10/2/15 6:04 AM, Hazel Russman wrote:
On Fri, 2 Oct 2015 02:40:49 -0500
Will Senn <[email protected]> wrote:
Hi again,
In a budding lfs instance - somewhere in the neighborhood of section
6.18 or so, when a program segfaults and dumps core, where do the cores
go? I have set ulimit -c unlimited, but no core is generated even
though
linux reports a segment fault and core dump. I looked at
/proc/sys/kernel/core_pattern and is says:
|/usr/lib/systemd/systemd-coredump %p %u %g %s %t %e
I have no idea what it means, but it looks suspiciously like the cores
aren't gonna get generated like they ought to. I would like to have the
corefile generated. How can I get cores to show up when they are
supposed to?
Thanks,
Will
--
Look in /usr/lib/sysctl.d and you'll find the configuration file that
sets this behaviour. It's called nn-coredump.conf.
Another of systemd's tiresome "mother knows best" things.
I don't see that file and I should have been more specific that I am
running through the standard LFS, not the LFS-systemd. I read up on
man core and now know what the core_pattern entry:
|/usr/lib/systemd/systemd-coredump %p %u %g %s %t %e
means. It is a pipe to the systemd-coredump command. That command does
not exist. I ran the example from the man page (sort of, I don't yet
have regular users, so I ran it as root) and used my own crashing
program that core dumped):
http://man7.org/linux/man-pages/man5/core.5.html
I tried the test:
$ cc -o core_pattern_pipe_test core_pattern_pipe_test.c
$ su
Password:
# echo "|$PWD/core_pattern_pipe_test %p UID=%u GID=%g sig=%s" > \
/proc/sys/kernel/core_pattern
# exit
$ sleep 100
^\ # type control-backslash
Quit (core dumped)
$ cat core.info
But no file was created. I also tried emptying core_pattern, still no
core file. Thoughts?
Thanks,
Will
OK. I figured it out. The issue wasn't with LFS, it was with Arch, the
OS where I am hosting LFS (inside of virtualbox running on Debian
Jessie). This sort of makes since if the proc that is running in LFS is
really Arch's proc! Here are the steps I used to get the behavior I was
looking for:
In Arch as root (su -):
echo kernel.core_pattern=core > /etc/sysctl.d/50-coredump.conf
/lib/systemd/systemd-sysctl
add ulimit -c unlimited to .bash_profile
logout/reboot
In LFS as root:
cat /proc/sys/kernel/core_pattern
# core
Create a new environment to kill for its core dump:
bash
Get the core dump
|kill -s SIGSEGV $$|
Segmentation fault (core dumped)
ls
core.482
Celebrate! Now I can do whatever it is you do with core files :)
Thanks,
Will
--
http://lists.linuxfromscratch.org/listinfo/lfs-support
FAQ: http://www.linuxfromscratch.org/blfs/faq.html
Unsubscribe: See the above information page
Do not top post on this list.
A: Because it messes up the order in which people normally read text.
Q: Why is top-posting such a bad thing?
A: Top-posting.
Q: What is the most annoying thing in e-mail?
http://en.wikipedia.org/wiki/Posting_style