Changing line for user pgsql connecting via UNIX socket to "ident sameuser" causes pg_ctl start -s -w to fail.

Started by Constantin Stefanovover 22 years ago2 messagesbugs
Jump to latest

Hello.

I have FreeBSD 4.9-RELEASE-p1 and upgraded to PostgreSQL 7.4 (built it
from FreeBSD port databases/postgresql7).

With default pg_hba.conf everything is OK. When I change line in
pg_hba.conf file from
local all all trust
to
local all pgsql trust
it works.
Then I change the line to
local all pgsql ident sameuser
and try to start server with

su -l pgsql -c "pgsql start -D /home/pgsql/data -s -w"

It does not start.
In logfile there are messages:

Dec 11 13:40:19 tandem1 postgres[41718]: [1-1] LOG: XX000: could not create socket for statistics collector: Protocol not supported
Dec 11 13:40:19 tandem1 postgres[41718]: [1-2] LOCATION: pgstat_init, pgstat.c:228
Dec 11 13:40:19 tandem1 postgres[41722]: [2-1] LOG: 00000: database system was shut down at 2003-12-11 13:39:13 MSK
Dec 11 13:40:19 tandem1 postgres[41723]: [2-1] LOG: 00000: connection received: host=[local] port=
Dec 11 13:40:19 tandem1 postgres[41722]: [2-2] LOCATION: StartupXLOG, xlog.c:2598
Dec 11 13:40:19 tandem1 postgres[41723]: [2-2] LOCATION: BackendFork, postmaster.c:2389
Dec 11 13:40:19 tandem1 postgres[41722]: [3-1] LOG: 00000: checkpoint record is at 0/9B0C4C
Dec 11 13:40:19 tandem1 postgres[41723]: [3-1] FATAL: 57P03: the database system is starting up
Dec 11 13:40:19 tandem1 postgres[41722]: [3-2] LOCATION: StartupXLOG, xlog.c:2630
Dec 11 13:40:19 tandem1 postgres[41723]: [3-2] LOCATION: ProcessStartupPacket, postmaster.c:1431
Dec 11 13:40:19 tandem1 postgres[41722]: [4-1] LOG: 00000: redo record is at 0/9B0C4C; undo record is at 0/0; shutdown TRUE
Dec 11 13:40:19 tandem1 postgres[41722]: [4-2] LOCATION: StartupXLOG, xlog.c:2655
Dec 11 13:40:19 tandem1 postgres[41722]: [5-1] LOG: 00000: next transaction ID: 541; next OID: 17142
Dec 11 13:40:19 tandem1 postgres[41722]: [5-2] LOCATION: StartupXLOG, xlog.c:2658
Dec 11 13:40:19 tandem1 postgres[41722]: [6-1] LOG: 00000: database system is ready
Dec 11 13:40:19 tandem1 postgres[41722]: [6-2] LOCATION: StartupXLOG, xlog.c:2948
Dec 11 13:40:20 tandem1 postgres[41728]: [2-1] LOG: 00000: connection received: host=[local] port=
Dec 11 13:40:20 tandem1 postgres[41728]: [2-2] LOCATION: BackendFork, postmaster.c:2389
Dec 11 13:40:20 tandem1 postgres[41728]: [3-1] LOG: 00000: connection authorized: user=pgsql database=template1
Dec 11 13:40:20 tandem1 postgres[41728]: [3-2] LOCATION: BackendFork, postmaster.c:2451
Dec 11 13:40:20 tandem1 postgres[41728]: [4-1] FATAL: 08P01: invalid frontend message type 0
Dec 11 13:40:20 tandem1 postgres[41728]: [4-2] LOCATION: SocketBackend, postgres.c:366
Dec 11 13:40:21 tandem1 postgres[41732]: [2-1] LOG: 00000: connection received: host=[local] port=
Dec 11 13:40:21 tandem1 postgres[41732]: [2-2] LOCATION: BackendFork, postmaster.c:2389
Dec 11 13:40:21 tandem1 postgres[41732]: [3-1] LOG: 00000: connection authorized: user=pgsql database=template1
Dec 11 13:40:21 tandem1 postgres[41732]: [3-2] LOCATION: BackendFork, postmaster.c:2451
Dec 11 13:40:21 tandem1 postgres[41732]: [4-1] FATAL: 08P01: invalid frontend message type 0
Dec 11 13:40:21 tandem1 postgres[41732]: [4-2] LOCATION: SocketBackend, postgres.c:366
Dec 11 13:40:22 tandem1 postgres[41718]: [2-1] LOG: 00000: received fast shutdown request
Dec 11 13:40:22 tandem1 postgres[41718]: [2-2] LOCATION: pmdie, postmaster.c:1730
Dec 11 13:40:22 tandem1 postgres[41735]: [3-1] LOG: 00000: shutting down
Dec 11 13:40:22 tandem1 postgres[41735]: [3-2] LOCATION: ShutdownXLOG, xlog.c:3092
Dec 11 13:40:24 tandem1 postgres[41735]: [4-1] LOG: 00000: database system is shut down
Dec 11 13:40:24 tandem1 postgres[41735]: [4-2] LOCATION: ShutdownXLOG, xlog.c:3106

I pressed CTRL-C after some time. If not to press it, the log will be
longer, but the result is the same (there will be more connections that
fail).

When I tried to change pg_hba.conf online and then to make pg_ctl
reload, postgresql continued running, but su -l pgsql -c "psql -l"
failed with similar effects.

Now I am running PostgreSQL with
local all pgsql trust
but it seems that it is not appropriate for secure environment.
In
PostgreSQL 7.3.4 everything worked (the matter begun when I moved old
pg_hba.conf after upgrading).

--
Constantin Stefanov

#2Tom Lane
tgl@sss.pgh.pa.us
In reply to: Constantin Stefanov (#1)
Re: Changing line for user pgsql connecting via UNIX socket to "ident sameuser" causes pg_ctl start -s -w to fail.

Constantin Stefanov <cstef@mail.ru> writes:

Then I change the line to
local all pgsql ident sameuser
and try to start server with

su -l pgsql -c "pgsql start -D /home/pgsql/data -s -w"

It does not start.

It starts fine, as the log shows. Try not using "-w" ... I suspect
there is something odd about the "su" environment that prevents pg_ctl
from connecting with IDENT authorization, so it fails to realize that
the postmaster has started.

regards, tom lane