show postmaster stderr on startup failure

Bug #1020043 reported by Johan
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
postgresql-common (Ubuntu)
Triaged
Medium
Unassigned

Bug Description

The following output can be observed under various configurations (for example: disk full, but there are other conditions )

/etc/init.d/postgresql start
 * Starting PostgreSQL 9.1 database server
 * The PostgreSQL server failed to start. Please check the log output.
   ...fail!

Now, take the case were the disk is full, this means that there isn't any log output, which means that the error message is extremely bad.

To make things worse, IIRC, the Ubuntu scripts throw away stderr which means that even if postgresql returns a correct error message, that it is simply thrown away by default.

Martin Pitt (pitti)
summary: - postgresql logfile location not specified in error message and/or error
- message not visible anywhere
+ show postmaster stderr on startup failure
affects: postgresql-9.1 (Ubuntu) → postgresql-common (Ubuntu)
Changed in postgresql-common (Ubuntu):
importance: Undecided → Medium
status: New → Triaged
assignee: nobody → Martin Pitt (pitti)
Revision history for this message
Martin Pitt (pitti) wrote :

I wrote a test case for this. It seems that postgresql does a rather bad job of reporting the problem when the disk is full.

- First hurdle is that pg_ctlcluster redirects pg_ctl's stdout and error to /dev/null, as you need to detach it from the current terminal (as per manpage). But that can be fixed by redirecting it to a pipe instead.

- Second, we do not call pg_ctl with -w to wait for the startup. I think we should, it should get us rid of the port polling.

But even after this, the postmaster does not report any error:

$ /usr/lib/postgresql/9.1/bin/pg_ctl start -D /var/lib/postgresql/9.1/test -l /var/log/postgresql/postgresql-9.1-test.log -w -o '-c config_file="/etc/postgresql/9.1/test/postgresql.conf"'
waiting for server to start........ stopped waiting
pg_ctl: could not start server
Examine the log output.

So before this gets useful, we'll need to fix pg_ctl/postmaster first to actually do report the error to stderr.

Revision history for this message
Martin Pitt (pitti) wrote :

In trunk I just fixed the case when there is log output, but the log file was empty initially. But I just noticed that as a side issue.

Changed in postgresql-9.1 (Ubuntu):
status: New → Triaged
Martin Pitt (pitti)
no longer affects: postgresql-9.1 (Ubuntu)
Martin Pitt (pitti)
Changed in postgresql-common (Ubuntu):
assignee: Martin Pitt (pitti) → nobody
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.