Thread: postgres on a FreeBSD 4.5 box

postgres on a FreeBSD 4.5 box

From
Ken Guest
Date:
I've installed postgres 7.1.3 on a FreeBSD 4.5 box using the ports
system, I just can't seem to get it working.

su-2.05a# /usr/local/etc/rc.d/010.pgsql.sh status
pg_ctl: postmaster or postgres is not running
su-2.05a# /usr/local/etc/rc.d/010.pgsql.sh start
pg_ctl: postmaster does not start


(It takes a few seconds for the "postmaster does not start" to be
printed to the terminal, in the
mean-time I try to start psql at the prompt in someother terminal and
get the following:
[ken@localdev ken]$ psql
psql: connectDBStart() -- connect() failed: Connection refused
        Is the postmaster running locally
        and accepting connections on Unix socket '/tmp/.s.PGSQL.5432'?
[ken@localdev ken]$ ls -l /tmp/.s.PGSQL.5432*
srwxrwxrwx  1 postgres  wheel   0 Oct 30 15:48 /tmp/.s.PGSQL.5432
-rw-------  1 postgres  wheel  28 Oct 30 15:48 /tmp/.s.PGSQL.5432.lock
[ken@localdev ken]$ uname -a
FreeBSD localdev.stockbyte.com 4.5-RELEASE FreeBSD 4.5-RELEASE #0: Mon
Jan 28 14:31:56 GMT 2002
murray@builder.freebsdmall.com:/usr/src/sys/compile/GENERIC  i386

What do I need to do to get this working?

k.





Re: postgres on a FreeBSD 4.5 box

From
Tom Lane
Date:
Ken Guest <kguest@stockbyte.com> writes:
> I've installed postgres 7.1.3 on a FreeBSD 4.5 box using the ports
> system, I just can't seem to get it working.

> su-2.05a# /usr/local/etc/rc.d/010.pgsql.sh status
> pg_ctl: postmaster or postgres is not running
> su-2.05a# /usr/local/etc/rc.d/010.pgsql.sh start
> pg_ctl: postmaster does not start

Impossible to tell anything from this, since your script is hiding
whatever error message the postmaster might be emitting.  Arrange
for the postmaster's stderr to go someplace useful (maybe into a
log file) and then see what it has to say.

            regards, tom lane

Re: postgres on a FreeBSD 4.5 box

From
"Gregory Wood"
Date:
> > I've installed postgres 7.1.3 on a FreeBSD 4.5 box using the ports
> > system, I just can't seem to get it working.
>
> > su-2.05a# /usr/local/etc/rc.d/010.pgsql.sh status
> > pg_ctl: postmaster or postgres is not running
> > su-2.05a# /usr/local/etc/rc.d/010.pgsql.sh start
> > pg_ctl: postmaster does not start
>
> Impossible to tell anything from this, since your script is hiding
> whatever error message the postmaster might be emitting.  Arrange
> for the postmaster's stderr to go someplace useful (maybe into a
> log file) and then see what it has to say.

IIRC, the standard FreeBSD PostgreSQL ports script should log to
/var/log/pgsql. Should be something useful in there.

Greg


Re: postgres on a FreeBSD 4.5 box

From
Ken Guest
Date:
Gregory Wood wrote:

>>>I've installed postgres 7.1.3 on a FreeBSD 4.5 box using the ports
>>>system, I just can't seem to get it working.
>>>
>>>
>>>su-2.05a# /usr/local/etc/rc.d/010.pgsql.sh status
>>>pg_ctl: postmaster or postgres is not running
>>>su-2.05a# /usr/local/etc/rc.d/010.pgsql.sh start
>>>pg_ctl: postmaster does not start
>>>
>>>
>>Impossible to tell anything from this, since your script is hiding
>>whatever error message the postmaster might be emitting.  Arrange
>>for the postmaster's stderr to go someplace useful (maybe into a
>>log file) and then see what it has to say.
>>
>>
>
>IIRC, the standard FreeBSD PostgreSQL ports script should log to
>/var/log/pgsql. Should be something useful in there.
>
>
No such beast as /var/log/pgsql.
I did get this in a logfile though:
"
postmaster does not find the database system.
        Expected to find it in the PGDATA directory "/usr/local/pgsql/data",
        but unable to open file
"/usr/local/pgsql/data/global/pg_control": Permission denied
"

Here's an ls -l
su-2.05a# ls -l /usr/local/pgsql/data/global/pg_control
-rw-------  1 pgsql  pgsql  8192 Nov  1 14:33
/usr/local/pgsql/data/global/pg_control
su-2.05a#


Any ideas of what I need to do?

k.


Re: postgres on a FreeBSD 4.5 box

From
Doug McNaught
Date:
Ken Guest <kguest@stockbyte.com> writes:

> Gregory Wood wrote:
>
> No such beast as /var/log/pgsql.
> I did get this in a logfile though:
> "
> postmaster does not find the database system.
>         Expected to find it in the PGDATA directory "/usr/local/pgsql/data",
>         but unable to open file
> "/usr/local/pgsql/data/global/pg_control": Permission denied
> "
>
> Here's an ls -l
> su-2.05a# ls -l /usr/local/pgsql/data/global/pg_control
> -rw-------  1 pgsql  pgsql  8192 Nov  1 14:33
> /usr/local/pgsql/data/global/pg_control
> su-2.05a#

Is /usr/local/pgsql/data/global/pg_control readable by user 'pgsql'?
Does the startup script 'su' to that user before calling 'pg_ctl'?

It's possible that pg_control has the right permissions (looks OK from
the above) but one of the directories above it is locked down.

-Doug

Re: postgres on a FreeBSD 4.5 box

From
Tom Lane
Date:
Ken Guest <kguest@stockbyte.com> writes:
> postmaster does not find the database system.
>         Expected to find it in the PGDATA directory "/usr/local/pgsql/data",
>         but unable to open file
> "/usr/local/pgsql/data/global/pg_control": Permission denied

You've got a file permissions or ownership problem.  Offhand it looks
like the files are owned by "pgsql" but you're probably trying to run
the postmaster as "postgres".  You can either "chown -R"
/usr/local/pgsql/data to postgres or tweak the start script to su to
pgsql instead of postgres.

            regards, tom lane

Re: postgres on a FreeBSD 4.5 box

From
Ken Guest
Date:
Doug McNaught wrote:

>Ken Guest <kguest@stockbyte.com> writes:
>
>
>
>>Gregory Wood wrote:
>>
>>No such beast as /var/log/pgsql.
>>I did get this in a logfile though:
>>"
>>postmaster does not find the database system.
>>        Expected to find it in the PGDATA directory "/usr/local/pgsql/data",
>>        but unable to open file
>>"/usr/local/pgsql/data/global/pg_control": Permission denied
>>"
>>
>>Here's an ls -l
>>su-2.05a# ls -l /usr/local/pgsql/data/global/pg_control
>>-rw-------  1 pgsql  pgsql  8192 Nov  1 14:33
>>/usr/local/pgsql/data/global/pg_control
>>su-2.05a#
>>
>>
>
>Is /usr/local/pgsql/data/global/pg_control readable by user 'pgsql'?
>Does the startup script 'su' to that user before calling 'pg_ctl'?
>
>It's possible that pg_control has the right permissions (looks OK from
>the above) but one of the directories above it is locked down.
>
>
>
As an aside to this I've recompiled the kernel with a few flags tweaked
 (NMBCLUSTERS) so,
being thorough (unnecessarily?) I'm recompiling postgresql on the off
chance that it needs to
pick up on the changes.
Then I'm going to do a reinstall and edit the startup script. I'll let
you know how I progress.

thanks

Ken

>
>



Re: postgres on a FreeBSD 4.5 box

From
Ken Guest
Date:
Tom Lane wrote:

>Ken Guest <kguest@stockbyte.com> writes:
>
>
>>postmaster does not find the database system.
>>        Expected to find it in the PGDATA directory "/usr/local/pgsql/data",
>>        but unable to open file
>>"/usr/local/pgsql/data/global/pg_control": Permission denied
>>
>>
>
>You've got a file permissions or ownership problem.  Offhand it looks
>like the files are owned by "pgsql" but you're probably trying to run
>the postmaster as "postgres".  You can either "chown -R"
>/usr/local/pgsql/data to postgres or tweak the start script to su to
>pgsql instead of postgres.
>
>

I took a look at the socket files in /tmp and they didn't have the
correct ownership. One quick chown -R
later and everythings fine.