pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
pg_ctl can't start db server
6+ messages / 4 participants
[nested] [flat]

* pg_ctl can't start db server
@ 2020-05-29 15:19  Tanja Savic <tanja.savic@crossmasters.com>
  0 siblings, 2 replies; 6+ messages in thread

From: Tanja Savic @ 2020-05-29 15:19 UTC (permalink / raw)
  To: pgsql-general@lists.postgresql.org <pgsql-general@lists.postgresql.org>

Hi,

We did the upgrade of PostgreSQL 10 to 12 on linux server. Everything was fine (can connect via pgAdmin, data is there...) except two tablespaces which are still in directory for PostgreSQL 10.
So we followed these steps to move tablespaces: https://www.enterprisedb.com/blog/moving-tablespaces-postgresql
The problem was at the end while executing:
$ pg_ctl start

This is the error trace:

pg_ctl: another server might be running; trying to start server anyway
waiting for server to start....postgres: could not access the server configuration file "/var/lib/postgresql/12/main/postgresql.conf": No such file or directory
stopped waiting
pg_ctl: could not start server
Examine the log output.

The configuration file path is /etc/postgresql/12/main/ postgresql.conf and it is configured in /var/lib/postgresql/12/main/postmaster.opts:

"/usr/lib/postgresql/12/bin/postgres "-D" "/var/lib/postgresql/12/main" "-c" "config_file=/etc/postgresql/12/main/postgresql.conf"

Why does pg_ctl complains about the postgresql.conf path?


Thank you,
Tanja

^ permalink  raw  reply  [nested|flat] 6+ messages in thread

* Re: pg_ctl can't start db server
@ 2020-05-29 15:32  Tom Lane <tgl@sss.pgh.pa.us>
  parent: Tanja Savic <tanja.savic@crossmasters.com>
  1 sibling, 1 reply; 6+ messages in thread

From: Tom Lane @ 2020-05-29 15:32 UTC (permalink / raw)
  To: Tanja Savic <tanja.savic@crossmasters.com>; +Cc: pgsql-general@lists.postgresql.org <pgsql-general@lists.postgresql.org>

Tanja Savic <tanja.savic@crossmasters.com> writes:
> The configuration file path is /etc/postgresql/12/main/ postgresql.conf and it is configured in /var/lib/postgresql/12/main/postmaster.opts:

> "/usr/lib/postgresql/12/bin/postgres "-D" "/var/lib/postgresql/12/main" "-c" "config_file=/etc/postgresql/12/main/postgresql.conf"

> Why does pg_ctl complains about the postgresql.conf path?

I don't remember the exact interaction between -D and an explicit
config_file setting, but evidently it's not working the way you wish.
See

https://www.postgresql.org/docs/current/runtime-config-file-locations.html

which suggests that you should use -D to point at the directory where
postgresql.conf is, and set the data directory with a parameter within
postgresql.conf.

(Note that pg_ctl probably only understands this way, even though
theoretically the postmaster can deal with other approaches to
setting up an external config file.)

			regards, tom lane





^ permalink  raw  reply  [nested|flat] 6+ messages in thread

* Re: pg_ctl can't start db server
@ 2020-05-29 18:22  Adrian Klaver <adrian.klaver@aklaver.com>
  parent: Tanja Savic <tanja.savic@crossmasters.com>
  1 sibling, 0 replies; 6+ messages in thread

From: Adrian Klaver @ 2020-05-29 18:22 UTC (permalink / raw)
  To: Tanja Savic <tanja.savic@crossmasters.com>; pgsql-general@lists.postgresql.org <pgsql-general@lists.postgresql.org>

On 5/29/20 8:19 AM, Tanja Savic wrote:
> Hi,
> 
> We did the upgrade of PostgreSQL 10 to 12 on linux server. Everything 
> was fine (can connect via pgAdmin, data is there…) except two 
> tablespaces which are still in directory for PostgreSQL 10.
> 
> So we followed these steps to move tablespaces: 
> https://www.enterprisedb.com/blog/moving-tablespaces-postgresql
> 
> The problem was at the end while executing:
> 
> $ pg_ctl start
> 
> This is the error trace:
> 
> pg_ctl: another server might be running; trying to start server anyway
> 
> waiting for server to start....postgres: could not access the server 
> configuration file "/var/lib/postgresql/12/main/postgresql.conf": No 
> such file or directory
> 
> stopped waiting
> 
> pg_ctl: could not start server
> 
> Examine the log output.
> 
> The configuration file path is /etc/postgresql/12/main/ postgresql.conf 
> and it is configured in /var/lib/postgresql/12/main/postmaster.opts:
> 
> “/usr/lib/postgresql/12/bin/postgres "-D" "/var/lib/postgresql/12/main" 
> "-c" "config_file=/etc/postgresql/12/main/postgresql.conf"
> 
> Why does pg_ctl complains about thepostgresql.conf path?

I'm guessing you are on Debian/Ubuntu?

If so what does the below show?:

pg_lsclusters

If it shows clusters then do:

sudo pg_ctlcluster 12 main start


If the above is not correct, then what user where you doing:

pg_ctl start

as?


> 
> Thank you,
> 
> Tanja
> 


-- 
Adrian Klaver
adrian.klaver@aklaver.com





^ permalink  raw  reply  [nested|flat] 6+ messages in thread

* RE: pg_ctl can't start db server
@ 2020-06-01 07:04  Tanja Savic <tanja.savic@crossmasters.com>
  parent: Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 2 replies; 6+ messages in thread

From: Tanja Savic @ 2020-06-01 07:04 UTC (permalink / raw)
  To: Tom Lane <tgl@sss.pgh.pa.us>; Adrian Klaver <adrian.klaver@aklaver.com>; +Cc: pgsql-general@lists.postgresql.org <pgsql-general@lists.postgresql.org>

Hi,

@Tom Adding -D in command worked. I just used 
pg_ctl start -D [data-directory ]

PGDATA was not set permanently although I tried to set it (with postgres user):
export PGDATA=" /var/lib/postgresql/12/main"

@Adrian It's Ubuntu and output of pg_lsclusters was this:
12  main    24538 online postgres /var/lib/postgresql/12/main /var/log/postgresql/postgresql-12-main.log

Thank you for your replies.
BR,
Tanja

-----Original Message-----
From: Tom Lane <tgl@sss.pgh.pa.us> 
Sent: Friday, May 29, 2020 5:32 PM
To: Tanja Savic <tanja.savic@crossmasters.com>
Cc: pgsql-general@lists.postgresql.org
Subject: Re: pg_ctl can't start db server

Tanja Savic <tanja.savic@crossmasters.com> writes:
> The configuration file path is /etc/postgresql/12/main/ postgresql.conf and it is configured in /var/lib/postgresql/12/main/postmaster.opts:

> "/usr/lib/postgresql/12/bin/postgres "-D" "/var/lib/postgresql/12/main" "-c" "config_file=/etc/postgresql/12/main/postgresql.conf"

> Why does pg_ctl complains about the postgresql.conf path?

I don't remember the exact interaction between -D and an explicit config_file setting, but evidently it's not working the way you wish.
See

https://www.postgresql.org/docs/current/runtime-config-file-locations.html

which suggests that you should use -D to point at the directory where postgresql.conf is, and set the data directory with a parameter within postgresql.conf.

(Note that pg_ctl probably only understands this way, even though theoretically the postmaster can deal with other approaches to setting up an external config file.)

			regards, tom lane





^ permalink  raw  reply  [nested|flat] 6+ messages in thread

* Re: pg_ctl can't start db server
@ 2020-06-01 07:19  Paul Förster <paul.foerster@gmail.com>
  parent: Tanja Savic <tanja.savic@crossmasters.com>
  1 sibling, 0 replies; 6+ messages in thread

From: Paul Förster @ 2020-06-01 07:19 UTC (permalink / raw)
  To: Tanja Savic <tanja.savic@crossmasters.com>; +Cc: Tom Lane <tgl@sss.pgh.pa.us>; Adrian Klaver <adrian.klaver@aklaver.com>; pgsql-general@lists.postgresql.org <pgsql-general@lists.postgresql.org>

Hi Tanja,

> On 01. Jun, 2020, at 09:04, Tanja Savic <tanja.savic@crossmasters.com> export PGDATA=" /var/lib/postgresql/12/main"

my wild guess is that the blank should not be there.

Cheers,
Paul




^ permalink  raw  reply  [nested|flat] 6+ messages in thread

* Re: pg_ctl can't start db server
@ 2020-06-01 13:26  Adrian Klaver <adrian.klaver@aklaver.com>
  parent: Tanja Savic <tanja.savic@crossmasters.com>
  1 sibling, 0 replies; 6+ messages in thread

From: Adrian Klaver @ 2020-06-01 13:26 UTC (permalink / raw)
  To: Tanja Savic <tanja.savic@crossmasters.com>; Tom Lane <tgl@sss.pgh.pa.us>; +Cc: pgsql-general@lists.postgresql.org <pgsql-general@lists.postgresql.org>

On 6/1/20 12:04 AM, Tanja Savic wrote:
> Hi,
> 
> @Tom Adding -D in command worked. I just used
> pg_ctl start -D [data-directory ]

You would be better off using the tools provided to manage clusters with 
the Ubuntu/Debian packaging:

https://wiki.debian.org/PostgreSql

So as I mentioned previously:

sudo pg_ctlcluster 12 main stop

sudo pg_ctlcluster 12 main start

The wrapper script that drives the above takes care of the below.

> 
> PGDATA was not set permanently although I tried to set it (with postgres user):
> export PGDATA=" /var/lib/postgresql/12/main"
> 
> @Adrian It's Ubuntu and output of pg_lsclusters was this:
> 12  main    24538 online postgres /var/lib/postgresql/12/main /var/log/postgresql/postgresql-12-main.log
> 
> Thank you for your replies.
> BR,
> Tanja
> 
> -----Original Message-----
> From: Tom Lane <tgl@sss.pgh.pa.us>
> Sent: Friday, May 29, 2020 5:32 PM
> To: Tanja Savic <tanja.savic@crossmasters.com>
> Cc: pgsql-general@lists.postgresql.org
> Subject: Re: pg_ctl can't start db server
> 
> Tanja Savic <tanja.savic@crossmasters.com> writes:
>> The configuration file path is /etc/postgresql/12/main/ postgresql.conf and it is configured in /var/lib/postgresql/12/main/postmaster.opts:
> 
>> "/usr/lib/postgresql/12/bin/postgres "-D" "/var/lib/postgresql/12/main" "-c" "config_file=/etc/postgresql/12/main/postgresql.conf"
> 
>> Why does pg_ctl complains about the postgresql.conf path?
> 
> I don't remember the exact interaction between -D and an explicit config_file setting, but evidently it's not working the way you wish.
> See
> 
> https://www.postgresql.org/docs/current/runtime-config-file-locations.html
> 
> which suggests that you should use -D to point at the directory where postgresql.conf is, and set the data directory with a parameter within postgresql.conf.
> 
> (Note that pg_ctl probably only understands this way, even though theoretically the postmaster can deal with other approaches to setting up an external config file.)
> 
> 			regards, tom lane
> 


-- 
Adrian Klaver
adrian.klaver@aklaver.com





^ permalink  raw  reply  [nested|flat] 6+ messages in thread


end of thread, other threads:[~2020-06-01 13:26 UTC | newest]

Thread overview: 6+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2020-05-29 15:19 pg_ctl can't start db server Tanja Savic <tanja.savic@crossmasters.com>
2020-05-29 15:32 ` Tom Lane <tgl@sss.pgh.pa.us>
2020-06-01 07:04   ` Tanja Savic <tanja.savic@crossmasters.com>
2020-06-01 07:19     ` Paul Förster <paul.foerster@gmail.com>
2020-06-01 13:26     ` Adrian Klaver <adrian.klaver@aklaver.com>
2020-05-29 18:22 ` Adrian Klaver <adrian.klaver@aklaver.com>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox