0

My PostgreSQL server has unexpectedly shut down. In the log file (postgresql-Wed.log), I can see the following:

2025-11-12 18:18:54 LOG:  received fast shutdown request
2025-11-12 18:18:54 LOG:  aborting any active transactions
2025-11-12 18:18:54 FATAL:  terminating connection due to administrator command
2025-11-12 18:18:54 LOG:  disconnection: session time: 2:55:32.812 user=aaa database=bbb host=000.000.000.000 port=49342
2025-11-12 18:18:54 LOG:  background worker "logical replication launcher" (PID 2604) exited with exit code 1
2025-11-12 18:18:54 LOG:  shutting down
2025-11-12 18:18:54 LOG:  database system is shut down

I tried to restart the server using systemctl:

$ sudo /bin/systemctl restart postgresql
Job for postgresql.service failed because the control process exited with error code.
See "systemctl status postgresql.service" and "journalctl -xe" for details.

When I run the systemctl status command:

$ /bin/systemctl status postgresql.service
? postgresql.service - PostgreSQL database server
   Loaded: loaded (/usr/lib/systemd/system/postgresql.service; enabled; vendor preset: disabled)
   Active: failed (Result: exit-code) since Wed 2025-11-12 21:00:47 EST; 21min ago
  Process: 11910 ExecStart=/usr/bin/postmaster -D ${PGDATA} (code=exited, status=1/FAILURE)
  Process: 11908 ExecStartPre=/usr/libexec/postgresql-check-db-dir postgresql (code=exited, status=0/SUCCESS)
 Main PID: 11910 (code=exited, status=1/FAILURE)

OS: Red Hat Enterprise Linux release 8.10 (Ootpa)

PostgreSQL version: 13.22

How can I fix this an restart the server ?

4
  • 1
    Did you consider looking in the Postgres log file? Perhaps it's trying to tell you something. Commented Nov 13 at 6:14
  • Another thing you should try is to become user postgres and run /usr/pgsql-13/bin/pg_ctl start -D /var/lib/pgsql/13/data. Please add the errors you get to the question. Do not add it as a comment. Commented Nov 13 at 7:25
  • @mustaccio the first code block in my question is the end of the log file. I did not find anything suspicious in the rest of the log. Commented Nov 13 at 13:29
  • @Laurenz Albe Since we were able to restart the server, it was finally not necessary, but thanks for the suggestion! Commented Nov 14 at 12:56

1 Answer 1

1

It seems the culprit was a change in permissions of /var/lib/pgsql/data, likely caused by a patch/reboot of the Linux OS earlier that day.

Indeed, looking at error messages in /var/log/messages:

Nov 12 18:21:24 [servername] systemd[1]: Starting PostgreSQL database server...
Nov 12 18:21:24 [servername] postmaster[1755]: 2025-11-12 18:21:24 FATAL:  data directory "/var/lib/pgsql/data" has invalid permissions
Nov 12 18:21:24 [servername] postmaster[1755]: 2025-11-12 18:21:24 DETAIL:  Permissions should be u=rwx (0700) or u=rwx,g=rx (0750).
Nov 12 18:21:24 [servername] systemd[1]: postgresql.service: Main process exited, code=exited, status=1/FAILURE
Nov 12 18:21:24 [servername] systemd[1]: postgresql.service: Failed with result 'exit-code'.
Nov 12 18:21:24 [servername] systemd[1]: Failed to start PostgreSQL database server.

After patch/reboot, /var/lib/pgsql/data had 770 permissions, which prevented PostgreSQL from starting:

drwxrwx---. 22 postgres postgres 4096 Nov 12 18:18 /var/lib/pgsql/data

We changed them to 700:

drwx------. 22 postgres postgres 4096 Nov 12 18:18 /var/lib/pgsql/data

The PostgreSQL server could then be restarted.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.