Ubuntu – PostgreSQL 9.1 on Ubuntu Lucid fails to start – how to debug

chef-solopostgresqlUbuntuubuntu-10.04vagrant

I'm using Vagrant with Chef Solo to setup a Lucid 64 box.

I'm using a Chef recipe to install PostgreSQL 9.1 from Martin Pitt's backports.

The install goes ok until the point where the database is started with

/etc/init.d/postgresql start

There's a log pause and the command fails.

If I run pg_ctl manually, the database starts!

The entire contents of my postgresql-9.1-main log file is:

2012-05-07 11:01:18 PDT LOG:  database system was shut down at 2012-05-07 11:01:16 PDT
2012-05-07 11:01:18 PDT LOG:  database system is ready to accept connections
2012-05-07 11:01:18 PDT LOG:  autovacuum launcher started
2012-05-07 11:01:18 PDT LOG:  incomplete startup packet
2012-05-07 11:01:26 PDT LOG:  received fast shutdown request
2012-05-07 11:01:26 PDT LOG:  aborting any active transactions
2012-05-07 11:01:26 PDT LOG:  autovacuum launcher shutting down
2012-05-07 11:01:26 PDT LOG:  shutting down
2012-05-07 11:01:26 PDT LOG:  database system is shut down

I've tried to change the postgresql config file to get more info into the logfile, but that hasn't worked at all.

How do I debug this to find out what is failing so I can fix it?

Best Answer

Some things I would start with:

  • ensure that postgresql is not already running
  • check permisssions on /var/lib/postgresql/9.1/main

However I would advise starting postgresql using pg_ctlcluster. This script is called by the init script, and is a wrapper for pg_ctl which among other things performs several sanity checks. If those checks were to fail, they would prevent postgresql from starting.

pg_ctlcluster 9.1 main start