Creating core dumps on Linux
Question
Duplicate:
I am trying to create a core dump in my "Fedora Core release 3 (Heidelberg)".
[root@testserver test_core_dump]# uname -a
Linux testserver 2.6.12-1.1381_FC3 #1 Fri Oct 21 03:46:55 EDT 2005 i686 athlon i386 GNU/Linux
I am following this to create core dumps.
The problem is, /proc/sys/kernel/suid_dumpable is not present in this version. I also checked here /proc/sys/fs/suid_dumpable, but suid_dumpable is not present.
1) Is there any work around for this? 2) Am I missing something here?
Solution
The instructions you are following are simply to over-ride the o/s limits that may prevent you from getting a core dump.
The generation of a core dump is a trivial process, you send a signal to the process as follows
kill -ABRT pid_of_process
There are many things however that may prevent this from happening, however you should try this first and see if it produces a core dump in your current directory. If the program is interactive and doesn't trap the quit signnal then you may be able to cause core to dump by sending SIGQUIT to the process, this is usually bound to CTRL-\
The area you are having problems with in the referenced document refers to process that run setuid/setguid if your process is not running in either of those modes then you can safely ignore that step. (You can tell if the process is running setuid/setguid by looking at the file permissions of the program and examining the setuid and setguid bits this can be done by issuing an ls -l command and looking for s in the 4th position (setuid) or 7th position (setgid) (example of setuid below)
-r-sr-xr-x 1 root wheel 57616 28 Oct 03:28 /usr/bin/login
Have you tried to generate a core without using the step that is not working and did it work?
You will need to be able to write in the directory that the process is running in, or the directory defined for core dumps if that is not the current directory. Running as root may solve the permissions issues.
OTHER TIPS
I am not sure I understand what you want. The webpage you references talks about ENABLING core-dumps, not triggering them. Do not worry about the missing sysctl -- my Linux systems also doesn't have it and I can happily dump cores all around :) Do you want to create a core dump for a specific process?
Apart from SIGABRT, you can also try using gcore
:
NAME gcore - Generate a core file for a running process
SYNOPSIS gcore [-o filename] pid
DESCRIPTION gcore generates a core file for the process specified by its process ID, pid. By default, the core file is written to core.pid, in the current directory.
This is a duplicate of this question. The accepted answer, and the one with most votes suggest the following:
In Bash:
ulimit -c unlimited
and in tcsh:
limit coredumpsize unlimited
In this case, if a program crashes, the core dump will be created in a file called core
where the program was run.