Thread: Debian upgrade and PGSQL pid file

Debian upgrade and PGSQL pid file

From
Tom Allison
Date:
A while back I threw together a postgresql installation on a computer with a
RAID disk for performance reasons.  I never got it working 100% since it was
just a quick weekend adventure and I never expected much to come of it.


Famous last words...

I'm not trying to upgrade the database via debians recent release and ran into
an error from the debian scripts:

Preparing to replace postgresql-8.1 8.1.5-1 (using
.../postgresql-8.1_8.1.8-1_i386.deb) ...
Stopping PostgreSQL 8.1 database server: main* Error: pid file is invalid,
please manually kill the stale server process.
  failed!
invoke-rc.d: initscript postgresql-8.1, action "stop" failed.
dpkg: warning - old pre-removal script returned error exit status 1
dpkg - trying script from the new package instead ...
Stopping PostgreSQL 8.1 database server: main* Error: pid file is invalid,
please manually kill the stale server process.
  failed!
invoke-rc.d: initscript postgresql-8.1, action "stop" failed.

------------
 From the postgres config file I have:
# The default values of these variables are driven from the -D command line
# switch or PGDATA environment variable, represented here as ConfigDir.

data_directory = '/raid/postgresql/'                    # use data in another
directory
hba_file = '/etc/postgresql/8.1/main/pg_hba.conf'       # host-based
authentication file
ident_file = '/etc/postgresql/8.1/main/pg_ident.conf'   # IDENT configuration file

# If external_pid_file is not explicitly set, no extra pid file is written.
external_pid_file = '/var/run/postgresql/8.1-main.pid'          # write an extra
pid file

----------------
This is my mount entry for my /raid/ partition
/dev/md0 on /raid type reiserfs (rw,noatime)


---------------
I actually have a pid file in both locations:
/raid/postgresql/postmaster.pid,
/var/run/postgresql/8.1-main.pid

So I guess it never reall worked right.
BTW: PG_VERSION says 8.1

And:
/raid/postgresql/ has a *lot* of files I was expecting to see somewhere else
(like /etc/postgresql)

CoolerMaster:/raid/postgresql# ls -l
total 37
-rw------- 1 postgres postgres     4 Dec  4 03:35 PG_VERSION
drwx------ 9 postgres postgres   216 Jan 24 20:37 base
drwx------ 2 postgres postgres   672 Apr 10 06:00 global
drwx------ 2 postgres postgres    96 Apr  1 19:14 pg_clog
-rw------- 1 postgres postgres  3396 Dec  4 03:35 pg_hba.conf
-rw------- 1 postgres postgres  1460 Dec  4 03:35 pg_ident.conf
drwx------ 4 postgres postgres    96 Dec  4 03:35 pg_multixact
drwx------ 2 postgres postgres    72 Apr  6 14:19 pg_subtrans
drwx------ 2 postgres postgres    48 Dec  4 03:35 pg_tblspc
drwx------ 2 postgres postgres    48 Dec  4 03:35 pg_twophase
drwx------ 3 postgres postgres   880 Apr 10 02:22 pg_xlog
-rw------- 1 postgres postgres 13682 Dec  4 03:35 postgresql.conf
-rw------- 1 postgres postgres   125 Mar  9 05:36 postmaster.opts
-rw------- 1 postgres postgres    42 Mar  9 05:36 postmaster.pid
CoolerMaster:/raid/postgresql# cat PG_VERSION
8.1

My permissions setting in pg_hba.conf indicate that I'm using the pg_hba.conf
from /etc/postgresql/... and not this one listed above.  So I'm not really sure
what they are even doing here, but am hesitant to just delete them.

How should it work and how do I get it there?

Re: Debian upgrade and PGSQL pid file

From
Martijn van Oosterhout
Date:
On Tue, Apr 10, 2007 at 06:01:34AM -0400, Tom Allison wrote:
> A while back I threw together a postgresql installation on a computer with
> a RAID disk for performance reasons.  I never got it working 100% since it
> was just a quick weekend adventure and I never expected much to come of it.

Firstly, there's a README specifically for Debian in the postgres
packages, I suggest you read it, it has lots of information about the
way Debian has it setup.

> I'm not trying to upgrade the database via debians recent release and ran
> into an error from the debian scripts:
>
> Preparing to replace postgresql-8.1 8.1.5-1 (using
> .../postgresql-8.1_8.1.8-1_i386.deb) ...
> Stopping PostgreSQL 8.1 database server: main* Error: pid file is invalid,
> please manually kill the stale server process.
>  failed!

Is there still a server running, or not? If not, delete to pid file.
That should work better.

> ---------------
> I actually have a pid file in both locations:
> /raid/postgresql/postmaster.pid,
> /var/run/postgresql/8.1-main.pid

No, that's normal. One is maintained by the postmaster, the other by
the init script.

> /raid/postgresql/ has a *lot* of files I was expecting to see somewhere
> else (like /etc/postgresql)

How did you create that structure? If you did an initdb then it's
expected, some postgres initdb doesn't know about clusters. If you use
used pg_createcluster I beleive that should have been taken care of. In
either case I think they're harmless (if confusing).

> How should it work and how do I get it there?

If you make sure the server is down, you should just be able to delete
the pid file and upgrade...

Have a nice day,
--
Martijn van Oosterhout   <kleptog@svana.org>   http://svana.org/kleptog/
> From each according to his ability. To each according to his ability to litigate.

Attachment

Re: Debian upgrade and PGSQL pid file

From
Date:
OK, I can do some reading and such.
But first I will run pg_dump just in case...


On 4/10/2007, "Martijn van Oosterhout" <kleptog@svana.org> wrote:

>On Tue, Apr 10, 2007 at 06:01:34AM -0400, Tom Allison wrote:
>> A while back I threw together a postgresql installation on a computer with
>> a RAID disk for performance reasons.  I never got it working 100% since it
>> was just a quick weekend adventure and I never expected much to come of it.
>
>Firstly, there's a README specifically for Debian in the postgres
>packages, I suggest you read it, it has lots of information about the
>way Debian has it setup.
>
>> I'm not trying to upgrade the database via debians recent release and ran
>> into an error from the debian scripts:
>>
>> Preparing to replace postgresql-8.1 8.1.5-1 (using
>> .../postgresql-8.1_8.1.8-1_i386.deb) ...
>> Stopping PostgreSQL 8.1 database server: main* Error: pid file is invalid,
>> please manually kill the stale server process.
>>  failed!
>
>Is there still a server running, or not? If not, delete to pid file.
>That should work better.
>
>> ---------------
>> I actually have a pid file in both locations:
>> /raid/postgresql/postmaster.pid,
>> /var/run/postgresql/8.1-main.pid
>
>No, that's normal. One is maintained by the postmaster, the other by
>the init script.
>
>> /raid/postgresql/ has a *lot* of files I was expecting to see somewhere
>> else (like /etc/postgresql)
>
>How did you create that structure? If you did an initdb then it's
>expected, some postgres initdb doesn't know about clusters. If you use
>used pg_createcluster I beleive that should have been taken care of. In
>either case I think they're harmless (if confusing).
>
>> How should it work and how do I get it there?
>
>If you make sure the server is down, you should just be able to delete
>the pid file and upgrade...
>
>Have a nice day,
>--
>Martijn van Oosterhout   <kleptog@svana.org>   http://svana.org/kleptog/
>> From each according to his ability. To each according to his ability to litigate.