Thread: Alternate DB location continued.

Alternate DB location continued.

From
Bob Hartung
Date:
Hi again all.
   Here is the situation:
    Fedora Core 3 with all updates.
    PostgreSQL 8.0.1 installed - no tables to update.
    In /etc/profile I have declared:
        PGDATA=/pg_data
        PATH=$PATH:$PGDATA
        export PGDATA
        export PATH

         Directory /pg_data exists and is owned by postgres.
         Log in as user postgres and run initdb by itself or with
        -D PGDATA
        -D /pg_data

         The output is as follows:
      The files belonging to this database system will be owned by user
"postgres?.
      This user must also own the server process.
      The database cluster will be initialized with local en_US.UTF-8.
      The default database encoding has accordingly been set to UNICODE.

      fixing permissions on existing directory /pg_data . . . ok
      creating directory /pg_data/global ... ok
      creating directory /pg_data/pg_xlog ... ok
      creating directory /pg_data/pg_xlog/archive_status ... ok
      creating directory /pg_data/pg_clog ... ok
      creating directory /pg_data/pg_subtrans ... ok
      creating directory /pg_data/base ... ok
      creating directory /pg_data/base/1 ... ok
      creating directory /pg_data/pb_tblspc ... ok
      selecting default max_connections ... 10
      selecting default shared_buffers ... 50
      creating configuration files ... ok
      creating template1 database in /pg_data/base/1 ... child process
exited with exit code 1
      initdb: removing contents of data directory "/pg_data"

Does anyone have any idea of where I went wrong?  If do not declare and
export PGDATA or append it to path, everything works fine.

Thanks again for your time.  If you responded the other day I may have
lost your message as I was on the road.

Bob Hartung


Re: Alternate DB location continued.

From
Tom Lane
Date:
Bob Hartung <rwhart@mchsi.com> writes:
>    Here is the situation:
>     Fedora Core 3 with all updates.
>     PostgreSQL 8.0.1 installed - no tables to update.
>     In /etc/profile I have declared:
>         PGDATA=/pg_data

You're being bit by SELinux.  Either take it out of enforcement mode or
teach it that the postgres daemon is allowed to access /pg_data.

            regards, tom lane

Re: Alternate DB location continued.

From
Marco Colombo
Date:
On Fri, 18 Feb 2005, Bob Hartung wrote:

> Hi again all.
>  Here is the situation:
>     Fedora Core 3 with all updates.
>     PostgreSQL 8.0.1 installed - no tables to update.
>     In /etc/profile I have declared:
>         PGDATA=/pg_data
>         PATH=$PATH:$PGDATA
>         export PGDATA
>         export PATH
>
>        Directory /pg_data exists and is owned by postgres.
>        Log in as user postgres and run initdb by itself or with
>         -D PGDATA
>         -D /pg_data
>
>        The output is as follows:
>       The files belonging to this database system will be owned by user
> "postgres?.
>       This user must also own the server process.
>       The database cluster will be initialized with local en_US.UTF-8.
>       The default database encoding has accordingly been set to UNICODE.
>
>       fixing permissions on existing directory /pg_data . . . ok
>       creating directory /pg_data/global ... ok
>       creating directory /pg_data/pg_xlog ... ok
>       creating directory /pg_data/pg_xlog/archive_status ... ok
>       creating directory /pg_data/pg_clog ... ok
>       creating directory /pg_data/pg_subtrans ... ok
>       creating directory /pg_data/base ... ok
>       creating directory /pg_data/base/1 ... ok
>       creating directory /pg_data/pb_tblspc ... ok
>       selecting default max_connections ... 10
>       selecting default shared_buffers ... 50
>       creating configuration files ... ok
>       creating template1 database in /pg_data/base/1 ... child process
> exited with exit code 1
>       initdb: removing contents of data directory "/pg_data"
>
> Does anyone have any idea of where I went wrong?  If do not declare and
> export PGDATA or append it to path, everything works fine.
>
> Thanks again for your time.  If you responded the other day I may have
> lost your message as I was on the road.

Please read replies here:
http://archives.postgresql.org/pgsql-general/2005-02/msg00832.php

As Tom wrote, it's likely it's SElinux in action.

.TM.
--
       ____/  ____/   /
      /      /       /            Marco Colombo
     ___/  ___  /   /              Technical Manager
    /          /   /             ESI s.r.l.
  _____/ _____/  _/               Colombo@ESI.it