Page 1 of 1

Strange postgresql behaviour

Posted: 2020/06/13 22:08:32
by massimo79m
Centos 8.3, postgresql 12, installed from yum.
if i start the service from systemctl, it stops with
"creation of lock file "" failed: Permission denied".
instead, if i run the same command as in the postgresql.service file (postmaster -D /data/pgdata), it works. the is correctly created and the server works.
the /data/pgdata is owned by postgres:postgres.

thank you in advance

Re: Strange postgresql behaviour

Posted: 2020/06/13 23:16:31
by TrevorH
Are you running the CentOS version of postgresql?

Your problem is because you have moved the pgsql data directory from its standard location to somewhere that is not known by selinux. You should look at the man page for semanage, specifically the section dealing with equivalency so that you can map your /data/pgdata directory to the standard location so that all the rules then apply there too. Once that's done, run restorecon -RFv /data/pgdata to fix the selinux contexts and then it should work.