Hello all,

Xavi Drudis Ferran [2009-01-04  3:31 +0100]:
> I one it run ok, but in the other it didn't create the main cluster.
> /etc/postgresql and /var/lib/postgresql were empty after
> installation. 
>
> I tried /etc/init.d/postgresql-8.3 restart ,  aptitude reinstall and
> purge and install but still it wouldn't create it. 

Unfortunately I'm still in the dark about this one; in particular, I
haven't been able to reproduce the situation where /etc/postgresql/
exists, but is empty.

So let's collect some finer details here.

First, I assume that most of you installed postgresql-8.3 *after* the
initial Debian installation, i. e. you did not choose the database
server task in debian-installer? If you did, then please have a look
at /var/log/installer and check if they have anything regarding to
postgresql, in particular the package install log.

But many reporters pointed out that the installed PostgreSQL later,
thus I don't think it is an install-time only bug. Can anyone of you
still say whether you already had the package "locales" installed when
you installed postgresql-8.3? Did you have a locale configured and
used?

I bootstrapped a fresh lenny system and did three experiments (with
cleaning up after everyone with "apt-get purge --auto-remove
postgresql-8.3", which removes everything down to libxml2, python,
perl-modules, etc.)

 - Installing postgresql-8.3 without any $LANG or $LC_ALL set. This
   works fine, I get a default 8.3/main cluster with C encoding
   (SQL_ASCII).

 - Installing postgresql-8.3 without locales installed, but
   LANG=de_DE.UTF-8. As expected, I get lots of "invalid locale"
   errors for packages, and postgresql-8.3 does not configure a
   cluster because of the invalid locale:

   |Setting up postgresql-8.3 (8.3.6-1) ...
   |perl: warning: Setting locale failed.
   |perl: warning: Please check that your locale settings:
   |    LANGUAGE = (unset),
   |    LC_ALL = (unset),
   |    LANG = "de_DE.UTF-8"
   |    are supported and installed on your system.
   |perl: warning: Falling back to the standard locale ("C").
   |Error: The locale requested by the environment is invalid.
   |Error: could not create default cluster. Please create it manually with
   |
   |  pg_createcluster 8.3 main --start
   |
   |or a similar command (see 'man pg_createcluster').

   However, in this case /etc/postgresql/ is *not* created. This makes
   me believe that the error you encountered is not tied to locales
   (because it is also pretty uncommon to have broken locales, and I
   got so many reports about this problem).

  - Generating de_DE.UTF-8 locale, installing postgresql-8.3. Works
    flawlessly and I get an 8.3/main cluster automatically.

Finally, just to make sure, I did the same experiment with installing
"postgresql" instead of "postgresql-8.3". It's just an empty
metapackage, though, and as expected it gives exactly the same
results.

So let's have a closer look at the code. Either the cluster is not
even attempted to be created, or it fails to do so.

First, failure case: This usually happens if the locale is invalid,
but that wouldn't leave an /etc/postgresql/ behind (see above). Then
there can be all sorts of file system things, such as /var not being
writable, but since it works with a manual pg_createcluster, I don't
believe that this is the reason for all your reports.

Then, the "not attempted" case: This is determined in
/usr/share/postgresql-common/maintscripts-functions,
configure_version():

   |# arguments: <major version> <most recently configured package version>
   |configure_version() {
   |    VERSION="$1"
   |
   |    # Create a main cluster for given version ($1) if no cluster already 
exists
   |    # for that version and we are installing from scratch.
   |    [ "$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 || {
   |        echo "Error: could not create default cluster. Please create it 
manually with
   |
   |  pg_createcluster $VERSION main --start
   |
   |or a similar command (see 'man pg_createcluster')." >&2
   |        }
   |    fi
   |
   |    _link_manpages "$VERSION" "postgresql-$VERSION" postmaster.1.gz
   |}

So this means that a cluster is only created automatically if:

 1. /etc/postgresql/8.3/ does not exist, or /etc/postgresql/8.3/ is
    empty, or /etc/postgresql/8.3/main/postgresql.conf does not exist
 2. The package postgresql-8.3 was not installed before, or was
    purged.

It seems very unlikely to me that those conditions were not met with a
fresh Lenny install, though, but perhaps it gives some of you a clue
what could have happened.

How exactly did you install Lenny? Which medium, which tasks, which
locales? Could any of you attach the installer logs
(/var/log/installer)?

Thanks,

Martin

-- 
Martin Pitt                        | http://www.piware.de
Ubuntu Developer (www.ubuntu.com)  | Debian Developer  (www.debian.org)

Attachment: signature.asc
Description: Digital signature

Reply via email to