pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
BUG #15108: Initialization problem postgresql-10-setup initdb
6+ messages / 4 participants
[nested] [flat]

* BUG #15108: Initialization problem postgresql-10-setup initdb
@ 2018-03-13 12:12 PG Bug reporting form <noreply@postgresql.org>
  2018-03-13 12:31 ` Re: BUG #15108: Initialization problem postgresql-10-setup initdb Sergei Kornilov <sk@zsrv.org>
  2018-03-14 15:59 ` Re: BUG #15108: Initialization problem postgresql-10-setup initdb Devrim Gündüz <devrim@gunduz.org>
  0 siblings, 2 replies; 6+ messages in thread

From: PG Bug reporting form @ 2018-03-13 12:12 UTC (permalink / raw)
  To: pgsql-bugs@lists.postgresql.org; +Cc: alertas.dba@click-it.es

The following bug has been logged on the website:

Bug reference:      15108
Logged by:          Alertas DBA
Email address:      alertas.dba@click-it.es
PostgreSQL version: 10.3
Operating system:   Centos 7.4.1708
Description:        

The problem is reported when executing database initialization command,
postgresql-10-setup initdb.
In the official documentation
(https://www.postgresql.org/docs/10/static/app-initdb.html) indicates that
it must be executed with the user postgres, but the command only works if I
execute it as root.

This command does not seem to interpret the parameter step indicated in the
documentation, these are the problem:

(run as root) yum install -y
https://download.postgresql.org/pub/repos/yum/10/redhat/rhel-7-x86_64/pgdg-centos10-10-2.noarch.rpm
(run as root) yum install -y postgresql10 postgresql10-server
(run as root) cd /
(run as root) mkdir data
(run as root) chown -R postgres.postgres data
(run as postgres) /usr/pgsql-10/bin/postgresql-10-setup initdb
-bash-4.2$ /usr/pgsql-10/bin/postgresql-10-setup initdb -D /data -A trust -U
postgres
systemctl: invalid option -- 'D'
failed to find PGDATA setting in -D.service

-bash-4.2$ /usr/pgsql-10/bin/postgresql-10-setup initdb -D /data/ -A trust
-U postgres
systemctl: invalid option -- 'D'
failed to find PGDATA setting in -D.service

-bash-4.2$ /usr/pgsql-10/bin/postgresql-10-setup initdb --pgadata=/data/ -A
trust -U postgres
systemctl: unrecognized option '--pgadata=/data/.service'
failed to find PGDATA setting in --pgadata=/data/.service

Should the environment variable PGDATA in
/usr/lib/systemd/system/postgresql-10.service be overwrited after the
database is initialized?



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

* Re: BUG #15108: Initialization problem postgresql-10-setup initdb
  2018-03-13 12:12 BUG #15108: Initialization problem postgresql-10-setup initdb PG Bug reporting form <noreply@postgresql.org>
@ 2018-03-13 12:31 ` Sergei Kornilov <sk@zsrv.org>
  1 sibling, 0 replies; 6+ messages in thread

From: Sergei Kornilov @ 2018-03-13 12:31 UTC (permalink / raw)
  To: alertas.dba@click-it.es <alertas.dba@click-it.es>; pgsql-bugs@lists.postgresql.org <pgsql-bugs@lists.postgresql.org>

Hello!
Why you tried using /usr/pgsql-10/bin/postgresql-10-setup instead /usr/pgsql-10/bin/initdb ?

regards, Sergei




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

* Re: BUG #15108: Initialization problem postgresql-10-setup initdb
  2018-03-13 12:12 BUG #15108: Initialization problem postgresql-10-setup initdb PG Bug reporting form <noreply@postgresql.org>
@ 2018-03-14 15:59 ` Devrim Gündüz <devrim@gunduz.org>
  1 sibling, 0 replies; 6+ messages in thread

From: Devrim Gündüz @ 2018-03-14 15:59 UTC (permalink / raw)
  To: alertas.dba@click-it.es; pgsql-bugs@lists.postgresql.org


Hi,

On Tue, 2018-03-13 at 12:12 +0000, PG Bug reporting form wrote:
> The problem is reported when executing database initialization command,
> postgresql-10-setup initdb.
> In the official documentation
> (https://www.postgresql.org/docs/10/static/app-initdb.html) indicates that
> it must be executed with the user postgres, but the command only works if I
> execute it as root.
> 
> This command does not

postgresql-10-setup is a wrapper around initdb (which solves many problems), 
*not* the initdb binary, and needs to be run as root. You can always run initdb
directly with:

/usr/pgsql-10/bin/initdb

Regards,

-- 
Devrim Gündüz
EnterpriseDB: https://www.enterprisedb.com
PostgreSQL Consultant, Red Hat Certified Engineer
Twitter: @DevrimGunduz , @DevrimGunduzTR

Attachments:

  signature.asc (application/pgp-signature, 832B) download

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

* Re: BUG #15108: Initialization problem postgresql-10-setup initdb
@ 2018-03-16 07:29 alertas <alertas.dba@click-it.es>
  2018-03-16 10:39 ` Re: BUG #15108: Initialization problem postgresql-10-setup initdb Devrim Gündüz <devrim@gunduz.org>
  2018-03-16 14:18 ` Re: BUG #15108: Initialization problem postgresql-10-setup initdb Sergei Kornilov <sk@zsrv.org>
  0 siblings, 2 replies; 6+ messages in thread

From: alertas @ 2018-03-16 07:29 UTC (permalink / raw)
  To: pgsql-bugs@lists.postgresql.org, Devrim Gündüz <devrim@gunduz.org>; alertas.dba@click-it.es

Hi,

I don't understand, in the official documentation appear "initdb must be 
run as the user that will own the server process, because the server 
needs to have access to the files and directories that initdb creates. 
*Since the server cannot be run as root, you must not run initdb as root 
either*. (It will in fact refuse to do so.)"

Regards,


El 14/03/18 a las 16:59, Devrim Gündüz escribió:
> Hi,
>
> On Tue, 2018-03-13 at 12:12 +0000, PG Bug reporting form wrote:
>> The problem is reported when executing database initialization command,
>> postgresql-10-setup initdb.
>> In the official documentation
>> (https://www.postgresql.org/docs/10/static/app-initdb.html) indicates that
>> it must be executed with the user postgres, but the command only works if I
>> execute it as root.
>>
>> This command does not
> postgresql-10-setup is a wrapper around initdb (which solves many problems),
> *not* the initdb binary, and needs to be run as root. You can always run initdb
> directly with:
>
> /usr/pgsql-10/bin/initdb
>
> Regards,
>

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

* Re: BUG #15108: Initialization problem postgresql-10-setup initdb
  2018-03-16 07:29 Re: BUG #15108: Initialization problem postgresql-10-setup initdb alertas <alertas.dba@click-it.es>
@ 2018-03-16 10:39 ` Devrim Gündüz <devrim@gunduz.org>
  1 sibling, 0 replies; 6+ messages in thread

From: Devrim Gündüz @ 2018-03-16 10:39 UTC (permalink / raw)
  To: alertas <alertas.dba@click-it.es>; pgsql-bugs@lists.postgresql.org


Hi,

On Fri, 2018-03-16 at 08:29 +0100, alertas wrote:

> I don't understand, in the official documentation appear "initdb must be 
> run as the user that will own the server process, because the server 
> needs to have access to the files and directories that initdb creates. 
> *Since the server cannot be run as root, you must not run initdb as root 
> either*. (It will in fact refuse to do so.)"

As I wrote in my previous post:

The "initdb" that the documentation mentions is:

/usr/pgsql-10/bin/initdb

which must be run by non-root user.

Then, there is a setup script:

/usr/pgsql-10/bin/postgresql-10-setup

which is a wrapper around initdb (and some other things), and the related lines
are:

 # Initialize the database
    initdbcmd="$PGENGINE/initdb --pgdata='$PGDATA' --auth='ident'"
    initdbcmd+=" $PGSETUP_INITDB_OPTIONS"

    $SU -l postgres -c "$initdbcmd" >> "$PGLOG" 2>&1 < /dev/null


So, when user runs

/usr/pgsql-10/bin/postgresql-10-setup initdb

the word "initdb" is a *parameter* to the script, and as written in the
documentation, we run initdb as the postgres user.

-HTH

Regards,
-- 
Devrim Gündüz
EnterpriseDB: https://www.enterprisedb.com
PostgreSQL Consultant, Red Hat Certified Engineer
Twitter: @DevrimGunduz , @DevrimGunduzTR

Attachments:

  signature.asc (application/pgp-signature, 832B) download

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

* Re: BUG #15108: Initialization problem postgresql-10-setup initdb
  2018-03-16 07:29 Re: BUG #15108: Initialization problem postgresql-10-setup initdb alertas <alertas.dba@click-it.es>
@ 2018-03-16 14:18 ` Sergei Kornilov <sk@zsrv.org>
  1 sibling, 0 replies; 6+ messages in thread

From: Sergei Kornilov @ 2018-03-16 14:18 UTC (permalink / raw)
  To: alertas <alertas.dba@click-it.es>; pgsql-bugs@lists.postgresql.org <pgsql-bugs@lists.postgresql.org>; Devrim Gündüz <devrim@gunduz.org>

Hello
Official documentation about initdb binary itself. Not about any wrappers such a postgresql-10-setup.

regards, Sergei




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


end of thread, other threads:[~2018-03-16 14:18 UTC | newest]

Thread overview: 6+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2018-03-13 12:12 BUG #15108: Initialization problem postgresql-10-setup initdb PG Bug reporting form <noreply@postgresql.org>
2018-03-13 12:31 ` Sergei Kornilov <sk@zsrv.org>
2018-03-14 15:59 ` Devrim Gündüz <devrim@gunduz.org>
2018-03-16 07:29 Re: BUG #15108: Initialization problem postgresql-10-setup initdb alertas <alertas.dba@click-it.es>
2018-03-16 10:39 ` Devrim Gündüz <devrim@gunduz.org>
2018-03-16 14:18 ` Sergei Kornilov <sk@zsrv.org>

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