Subject: Re: Problem with gcore and permissions
To: None <>
From: Christos Zoulas <>
List: tech-kern
Date: 01/11/2005 14:45:12
In article <>,
Thor Lancelot Simon  <> wrote:
>On Tue, Jan 11, 2005 at 12:35:08PM -0500, D'Arcy J.M. Cain wrote:
>> On Sun, 9 Jan 2005 06:12:47 -0500
>> "D'Arcy J.M. Cain" <> wrote:
>> > I am trying to get a core dump of a running program (PostgreSQL master
>> > process) and I just get a permissions error;
>> > 
>> > # gcore 728
>> > gcore: ptrace(PT_DUMPCORE) failed: Permission denied
>> > 
>> > The gcore man page doesn't mention PT_DUMPCORE but I checked the code
>> > and it is correct.  As an added datapoint, killing the process with
>> > SIGABRT also fails to create a core file albeit silently in that case.
>> > 
>> > Anyone know what could be happening here or what I should check next?
>Is the process you're trying to core-dump setuid?

Probably not.

>Is the core size limit, perhaps, set to 0?

Actually it would return EFBIG then.

The third reason is that the process cannot write to the directory or file
where the core is supposed to be generated. You can use sysctl to change
proc.<pid>.corename to something else, or update to head and use
gcore -c <corename> <pid>. Finally a better way is to ktrace or attach
gdb to it.