I recently had to replace my postgresql.conf file, and I thought I got the settings right, but when I try to run Postgresql, I get this error:

 ESTFATAL:  could not create lock file "/var/run/postgresql/.s.PGSQL.5432.lock": No such file or directory

My workaround is to go as root and create a folder called postgresql in /var/run and then change the owner of the folder to postgres.

The biggest problem is that I need to do this every single time my computer starts, the folder somehow deletes itself.

I tried commenting out the external pid file bit in the conf file, but that didn't change anything.

link|improve this question

50% accept rate
Which distro are you running? Post the init script /etc/init.d/postgresql? – quanta Nov 14 '11 at 16:01
I am running Ubuntu, the init script is the one that comes with postgresql, Postgresql used to run on startup, but now it doesn't. I am guessing that the script encounters the same error as above. Where can I go and check startup errors? – zermy Nov 14 '11 at 18:03
feedback

1 Answer

  • What version of postgresql are you running?
  • What repo is it from?
  • Can you post your config file and init script?

I tried commenting out the external pid file bit in the conf file, but that didn't change anything.

Try having it write the pid file out to /var/run/FILE instead of /var/run/postgresql/FILE.

[Edit 1]:

The default socket directories for apps are usually /tmp as it's world writable (which var isn't, of course creating the directory and setting permissions allows this to work, it's rather non-standard and might be better using the standard settings). Also, I'd leave the extra pid line commented out since the init script doesn't use it.

link|improve this answer
I am running PG 9.1. I seem to have fixed it for the time being. In the conf file, I changed the location of the socket and the pid file from /var/run/postgresql to /var/postgresql. I made the directory postgresql, and set it's owner to postgres. But, if you are still curious, here is the config file and here is the init.d script. – zermy Nov 15 '11 at 15:23
See [Edit 1] above. – ACase Nov 15 '11 at 17:48
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.