lock file “postmaster.pid” already exists

SQLSTATE F0001 condition lock_file_exists class F0 — Config File Error severity FATAL
Reproduced & verified on PostgreSQL 14.23, 15.18, 16.14, 17.10 and 18.4 — identical message on every version.
Last reviewed 11 Jun 2026 · Reproduced live with the SQL on this page.

Symptoms

The server could not start (or create a resource) because a lock file already exists, suggesting another instance may be running. PostgreSQL raises SQLSTATE F0001 (lock_file_exists).

What the server log shows

FATAL:  lock file "postmaster.pid" already exists
HINT:  Is another postmaster (PID 4242) running in data directory "/var/lib/pgsql/data"?

Why PostgreSQL raises this — what the manual says

Section 18.3 Starting the Database Server:

“While the server is running, its PID is stored in the file postmaster.pid in the data directory.”

PostgreSQL writes postmaster.pid to guard a data directory against concurrent postmasters. If the file exists at startup, it assumes another instance may be running and refuses to start, reporting F0001.

Common causes

How to fix it

  1. Confirm no live postmaster is running (check the PID in the hint).
  2. If truly stale (no running process), remove postmaster.pid and start again.
  3. Never delete the lock file while a server is actually running.

Related & next steps

Reference: PostgreSQL 18 Section 19.3 “Starting the Server”.