Re: BUG #6735: PANIC: 42501: could not open control file "global/pg_control": Permission denied - Mailing list pgsql-bugs

From Tom Lane
Subject Re: BUG #6735: PANIC: 42501: could not open control file "global/pg_control": Permission denied
Date
Msg-id 4813.1342243253@sss.pgh.pa.us
Whole thread Raw
In response to Re: BUG #6735: PANIC: 42501: could not open control file "global/pg_control": Permission denied  (Craig Ringer <ringerc@ringerc.id.au>)
List pgsql-bugs
Craig Ringer <ringerc@ringerc.id.au> writes:
> PostgreSQL 9.1 isn't compatible with databases from 8.3, so you can't
> actually run Pg 9.1 directly against a datadir from 8.3; that's why I
> suggested the latest 8.3 point release.

> However, your startup should be failing with a message telling you this,
> not with a permissions error then (more importantly) a crash.

Well, the reason that's a PANIC is that ReadControlFile is coded that
way:

    fd = BasicOpenFile(XLOG_CONTROL_FILE,
                       O_RDWR | PG_BINARY,
                       S_IRUSR | S_IWUSR);
    if (fd < 0)
        ereport(PANIC,
                (errcode_for_file_access(),
                 errmsg("could not open control file \"%s\": %m",
                        XLOG_CONTROL_FILE)));

Perhaps it should be only FATAL instead, but that seems like a quibble.
If it can't read pg_control, the server ain't starting.

It is curious though that the OP gets this far, because the server
would previously have tried to read PG_VERSION and postgresql.conf,
which if it were a simple wrong-account problem should likewise
have been unreadable.  Your thought about AV software may be the
right explanation.

            regards, tom lane

pgsql-bugs by date:

Previous
From: John R Pierce
Date:
Subject: Re: BUG #6735: PANIC: 42501: could not open control file "global/pg_control": Permission denied
Next
From: dsavolainen@visi.com
Date:
Subject: BUG #6738: pg_dump does not handle extensions properly/invalid pg_dump output