LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 06-05-2008, 01:18 AM   #1
reakinator
Member
 
Registered: Oct 2005
Location: California
Distribution: Ubuntu Feisty
Posts: 52

Rep: Reputation: 15
core dump files, howto put in /tmp?


Hi,

In trying to debug one of my favourite applications (ardour), it has been suggested to set 'ulimit -u unlimited' so that 'core' files are created after a crash. These files are big, normally around 50 megs, and they are littering my home directory.

I want to keep the setting on so that I can hand the core file to gdb when a backtrace is necessary, I just don't want them taking up valuable space.

So, is there a way to make the 'core' file written in /tmp always (thereby replacing a previous dump, and disappearing after a while)?

regards,
Rich
 
Old 06-05-2008, 01:20 AM   #2
reakinator
Member
 
Registered: Oct 2005
Location: California
Distribution: Ubuntu Feisty
Posts: 52

Original Poster
Rep: Reputation: 15
ah, quick type. It is supposed to be "ulimit -c unlimited", but anyone who knows how to do what I am asking most definitely knows this too. anywho..
 
Old 06-05-2008, 02:12 AM   #3
colucix
LQ Guru
 
Registered: Sep 2003
Location: Bologna
Distribution: CentOS 6.5 OpenSuSE 12.3
Posts: 10,509

Rep: Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983
To change the location of the newly created core files, you have to change the content of /proc/sys/kernel/core_pattern:
Code:
sudo echo /tmp/core > /proc/sys/kernel/core_pattern
this will put the core dumps in /tmp, naming them "core". You can also add some modifiers to the content of the above, to customize the name of the core file, for example:
Code:
sudo echo /tmp/core.%u.%p > /proc/sys/kernel/core_pattern
will add the user ID of the owner of the process and the PID of the process itself. Other modifiers are available. See man 5 core for details.
 
Old 06-05-2008, 02:15 AM   #4
colucix
LQ Guru
 
Registered: Sep 2003
Location: Bologna
Distribution: CentOS 6.5 OpenSuSE 12.3
Posts: 10,509

Rep: Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983
Ah, just forgotten... by modifying a value under /proc you will lost changes upon reboot. To make them permanent, you can edit the file /etc/sysctl.conf, for example by adding the following lines
Code:
# Setup a directory to save core files into
kernel.core_pattern = /tmp/core
 
Old 06-05-2008, 02:21 AM   #5
reakinator
Member
 
Registered: Oct 2005
Location: California
Distribution: Ubuntu Feisty
Posts: 52

Original Poster
Rep: Reputation: 15
Ah, thanks. "man 5 core" was the ticket.. heh.

regards,
Rich
 
Old 06-11-2008, 04:05 AM   #6
reakinator
Member
 
Registered: Oct 2005
Location: California
Distribution: Ubuntu Feisty
Posts: 52

Original Poster
Rep: Reputation: 15
I've had a few core dumps since I made these changes, and they don't seem to be effecting the placement of core files.

I have "kernel.core_pattern = /tmp/core" in /etc/sysctl.conf, /proc/sys/kernel/core_pattern is: "|/usr/share/apport/apport "

I would really like to get these buggers in /tmp, as they are quite large.
 
Old 06-11-2008, 04:33 AM   #7
colucix
LQ Guru
 
Registered: Sep 2003
Location: Bologna
Distribution: CentOS 6.5 OpenSuSE 12.3
Posts: 10,509

Rep: Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983
Strange. If you did not reboot the machine after the modification of /etc/sysctl.conf, the change has not been applied. Have you manually modified the content of /proc/sys/kernel/core_pattern using the echo command?
Code:
sudo echo /tmp/core > /proc/sys/kernel/core_pattern
 
Old 06-14-2008, 09:04 PM   #8
reakinator
Member
 
Registered: Oct 2005
Location: California
Distribution: Ubuntu Feisty
Posts: 52

Original Poster
Rep: Reputation: 15
yes this command does the trick (well, I have to su in, it doesn't work with sudo because of the > redirection thing), but as you said, it does not stick after a reboot.

"kernel.core_pattern = /tmp/core" doesn't seem to change this.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Core Dump on Solaris (Question about core file) dayalan_cse Solaris / OpenSolaris 5 12-29-2014 07:56 AM
where are core dump files and how to analyse them using gdb manish.chauhan Linux - Software 1 11-21-2007 01:59 AM
Debugging with gdb, core.xxxx files, howto? GlennsPref Linux - Software 3 01-12-2006 07:55 PM
/tmp dump gyankosh Linux - Newbie 1 09-28-2005 05:04 PM
Numerous scb_*.tmp files in /tmp dburk Programming 3 08-18-2003 04:28 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 01:38 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration