I have a server which was happily running PostgreSQL, until a crash this morning. Trying to restart Postgres, but it fails:

sudo /etc/init.d/postgresql start   
Starting PostgreSQL 9.1 database server
Removed stale pid file.    
The PostgreSQL server failed to start. Please check the log output:   

Doing tail /var/log/postgresql/postgresql-9.1-main.log, I see several messages from before it crashed -- but no output from the restart. The older messages say:

UTC WARNING: pgstat wait timeout   

OS: Ubuntu 12.04.3

migrated from superuser.com May 6 '14 at 1:56

This question came from our site for computer enthusiasts and power users.


For folks who might have the same problem.

I betcha you had a stuck shared memory segment.

Here we show our shared memory segments. Postgres has a big one for shared_buffers. This user can be different for different builds, some use "pgsql"

[root@host~]#  ipcs -m

------ Shared Memory Segments --------
key        shmid      owner      perms      bytes      nattch     status
0xf90007aa 0          root       600        222        1
0x0052e2c1 32769      postgres   600        6602235904 95

MAKE SURE YOUR SERVER IS REALLY DOWN FIRST! Check the "nattch" which is the number of attached processes. Check for any running postgres/pgsql processes.

[root@host ~]# ps -fu postgres
[root@host ~]# 

Nothing, that's good. Now, you can remove the shared memory segment

ipcrm -m 32769

Rebooting works too, but we don't like to do that :-)


Rebooting the server seems to have fixed it.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.