Обсуждение: Postgres won't start

Поиск
Список
Период
Сортировка

Postgres won't start

От
Oliver Elphick
Дата:
Linux Mint (from Ubuntu) version 9.1.

Postgres will no longer start, but I cannot find out why.

Command line:
$ /usr/lib/postgresql/9.1/bin/pg_ctl start -D /home/postgresql/9.1/main -l /var/log/postgresql/postgresql-9.1-main.log -s -w -o '-c config_file="/etc/postgresql/9.1/main/postgresql.conf"'
pg_ctl: could not start server
Examine the log output.


There is no error message in the log:
2013-08-08 21:35:33 GMT DEBUG:  postgres: PostmasterMain: initial environment dump:
2013-08-08 21:35:33 GMT DEBUG:  -----------------------------------------
2013-08-08 21:35:33 GMT DEBUG:   MAIL=/var/mail/postgres
2013-08-08 21:35:33 GMT DEBUG:   USER=postgres
2013-08-08 21:35:33 GMT DEBUG:   LANGUAGE=en_GB:en
2013-08-08 21:35:33 GMT DEBUG:   LC_TIME=C
2013-08-08 21:35:33 GMT DEBUG:   SHLVL=1
2013-08-08 21:35:33 GMT DEBUG:   HOME=/var/lib/postgresql
2013-08-08 21:35:33 GMT DEBUG:   XDG_SESSION_COOKIE=4464da00797efbf61ba9be4b517969c3-1375997124.817437-835692463
2013-08-08 21:35:33 GMT DEBUG:   LC_MONETARY=C
2013-08-08 21:35:33 GMT DEBUG:   COLORTERM=mate-terminal
2013-08-08 21:35:33 GMT DEBUG:   PG_GRANDPARENT_PID=15848
2013-08-08 21:35:33 GMT DEBUG:   LOGNAME=postgres
2013-08-08 21:35:33 GMT DEBUG:   _=/usr/lib/postgresql/9.1/bin/pg_ctl
2013-08-08 21:35:33 GMT DEBUG:   TERM=xterm
2013-08-08 21:35:33 GMT DEBUG:   PGLOCALEDIR=/usr/share/locale
2013-08-08 21:35:33 GMT DEBUG:   PGSYSCONFDIR=/etc/postgresql-common
2013-08-08 21:35:33 GMT DEBUG:   PATH=/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games
2013-08-08 21:35:33 GMT DEBUG:   LC_ADDRESS=en_GB.UTF-8
2013-08-08 21:35:33 GMT DEBUG:   XDG_RUNTIME_DIR=/run/user/postgres
2013-08-08 21:35:33 GMT DEBUG:   DISPLAY=:0
2013-08-08 21:35:33 GMT DEBUG:   LC_TELEPHONE=en_GB.UTF-8
2013-08-08 21:35:33 GMT DEBUG:   LANG=en_GB.UTF-8
2013-08-08 21:35:33 GMT DEBUG:   XAUTHORITY=/home/olly/.Xauthority
2013-08-08 21:35:33 GMT DEBUG:   SHELL=/bin/bash
2013-08-08 21:35:33 GMT DEBUG:   LC_NAME=en_GB.UTF-8
2013-08-08 21:35:33 GMT DEBUG:   LC_MEASUREMENT=en_GB.UTF-8
2013-08-08 21:35:33 GMT DEBUG:   LC_IDENTIFICATION=en_GB.UTF-8
2013-08-08 21:35:33 GMT DEBUG:   PWD=/var/lib/postgresql
2013-08-08 21:35:33 GMT DEBUG:   LC_NUMERIC=C
2013-08-08 21:35:33 GMT DEBUG:   LC_PAPER=en_GB.UTF-8
2013-08-08 21:35:33 GMT DEBUG:   PGDATA=/home/postgresql/9.1/main
2013-08-08 21:35:33 GMT DEBUG:   LC_COLLATE=en_GB.UTF-8
2013-08-08 21:35:33 GMT DEBUG:   LC_CTYPE=en_GB.UTF-8
2013-08-08 21:35:33 GMT DEBUG:   LC_MESSAGES=en_GB.UTF-8
2013-08-08 21:35:33 GMT DEBUG:  -----------------------------------------
2013-08-08 21:35:33 GMT DEBUG:  TZ "localtime" gets max score 5200
2013-08-08 21:35:33 GMT DEBUG:  TZ "Singapore" scores 0: at 1357776000 2013-01-10 08:00:00 std versus 2013-01-10 01:00:00 std
2013-08-08 21:35:33 GMT DEBUG:  TZ "GMT" scores 0: at 1357776000 2013-01-10 00:00:00 std versus 2013-01-10 01:00:00 std
...[many lines of timezone info deleted]...
2013-08-08 21:35:34 GMT DEBUG:  TZ "Atlantic/St_Helena" scores 0: at 1357776000 2013-01-10 00:00:00 std versus 2013-01-10 01:00:00 std
2013-08-08 23:35:34 CEST DEBUG:  invoking IpcMemoryCreate(size=32399360)
2013-08-08 23:35:34 CEST DEBUG:  removing file "pg_notify/0000"
2013-08-08 23:35:34 CEST DEBUG:  max_safe_fds = 985, usable_fds = 1000, already_open = 5
2013-08-08 23:35:34 CEST DEBUG:  logger shutting down
2013-08-08 23:35:34 CEST DEBUG:  shmem_exit(0): 0 callbacks to make
2013-08-08 23:35:34 CEST DEBUG:  proc_exit(0): 0 callbacks to make
2013-08-08 23:35:34 CEST DEBUG:  exit(0)
2013-08-08 23:35:34 CEST DEBUG:  shmem_exit(-1): 0 callbacks to make
2013-08-08 23:35:34 CEST DEBUG:  proc_exit(-1): 0 callbacks to make


# cat /proc/sys/kernel/shmmax
33554432

I increased this to 64Mb
#  cat /proc/sys/kernel/shmmax
67108864

but it made no difference

Re: Postgres won't start

От
Adrian Klaver
Дата:
On 08/08/2013 03:02 PM, Oliver Elphick wrote:
> Linux Mint (from Ubuntu) version 9.1.
>
> Postgres will no longer start, but I cannot find out why.

So anything happen between the last time it started and now?:

Upgrade of Postgres?
Upgrade of Mint?
Something else?

>
> Command line:
> $ /usr/lib/postgresql/9.1/bin/pg_ctl start -D /home/postgresql/9.1/main
> -l /var/log/postgresql/postgresql-9.1-main.log -s -w -o '-c
> config_file="/etc/postgresql/9.1/main/postgresql.conf"'
> pg_ctl: could not start server


--
Adrian Klaver
adrian.klaver@gmail.com


Re: Postgres won't start

От
Adrian Klaver
Дата:
On 08/08/2013 03:17 PM, Oliver Elphick wrote:
> I tried to change the listen_addresses line in postgresql.conf, by
> adding an IPv6 address. On meeting problems I tried changing it back.

What problems?

Have you run ps to see if there is another instance of Postgres running?

>
> Currently it says:
>
> listen_addresses = 'localhost'
>


--
Adrian Klaver
adrian.klaver@gmail.com


Re: Postgres won't start

От
Oliver Elphick
Дата:
To start with, it worked but the pg_hba.conf entry appeared to be wrong.  I tried changing that and then the current problem started.  I tried "listen_addresses = '*'"; then back to just 'localhost'.

Since I have maximum logging enabled, I don't think it is getting as far as reading the configuration files - that is not mentioned in the log.

There is no other instance of postgres running.


On 9 August 2013 00:59, Oliver Elphick <olly@lfix.co.uk> wrote:
To start with, it worked but the pg_hba.conf entry appeared to be wrong.  I tried changing that and then the current problem started.  I tried "listen_addresses = '*'"; then back to just 'localhost'.

Since I have maximum logging enabled, I don't think it is getting as far as reading the configuration files - that is not mentioned in the log.

There is no other instance of postgres running.


On 9 August 2013 00:29, Adrian Klaver <adrian.klaver@gmail.com> wrote:
On 08/08/2013 03:17 PM, Oliver Elphick wrote:
I tried to change the listen_addresses line in postgresql.conf, by
adding an IPv6 address. On meeting problems I tried changing it back.

What problems?

Have you run ps to see if there is another instance of Postgres running?



Currently it says:

listen_addresses = 'localhost'



--
Adrian Klaver
adrian.klaver@gmail.com






--
Time is short - http://www.lfix.co.uk/disappearance.html

Re: Postgres won't start

От
Adrian Klaver
Дата:
On 08/08/2013 04:02 PM, Oliver Elphick wrote:
> To start with, it worked but the pg_hba.conf entry appeared to be wrong.
>   I tried changing that and then the current problem started.  I tried
> "listen_addresses = '*'"; then back to just 'localhost'.
>
> Since I have maximum logging enabled, I don't think it is getting as far
> as reading the configuration files - that is not mentioned in the log.
>
> There is no other instance of postgres running.

Hmmm. Two things, then I am tapped out for the time being:

1) Did you change the pg_hba.conf entry back?

2) What user are you running the pg_ctl command as?

>
>
>


--
Adrian Klaver
adrian.klaver@gmail.com


Re: Postgres won't start

От
Tom Lane
Дата:
Oliver Elphick <olly@lfix.co.uk> writes:
> Linux Mint (from Ubuntu) version 9.1.
> Postgres will no longer start, but I cannot find out why.

> Command line:
> $ /usr/lib/postgresql/9.1/bin/pg_ctl start -D /home/postgresql/9.1/main -l
> /var/log/postgresql/postgresql-9.1-main.log -s -w -o '-c
> config_file="/etc/postgresql/9.1/main/postgresql.conf"'
> pg_ctl: could not start server
> Examine the log output.

> There is no error message in the log:

This log file seems suspiciously incomplete.  Is it the file mentioned in
the pg_ctl -l switch?  If so, that file would only be used until the
syslogger process took over logging (which we know it did since we see its
exit messages in there).  To find out what happened after that, you need
to look wherever your postgresql.conf is telling PG to log.

I wonder whether we shouldn't change the syslogger to emit something to
stderr when it takes over logging, saying "logging is now redirected to
<someplace>".  This isn't the first case I've seen of people forgetting
to look in the right place.

            regards, tom lane


Re: Postgres won't start

От
Brar Piening
Дата:
On 9 August 2013 01:02, Oliver Elphick wrote:

Since I have maximum logging enabled, I don't think it is getting as far as reading the configuration files - that is not mentioned in the log.

I regularly run into problems when some editor adds a UTF-8 BOM to pg_hba.conf or postgresql.conf which renders the files unreadable for postgresql.

Regards,
Brar

Re: Postgres won't start

От
Oliver Elphick
Дата:
On 9 August 2013 02:49, Tom Lane <tgl@sss.pgh.pa.us> wrote:
I wonder whether we shouldn't change the syslogger to emit something to
stderr when it takes over logging, saying "logging is now redirected to
<someplace>".  


Shouldn't you also, or instead, log to stderr just before leaving it, in case the configuration of the new logging is faulty?

Re: Postgres won't start

От
Tom Lane
Дата:
Oliver Elphick <olly@lfix.co.uk> writes:
> On 9 August 2013 02:49, Tom Lane <tgl@sss.pgh.pa.us> wrote:
>> I wonder whether we shouldn't change the syslogger to emit something to
>> stderr when it takes over logging, saying "logging is now redirected to
>> <someplace>".

> Shouldn't you also, or instead, log to stderr just before leaving it, in
> case the configuration of the new logging is faulty?

I think the faulty-config case is (mostly?) covered already, in that we
check validity of GUC values before installing them.  The point of this
proposal is just to remind people that the "original" log file might not
be all the log output there is.  The cases that I've seen seemed to
usually involve package installations where people weren't really aware
of the nondefault logging choices that the packager had made.

Anyway, there's a concrete patch proposal in pgsql-hackers, at
http://www.postgresql.org/message-id/11372.1376015537@sss.pgh.pa.us
Please comment on that if you want to discuss details.

            regards, tom lane


Re: Postgres won't start

От
Tom Lane
Дата:
... btw, were you able to resolve your original problem?  What was it?

            regards, tom lane