I recently had another electrical power outage that left my machine unable to restart postgresql. I had previously reported this a while ago:

http://archives.postgresql.org/pgsql-general/2005-04/msg01286.php

Anyway, because I have seen this problem before, I knew exactly what the solution to the problem was (delete the postmaster.pid file), but for yucks I decided to imagine I did not know. What would I need to do to figure this out.

[EMAIL PROTECTED] ~]# cat /etc/issue
Fedora Core release 5 (Bordeaux)
[EMAIL PROTECTED] ~]# rpm -q postgresql
postgresql-8.1.4-1.FC5.1

Looking in /etc/init.d/postgresql I found that this file exists:
/var/lib/pgsql/pgstartup.log

[EMAIL PROTECTED] ~]# grep PGLOG /etc/init.d/postgresql
PGLOG=/var/lib/pgsql/pgstartup.log

Looking at $PGLOG, I discovered:
FATAL: pre-existing shared memory block (key 5432001, ID 65536) is still in use HINT: If you're sure there are no old server processes still running, remove the shared memory block with the command "ipcclean", "ipcrm", or just delete the file "postmaster.pid".

From this commentary, to find "postmaster.pid" I ran:
[EMAIL PROTECTED] ~]# find /var | grep postmaster.pid
/var/lib/pgsql/data/postmaster.pid

[EMAIL PROTECTED] ~]# rm /var/lib/pgsql/data/postmaster.pid
[EMAIL PROTECTED] ~]# service postgresql start
Starting postgresql service:                               [  OK  ]

I am a long time pgsql user, and it still took me a while (and some hunting) to find the solution to this problem. This may be a real stumbling block of a new user. According to commentary on my report from April 2005, Tom mentions that there was an automated solution to this issue in v8.0.2:

http://archives.postgresql.org/pgsql-general/2005-04/msg01289.php

I can reproduce this problem in v8.1.4 by these simple steps:

[EMAIL PROTECTED] ~]# service postgresql start
Starting postgresql service:                               [  OK  ]
[EMAIL PROTECTED] ~]# service postgresql stop
Stopping postgresql service:                               [  OK  ]
[EMAIL PROTECTED] ~]# touch /var/lib/pgsql/data/postmaster.pid
[EMAIL PROTECTED] ~]# service postgresql start
Starting postgresql service:                               [FAILED]
[EMAIL PROTECTED] ~]# rm /var/lib/pgsql/data/postmaster.pid
[EMAIL PROTECTED] ~]# service postgresql start
Starting postgresql service:                               [  OK  ]

PS: This email is just a FYI, not a complaint. Maybe it is just a right of passage that users of postgresql will just have to learn about this.

--
-**-*-*---*-*---*-*---*-----*-*-----*---*-*---*-----*-----*-*-----*---
 Jon Lapham  <[EMAIL PROTECTED]>                Rio de Janeiro, Brasil
 Personal: http://www.jandr.org/
***-*--*----*-------*------------*--------------------*---------------


---------------------------(end of broadcast)---------------------------
TIP 4: Have you searched our list archives?

              http://archives.postgresql.org

Reply via email to