Thread: BUG #3034: FATAL: could not open lock file "/tmp/.s.PGSQL.5432.lock": Permission denied

The following bug has been logged online:

Bug reference:      3034
Logged by:          Jessica
Email address:      hxq7681@cs.rit.edu
PostgreSQL version: 8.2
Operating system:   Unix
Description:        FATAL:  could not open lock file
"/tmp/.s.PGSQL.5432.lock": Permission denied
Details:

Hi there,

I installed PostgreSQL. It looked fine immediately after installation.
However, when reused it, I always couldn't start server. I had to reinstall
it again and again. This time I got erroe message as below:
********
bash-3.00$ pg_ctl start -l logfile
server starting
bash-3.00$ pgsql testdb
bash: pgsql: command not found
bash-3.00$ psql testdb
psql: could not connect to server: Connection refused
        Is the server running locally and accepting
        connections on Unix domain socket "/tmp/.s.PGSQL.5432"?
bash-3.00$ pg_ctl stop
pg_ctl: PID file "/home/group/s772/p772-01f/pgsql/CLUST/sys/postmaster.pid"
does not exist
Is server running?
bash-3.00$
********

The logfile showed:
*********
LOG:  could not bind IPv6 socket: Cannot assign requested address
HINT:  Is another postmaster already running on port 5432? If not, wait a
few seconds and retry.
FATAL:  could not open lock file "/tmp/.s.PGSQL.5432.lock": Permission
denied
LOG:  could not bind IPv6 socket: Cannot assign requested address
HINT:  Is another postmaster already running on port 5432? If not, wait a
few seconds and retry.
FATAL:  could not open lock file "/tmp/.s.PGSQL.5432.lock": Permission
denied
**********

I really felt unset. It never worked well. What is wrong?

Thanks.

Jessica
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On Mon, Feb 19, 2007 at 09:53:26PM +0000, Jessica wrote:
>
> The following bug has been logged online:
>
> Bug reference:      3034
> Logged by:          Jessica
> Email address:      hxq7681@cs.rit.edu
> PostgreSQL version: 8.2
> Operating system:   Unix
> Description:        FATAL:  could not open lock file
> "/tmp/.s.PGSQL.5432.lock": Permission denied

It looks like the postmaster was started (at least once) with the wrong
unser ID. Typically there is a user 'postgres' especially for this.
Always create the DB and start and stop the database under this user.

The operating systems's start and stop scripts usually do this for you
(they must be called as root, obviously).

HTH
- -- tomás
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.1 (GNU/Linux)

iD8DBQFF3qteBcgs9XrR2kYRAs6BAJ9sLxaQ8ys+Tq3giqn/Khv/MfwTIwCdGgje
UTubw0Y2WT15mno6jhbPmwI=
=02xM
-----END PGP SIGNATURE-----
Hi,
> FATAL:  could not open lock file "/tmp/.s.PGSQL.5432.lock": Permission
> denied
I got that error today.
My case:
I installed psql using user A, then I uninstalled it.
I installed psql using user B and I got that error.
Reason: The lock file in /tmp was owned by user A
Solution:
su and rm the lock file :)
End of case

--
regards
arpi