pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Devrim Gündüz <devrim@gunduz.org>
To: alertas <alertas.dba@click-it.es>
To: pgsql-bugs@lists.postgresql.org
Subject: Re: BUG #15108: Initialization problem postgresql-10-setup initdb
Date: Fri, 16 Mar 2018 10:39:13 +0000
Message-ID: <1521196753.21279.23.camel@gunduz.org> (raw)
In-Reply-To: <b1af0497-7164-0c35-c839-041840836640@click-it.es>
References: <d7e5e38c-b462-2db9-ee05-1cadc2ce56e0@click-it.es>
	<b1af0497-7164-0c35-c839-041840836640@click-it.es>


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

view thread (6+ messages)  latest in thread

Message-ID: <1521196753.21279.23.camel@gunduz.org>
Permalink:  ../1521196753.21279.23.camel@gunduz.org/
Also on:    postgresql.org/message-id/1521196753.21279.23.camel@gunduz.org

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-bugs@postgresql.org
  Cc: devrim@gunduz.org, alertas.dba@click-it.es
  Subject: Re: BUG #15108: Initialization problem postgresql-10-setup initdb
  In-Reply-To: <1521196753.21279.23.camel@gunduz.org>
  References: <d7e5e38c-b462-2db9-ee05-1cadc2ce56e0@click-it.es> <b1af0497-7164-0c35-c839-041840836640@click-it.es> <1521196753.21279.23.camel@gunduz.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

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