[Pkg-postgresql-public] Bug#710093: postgresql: not started automatically after installation in chroot

Christoph Berg myon at debian.org
Thu May 30 04:00:57 UTC 2013


Control: tags -1 moreinfo

Re: Andreas Beckmann 2013-05-28 <20130528082018.7493.49330.reportbug at cake.ae.cs.uni-frankfurt.de>
> I'm experimenting with db support for piuparts tests and therefore
> postgresql needs to be installed and started in the test chroots.

Fwiw, which services/packages come with out-of-the-box usable
PostgreSQL support? For me, dbconfig-common sort of never works...

For testing stuff we've recently added a pg_virtualenv wrapper to
postgresql-common that will fire up a PG cluster with all PG* env vars
set such you can access it, and if the script you give it exits, it
will remove the cluster again. (Currently it needs root, there will be
non-root support in the upcoming version 144, check bzr.)

> Until now this worked fine (with an adjusted policy-rc.d that allows
> starting of certain services), but has recently stopped to do so in
> sid. It still works fine in wheezy.

I touched the "create cluster" part a bit, but I don't think that's
your problem:

diff -pu ../wheezy/debian/maintscripts-functions debian/maintscripts-functions 
--- ../wheezy/debian/maintscripts-functions	2012-10-15 07:00:27.000000000 -0700
+++ debian/maintscripts-functions	2013-05-10 18:52:30.000000000 -0700
[...]
@@ -29,7 +32,10 @@ configure_version() {
     [ "$VERSION" ] || { echo "Error: configure_version: need version parameter" >&2; exit 1; }
     if [ ! -d "/etc/postgresql/$VERSION" ] || [ -z "$(ls /etc/postgresql/$VERSION)" ] || \
        [ -z "$(ls /etc/postgresql/$VERSION/*/postgresql.conf 2>/dev/null)" ]; then
-        [ "$2" ] || /usr/bin/pg_createcluster -u postgres $VERSION main || {
+        # skip creating the main cluster when this is not the first install, or
+        # when explicitely disabled ($create is 1/0/"")
+        create=$(perl -I/usr/share/postgresql-common -mPgCommon -e 'print PgCommon::config_bool(PgCommon::get_conf_value 0, 0, "createcluster.conf", "create_main_cluster")')
+        [ "$2" ] || [ "$create" = "0" ] || /usr/bin/pg_createcluster -u postgres $VERSION main || {
 	echo "Error: could not create default cluster. Please create it manually with
 
   pg_createcluster $VERSION main --start


> apt-get install postgresql in the chroot ends with
> 
> ...
>   Setting up libpq5 (9.1.9-1) ...
>   Setting up openssl (1.0.1e-3) ...
>   Setting up postgresql-client-common (143) ...
>   Setting up postgresql-client-9.1 (9.1.9-1) ...
>   update-alternatives: using /usr/share/postgresql/9.1/man/man1/psql.1.gz to provide /usr/share/man/man1/psql.1.gz (psql.1.gz) in auto mode
>   Setting up ssl-cert (1.0.32) ...
>   Setting up postgresql-common (143) ...
>   Adding user postgres to group ssl-cert
>   Building PostgreSQL dictionaries from installed myspell/hunspell packages...
>   Removing obsolete dictionary files:
>   No PostgreSQL clusters exist; see "man pg_createcluster" ... (warning).
>   Setting up postgresql-9.1 (9.1.9-1) ...
>   Creating new cluster 9.1/main ...
>     config /etc/postgresql/9.1/main
>     data   /var/lib/postgresql/9.1/main
>     locale C
>     port   5432
>   update-alternatives: using /usr/share/postgresql/9.1/man/man1/postmaster.1.gz to provide /usr/share/man/man1/postmaster.1.gz (postmaster.1.gz) in auto mode
>   Starting PostgreSQL 9.1 database server: main.
>   Setting up postgresql (9.3+142really9.1+143) ...
>   Processing triggers for libc-bin ...
>   ldconfig deferred processing now taking place
> 
> and this looks like some service should be running, but it is not.
> I could now chroot into the installation and run manually
>   invoke-rc.d postgresql start
> and this will work.

Can you check /var/log/postgresql/ if there's any error messages for
the first startup?

Christoph
-- 
cb at df7cb.de | http://www.df7cb.de/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.alioth.debian.org/pipermail/pkg-postgresql-public/attachments/20130529/f185711a/attachment.pgp>


More information about the Pkg-postgresql-public mailing list