You must make sure that the postgres user has the right to write and execute / var / run / postgresql
sudo chmod 765 /var/run/postgresql sudo chown postgres /var/run/postgresql
I had this problem due to the installation of postgres-xc and the solution was to remove it.
pg_ctl is the most common (and recommended) way used to start / stop / etc postgres.
For some reason, this was not part of my postgres installation.
After a little pruning duckduckgo, I installed postgre-xc, which includes pg_ctl.
postgres-xc changed the owner of / var / run / postgresql from postgres to postgres-xc.
This caused a lot of headaches and warnings about the inability to lock the pid file.
So, I deleted postgres-xc (and returned the owner of / var / run / postgresql to postgres).
Instead of using pg_ctl, I control postgres using
service postgresql status
or
/etc/init.d/postgresql status .
Hope this helps someone.
source share