Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am trying to configure a PostgreSQL database. Postgres is installed and running, but the PID file that it creates by default is different from what psycopg2 wants (which is /var/run/postgresql/.s.PGSQL.5432).

When I change /etc/postgresql/8.4/main/postgresql.conf to reflect this file, it fails silently and doesn't create the file. I tried a different file name that did not begin with a dot and it worked.

Is there a way to force Postgres to create this file, or to change the path that psycopg2 looks at to connect?


share|improve this question
What you are describing the is not a PID file, but a Unix domain socket file. Also, if something fails, show the error message. If you change a configuration file, say what you changed. – Peter Eisentraut Aug 25 '11 at 10:07

You can set unix_socket_directory in your postgresql.conf to force your server to put the socket in /var/run/postgresql. I'm not positive where psycopg2 picks up the default path from, I wouldn't be surprised if it were compiled in based on the default.

share|improve this answer
That's fine, but it doesn't solve my problem. Postgres is responding to most changes to PID file parameters, it just won't create a file that begins with a dot, which is what psycopg2 looks for. I suppose I supplied an inappropriate title. It should have been "How can I change the PID file that psycopg2 looks for?" but I believe that is moot because it has to be done by postgres. – user699397 Aug 25 '11 at 4:09

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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