Pages

Thursday, January 8, 2015

could not create lock file "/tmp/.s.PGSQL.5432.lock": Permission denied

could not create lock file "/tmp/.s.PGSQL.5432.lock": Permission denied

I tried to install postgres 9.1 from Linux Based executable rather than using apt-get in Debian 5.0, 32 bit Architecture.

I downloaded Postgres 9.1 database binary from here

http://www.enterprisedb.com/products-services-training/pgdownload

I changed permission of the executable.

chmod 777 postgresql-9.1.14-2-linux.run

./postgresql-9.1.14-2-linux.run

Now the Installation started and while completion of installation , I got the following error message.

PostgreSQL 9.1 did not start in a timely fashion, please see /opt/PostgreSQL/9.1/data/pg_log/startup.log for details


When  I checked the log, the following details were shown


2015-01-09 06:27:15 UTC FATAL:  could not create lock file "/tmp/.s.PGSQL.5432.lock": Permission denied
2015-01-09 06:27:42 UTC FATAL:  could not create lock file "/tmp/.s.PGSQL.5432.lock": Permission denied


I created an empty file and gave permission for postgres user.

touch /tmp/.s.PGSQL.5432.lock
chown postgres /tmp/.s.PGSQL.5432.lock

Again I tried to start  Postgres 9.1 Server and ended up with this error.

"/tmp/.s.PGSQL.5432.lock contain bogus value

I checked forums and got this link.

http://askubuntu.com/questions/136911/run-a-postgresql-instance-locally

By default in the  postgresql.conf "unix_socket_directory" is commented out
This file is located in /opt/PostgreSQL/9.1/data/postgresql.conf

Open the file, remove the comment and  the entry should be

unix_socket_directory = '/var/run/postgresql'        # (change requires restart)

Save the file and exit.

mkdir -p '/var/run/postgresql'   
chown -R postgres '/var/run/postgresql'   
/etc/init.d/postgresql-9.1 start

Now I started the Postrgres 9.1 Server and a great success (!), it started.

2 comments:

  1. I am getting this error when trying to run the 2nd to the last line:

    [~]$ chown -R postgres '/var/run/postgresql'
    chown: postgres: illegal user name

    Any help with this?

    ReplyDelete
    Replies
    1. Hi Aaron,
      Just verify whether user 'postgres' user exists.
      If not , create a user named 'postgres' and then try giving permission.

      Delete