2

After some attempts to change permissions to access pqsql and data in /var/lib/pgsql/data/ my postgres-server failed.

Postgresql status is:

 Loaded: loaded (/usr/lib/systemd/system/postgresql.service; enabled; 
 vendor preset: disabled)
 Active: failed (Result: exit-code) since Ср 2020-02-05 12:46:48 MSK; 
 2min 19s ago
 Process: 572 ExecStart=/usr/bin/pg_ctl start -D ${PGDATA} -s -o -p 
 ${PGPORT} -w -t 300 (code=exited, status=1/FAILURE)
  Process: 564 ExecStartPre=/usr/bin/postgresql-check-db-dir ${PGDATA} 
 (code=exited, status=0/SUCCESS)

 plesk.iline.pro systemd[1]: Starting PostgreSQL database server...
 plesk.iline.pro pg_ctl[572]: FATAL:  data directory 
"/var/lib/pgsql/data" has wrong ownership
 plesk.iline.pro pg_ctl[572]: HINT:  The server must be started by the 
 user that owns the data directory.
  plesk.iline.pro pg_ctl[572]: pg_ctl: could not start server
  plesk.iline.pro pg_ctl[572]: Examine the log output.
  plesk.iline.pro systemd[1]: postgresql.service: control process 
 exited, code=exited status=1
 plesk.iline.pro systemd[1]: Failed to start PostgreSQL database 
 server.
 plesk.iline.pro systemd[1]: Unit postgresql.service entered failed 
 state.
 plesk.iline.pro systemd[1]: postgresql.service failed.

In journalctl -xe I see:

input_userauth_request: invalid user isp [preauth]
plesk.iline.pro sshd[17416]: pam_unix(sshd:auth): check pass; user unknown
plesk.iline.pro sshd[17416]: pam_unix(sshd:auth): authentication failure; logname= uid=0 euid=0 tty=ssh ruser= rhost=118.25.105.121
plesk.iline.pro dreamwhiteApi[4034]: 2020/02/05 12:15:02 Requesting: GET  https://online.moysklad.ru/api/remap/1.1/entity/employee/?
plesk.iline.pro postfix/postdrop[1048]: warning: mail_queue_enter: create file maildrop/663461.1048: Permission denied
 plesk.iline.pro postfix/postdrop[25484]: warning: mail_queue_enter: create file maildrop/739287.25484: Permission denied

I return rights to initial state:

drwxr-xr-x   4 postgres     postgres     4096  pgsql
drwxr-xr-x  15  polkitd     postgres     4096  data

But the problem remains.

Postgresql-vertion is 9.2 (I can't change this version for some reasons in my server).

2
  • It is not quite clear from ls output what pokitd is, as it may depend on the options you passed to ls. My best guess is that it is some user name. If so "/var/lib/pgsql/data" needs postgres user as owner, not polkitd Commented Feb 5, 2020 at 14:09
  • Same issue here with Fedora33 and Postgres 11. NO matter what the service won't start. Followed the instructions here until RESTART right before Step 6: computingforgeeks.com/how-to-install-postgresql-on-fedora Commented Nov 10, 2020 at 21:45

1 Answer 1

2

The postgres data folder and all contained files should be owned by user and group postgres :

drwx------ 19 postgres postgres 4.0K Feb  2 14:32 data

Fix the permissions like this, changing the owner :

sudo chown -R postgres:postgres /var/lib/postgres/data

Finally, restart the postgresql server :

sudo systemctl restart postgresql
2
  • Thanks! Its worked for me with restarting postgres-server Commented Feb 5, 2020 at 16:01
  • Did not help, still restart exits with error. Commented Nov 10, 2020 at 21:43

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.