Re: Cannot Start Postgres After System Boot

From: Rich Shepard <rshepard(at)appl-ecosys(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: Cannot Start Postgres After System Boot
Date: 2010-10-21 17:27:01
Message-ID: alpine.LNX.2.00.1010211010150.16051@salmo.appl-ecosys.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Wed, 20 Oct 2010, Tom Lane wrote:

> Personally, I'd drop all the machinations with checking the pidfile or
> removing old socket files.

Tom,

I didn't write the script; whoever maintains the Slackware package for
PostgreSQL did. Regardless, I'll make the changes you suggest.

> In particular, I wonder whether the script's refusal to start if the
> pidfile already exists accounts for your report that it fails to
> auto-restart after a reboot.

This clears up my uncertainty. The pidfile should not exist after a clean
shutdown, so it should be removed after a crash, too.

> could be reduced to just:
>
> else
> su postgres -c 'postgres -D /var/lib/pgsql/data &'
> exit 0
> fi
>
> I'd also strongly recommend making that be "su - postgres -c ..."
> rather than the way it is now; it's failing to ensure that the
> postmaster is started with the postgres account's login settings.

Done. I wondered about the 'su postgres' because when I run that on the
command line I'm asked for the postgres password. I suppose that since
root's running the init file it's not asked.

> I'm not sure about your comment that manual start attempts fail with
> LOG: could not bind IPv4 socket: Address already in use
> It's pretty hard to believe that that could occur on a freshly
> booted system unless the TCP port was in fact already in use ---
> ie, either there *is* a running postmaster, or something else is
> using port 5432.

I'm not seeing this now, but running the revised script (as root) still
produces this:

Starting PostgreSQL
3753
3755
3756
3757
3758
16481
PostgreSQL daemon already running
Warning: Missing pid file /var/lib/pgsql/data/postmaster.pid

Yet, when I try to access one of my databases I cannot:

[rshepard(at)salmo ~]$ psql aesi
psql: could not connect to server: No such file or directory
Is the server running locally and accepting
connections on Unix domain socket "/tmp/.s.PGSQL.5432"?

There was no postgres running before I ran /etc/rc.d/rc.postgresql start.
There is also no socket on /tmp.

I'd greatly appreciate learning why the startup script is not working so I
can be confident that either the rc.postgresql file or my command line
invocation will consistenly work properly to start the server. I will
provide whatever system information is needed to help diagnose and fix this
problem.

Many thanks,

Rich

Many thanks,

Rich

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Scott Marlowe 2010-10-21 17:29:27 Re: Updates, deletes and inserts are very slow. What can I do make them bearable?
Previous Message Rob Sargent 2010-10-21 17:18:41 Re: Updates, deletes and inserts are very slow. What can I do make them bearable?