I just tried installing Postgres 8.1.4 (RPMs from postgresql.org web site)
on a clean RHEL4 Update 2 machine that had SELinux enabled.

When I created a /etc/sysconfig/pgsql/postgresql config file with

PGDATA=/data/pgdata 

I was unable to get the start script (/etc/init.d/postgresql) to populate
the data directory nor launch postgres (after I manually did an initdb on
the directory)

The file permissions were 

drwx------  11 postgres postgres  4096 Jul 27 12:51 pgdata

But the pgstartup.log was still reporting that initdb coudln't create write
to /data/pgdata (Permission denied)

When I manually copied and pasted the line that was in
/etc/init.d/postgresql to the command line, it ran just fine (executing as
root)

runuser -l postgres -c "/usr/bin/initdb --pgdata='/data/pgdata'
--auth='ident sameuser'" >> "/var/lib/pgsql/pgstartup.log" 2>&1 < /dev/null
 
But there's some voodoo going on when this is executed inside of the start
script ... 

I started monkeying around with cutting the start script down to the point
where I finally got this error to appear (I believe it was removing the
</dev/null redirect):

Your default context is user_u:system_r:unconfined_t. Do you want to choose
a different one? [n]

If I just hit enter, the script would continue and successfully create the
data directory and launch postgres 

To be perfectly clear: If I don't set a custom PGDATA in
/etc/sysconfig/pgsql/postgresql, everything works fine ... the data
directory is created in /var/lib/pgsql/data as expected ... it's only with
the custom PGDATA .. 

Long story short, I have disabled SELinux on this box because this isn't the
first time SELinux stuff has burned hours of my day and this is an internal
box so I don't feel it's worth the battle right now ... but figured that
maybe someone else out there might benefit from reading this ... 

-Dave


---------------------------(end of broadcast)---------------------------
TIP 2: Don't 'kill -9' the postmaster

Reply via email to