PostgreSQL in Ubuntu 16.04 giving me "could not remove old lock file "postmaster.pid": Permission denied"


I am unable to start PostgreSQL in Ubuntu 16.04 its giving me the following error in tail -f -n 100 /var/log/postgresql/postgresql-9.5-main.log

2019-09-20 17:02:01 UTC [1774-1] FATAL:  could not remove old lock file "postmaster.pid": Permission denied
2019-09-20 17:02:01 UTC [1774-2] HINT:  The file seems accidentally left over, but it could not be removed. Please remove the file by hand and try again.

1 Answer

5 years ago by

Found out the issue is with my permissions. Running the following series of commands fixed my issue

chmod u+w /var/lib/postgresql/9.5/main/
sudo systemctl restart postgresql
5 years ago by Karthik Divi