Subject: Re: Problem with gcore and permissions
To: None <>
From: Christos Zoulas <>
List: tech-kern
Date: 01/11/2005 16:31:36
On Jan 11,  3:02pm, ("D'Arcy J.M. Cain") wrote:
-- Subject: Re: Problem with gcore and permissions

| On Tue, 11 Jan 2005 14:45:12 -0500
| (Christos Zoulas) wrote:
| > 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.
| I'm running this as root so I assume that directory permissions are not
| the issue.

If "this" refers to gcore, being root matters as far as getting permission
to trace the process to tell it to generate the core. If the process
being traced (in this case PostgreSQL) does not have the right permissions
to write the core file, then you'll get an error. The core file is written
using the PostgreSQL credentials.

| Funny you should mention attaching gdb as that is the other
| thing that fails.  If I try to attach it tells me something about
| already debugging and then kills the PostgreSQL process when I exit gdb.

That is probably because there is another ktrace or gdb attached to it.
Does ps show 'X' in the status column?

| Note that gcore fails on -current as well.  The gdb attach works fine
| though.  Unfortunately, so does PostgreSQL (it doesn't get into a busy
| loop) so I can't use that to track down my PostgreSQL problem.

So the problem is fixed :-)