[Pkg-postgresql-public] Bug#819442: Bug#819442: postgresql-common: pg_ctlcluster fails if data directory is not in the standard place

Christoph Berg myon at debian.org
Thu Nov 24 14:33:04 UTC 2016

Control: tags -1 moreinfo
Control: severity -1 normal

Re: Oliver Elphick 2016-03-28 <145917708743.17099.3256500088838331355.reportbug at phoenix.lfix.co.uk>
> pg_ctlcluster reads the config files and appears to launch the pg_ctl command
> with '-D /lvhome/postgresql/<version>/<cluster>'.  However the -D option to
> pg_ctl specifies where the config file is to be found. (Its brief description
> is misleading.)  Therefore postgresql does not start from the init script or
> from systemctl.
> Debugging pg_ctlcluster:
> DB<12> p $pg_ctl," ", @options
> /usr/lib/postgresql/9.5/bin/pg_ctl
> /usr/lib/postgresql/9.5/bin/pg_ctlstart-D/lvhome/postgresql/9.5/main-l/var/log/postgresql/postgresql-9.5-main.log-s-o
> -c config_file="/etc/postgresql/9.5/main/postgresql.conf"

Hi Oliver,

thanks for the report.

pg_ctlcluster does pass "-c config_file" to pg_ctl (and in turn to
postgres), which I believe has been the state of affairs since
postgresql-common was invented (and possibly even before that, when
your name was still on the postgresql packages :D). Non-standard
PGDATA locations are supported and generally work.

So the problem must have been elsewhere in the interaction of
postgresql-common with your setup. Can you still reproduce it?

> Specifying 'pg_ctl -D /etc/postgresql/<version>/<cluster>' does work.
> The solution is not to parse /etc/postgresql/<version/<cluster>/postgresql.conf
> for the data directory, since this is unnecessary.

That said, I believe the "-c config_file" invocation dates back from
the time when data_directory didn't exist yet, and could well be
replaced by what you are suggesting now. I'll likely implement that
after doing some testing.

> Apart from the fix, I suggest that some other logging of errors be
> done where the server fails to start. 
> in this case, there was no log anywhere, since the server failed to
> find its configuration file.

It's actually supposed to do that, but there's so many corner cases...
Will check.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 801 bytes
Desc: not available
URL: <http://lists.alioth.debian.org/pipermail/pkg-postgresql-public/attachments/20161124/8394b1c4/attachment.sig>

More information about the Pkg-postgresql-public mailing list