Failed to start postgres database [closed]

I tried to restart Postgres database. Then it shows an error.

 * Starting PostgreSQL 9.5 database server                                                                                                       
 * The PostgreSQL server failed to start. Please check the log output:
   2018-09-04 10:37:05 UTC [2573-1] FATAL:  could not create lock file "postmaster.pid": Permission denied
                                                                                                                                     [fail]

More than 4 applications running on this test server. I need a fix for this issue.

Answer

With an error message such as:

“could not create lock file “postmaster.pid”: Permission denied”

I imagine the first thing you did was copying that error message and asking the internet for help.

So please step back, relax, and read the error message – it is quite descriptive.

Then find the directory where postgres writes the PID file. (The external_pid_file = setting from the postgresql.conf.)
And, maybe, just a random thought, check the permissions and ownership of that directory and PID file. Those should be such that the postgres user can write there.
If you installed Postgres on a separate block device, check that it is mounted and writeable.

Attribution
Source : Link , Question Author : Navajyoth M S , Answer Author : HBruijn

Leave a Comment