Re: BUG #15108: Initialization problem postgresql-10-setup initdb - Mailing list pgsql-bugs

From Devrim Gündüz
Subject Re: BUG #15108: Initialization problem postgresql-10-setup initdb
Date
Msg-id 1521196753.21279.23.camel@gunduz.org
Whole thread Raw
In response to BUG #15108: Initialization problem postgresql-10-setup initdb  (PG Bug reporting form <noreply@postgresql.org>)
List pgsql-bugs
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
Attachment

pgsql-bugs by date:

Previous
From: Yavuz TANRIVERDİ
Date:
Subject: Re: contrib/start-scripts/freebsd script fails with Ambiguous output redirect.
Next
From: akshunj
Date:
Subject: Re: BUG #15018: yum install postgis24_96 failure