0

Centos 8.3, postgresql 12 (i tried even 10, same thing).

I have set the permission of the data directory to postgres:postgres. If I start the service from systemctl, it gives me the error message

"creation of lock file "postmaster.pid" failed: Permission denied".

If I copy the command from postgresql.service which is postmaster -D /data/pgdata and I run from the console as postgres user, it works, and the postmaster.pidfile is correctly created.

I have no ideas, because it's not a permission problem...

What am I missing?

2
  • Is the user that fails on startup a member of the postgres group? If not, make them one and try! – Vérace Jun 14 '20 at 2:07
  • in the postgresql.service is correctly written postgres as user and postgres as group – Ciccio Pasticcio Jun 14 '20 at 7:40
0

Ok, i understood.

It was a "problem" of selinux.

I changed the data directory, and selinux "didn't know" it, so i

chcon -R -t postgresql_db_t /data/pgdata

restorecon -RFv /data/pgdata.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.