Обсуждение: Cannot *start* server because of a typo in pg_hba.conf

Поиск
Список
Период
Сортировка

Cannot *start* server because of a typo in pg_hba.conf

От
Devrim GÜNDÜZ
Дата:
Yesterday I spent about half an hour to dig an issue on my laptop -- 9.0
instance did not start, and there were nothing in the logs. Eventually I
straced postmaster on start, and noticed an extra char in the
pg_hba.conf, which caused postmaster not to start.

Is it possible to drop something to (startup) log file and mention about
the syntax error in hba file?

(FWIW, I saw the same issue in a Greenplum 4.0.3 instance 2 months
before or so.)

--
Devrim GÜNDÜZ
EnterpriseDB: http://www.enterprisedb.com
PostgreSQL Danışmanı/Consultant, Red Hat Certified Engineer
Community: devrim~PostgreSQL.org, devrim.gunduz~linux.org.tr
http://www.gunduz.org  Twitter: http://twitter.com/devrimgunduz

Re: Cannot *start* server because of a typo in pg_hba.conf

От
Tom Lane
Дата:
Devrim GÜNDÜZ <devrim@gunduz.org> writes:
> Yesterday I spent about half an hour to dig an issue on my laptop -- 9.0
> instance did not start, and there were nothing in the logs. Eventually I
> straced postmaster on start, and noticed an extra char in the
> pg_hba.conf, which caused postmaster not to start.

> Is it possible to drop something to (startup) log file and mention about
> the syntax error in hba file?

That information would certainly be logged somewhere.  Maybe you looked
in the wrong log file?  Or you're using one of those configurations
where early output to stderr goes to /dev/null?
        regards, tom lane


Re: Cannot *start* server because of a typo in pg_hba.conf

От
Devrim GÜNDÜZ
Дата:
On Sun, 2011-02-20 at 10:39 -0500, Tom Lane wrote:
>
> > Is it possible to drop something to (startup) log file and mention
> > about the syntax error in hba file?
>
> That information would certainly be logged somewhere.  Maybe you
> looked in the wrong log file?  Or you're using one of those
> configurations where early output to stderr goes to /dev/null?

I tried to start postmaster with:

* pg_ctl -D data start
* postmaster -D data
* pg_ctl -D data -l logfile start

None of them logged anything to anywhere. You can reproduce it on your
machine, too.
--
Devrim GÜNDÜZ
EnterpriseDB: http://www.enterprisedb.com
PostgreSQL Danışmanı/Consultant, Red Hat Certified Engineer
Community: devrim~PostgreSQL.org, devrim.gunduz~linux.org.tr
http://www.gunduz.org  Twitter: http://twitter.com/devrimgunduz

Re: Cannot *start* server because of a typo in pg_hba.conf

От
Tom Lane
Дата:
Devrim GÜNDÜZ <devrim@gunduz.org> writes:
> On Sun, 2011-02-20 at 10:39 -0500, Tom Lane wrote:
>> That information would certainly be logged somewhere.  Maybe you
>> looked in the wrong log file?  Or you're using one of those
>> configurations where early output to stderr goes to /dev/null? 

> None of them logged anything to anywhere. You can reproduce it on your
> machine, too.

No, I can't.  I get something like this on stderr:

LOG:  invalid connection type "zlocal"
CONTEXT:  line 82 of configuration file "/home/postgres/testversion/data/pg_hba.conf"
FATAL:  could not load pg_hba.conf
        regards, tom lane


Re: Cannot *start* server because of a typo in pg_hba.conf

От
Devrim GÜNDÜZ
Дата:
On Sun, 2011-02-20 at 12:45 -0500, Tom Lane wrote:
>
> > None of them logged anything to anywhere. You can reproduce it on
> your
> > machine, too.
>
> No, I can't.  I get something like this on stderr:
>
> LOG:  invalid connection type "zlocal"

Err, please try putting an extra char before the first comment line,
like:

w# PostgreSQL Client Authentication Configuration File

--
Devrim GÜNDÜZ
EnterpriseDB: http://www.enterprisedb.com
PostgreSQL Danışmanı/Consultant, Red Hat Certified Engineer
Community: devrim~PostgreSQL.org, devrim.gunduz~linux.org.tr
http://www.gunduz.org  Twitter: http://twitter.com/devrimgunduz

Re: Cannot *start* server because of a typo in pg_hba.conf

От
Thom Brown
Дата:
2011/2/20 Devrim GÜNDÜZ <devrim@gunduz.org>:
> On Sun, 2011-02-20 at 12:45 -0500, Tom Lane wrote:
>>
>> > None of them logged anything to anywhere. You can reproduce it on
>> your
>> > machine, too.
>>
>> No, I can't.  I get something like this on stderr:
>>
>> LOG:  invalid connection type "zlocal"
>
> Err, please try putting an extra char before the first comment line,
> like:
>
> w# PostgreSQL Client Authentication Configuration File

That mistake looks familiar ;)

--
Thom Brown
Twitter: @darkixion
IRC (freenode): dark_ixion
Registered Linux user: #516935


Re: Cannot *start* server because of a typo in pg_hba.conf

От
Tom Lane
Дата:
Devrim GÜNDÜZ <devrim@gunduz.org> writes:
> On Sun, 2011-02-20 at 12:45 -0500, Tom Lane wrote:
>> No, I can't.  I get something like this on stderr:
>> 
>> LOG:  invalid connection type "zlocal" 

> Err, please try putting an extra char before the first comment line,
> like:

> w# PostgreSQL Client Authentication Configuration File

Given exactly that mistake, I get

LOG:  invalid connection type "w"
CONTEXT:  line 1 of configuration file "/home/postgres/testversion/data/pg_hba.conf"
FATAL:  could not load pg_hba.conf

Are you sure you're looking in the right place?

One thought that comes to mind is that I've seen cases where SELinux
prevented the postmaster from writing anything at all to its stderr.
I didn't think that could still happen in any current SELinux versions,
but it might be worth checking the kernel log for avc denials.
        regards, tom lane