Re: BUG #15108: Initialization problem postgresql-10-setup initdb

From: Devrim Gündüz <devrim(at)gunduz(dot)org>
To: alertas <alertas(dot)dba(at)click-it(dot)es>, pgsql-bugs(at)lists(dot)postgresql(dot)org
Subject: Re: BUG #15108: Initialization problem postgresql-10-setup initdb
Date: 2018-03-16 10:39:13
Message-ID: 1521196753.21279.23.camel@gunduz.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message akshunj 2018-03-16 13:05:40 Re: BUG #15018: yum install postgis24_96 failure
Previous Message Yavuz TANRIVERDİ 2018-03-16 08:17:46 Re: contrib/start-scripts/freebsd script fails with Ambiguous output redirect.