F0001FATALTier 2 — Caution✅ HIGH confidencelock file exists
What this means
SQLSTATE F0001 is raised when Postgres cannot start because a postmaster.pid lock file already exists in the data directory, indicating either another Postgres instance is already running or a stale lock file was left from a previous crash.
Why it happens
- 1Another Postgres instance is already running using the same data directory
- 2A stale postmaster.pid file was left from a previous crash or unclean shutdown
How to reproduce
Starting Postgres when postmaster.pid already exists.
-- pg_ctl start when another instance is running on the same data dirFix 1: Check if another Postgres instance is running on the same data directory
Before deleting the lock file.
Why this works
Check the PID in postmaster.pid: if the process is alive, it owns the data directory. Do not start another instance on the same directory.
Fix 2: Remove the stale lock file if no Postgres process is running
After confirming no other Postgres process uses the data directory.
Why this works
If the PID in postmaster.pid does not correspond to a running process, the file is stale. Remove it: rm /var/lib/postgresql/data/postmaster.pid. Then start Postgres.
What not to do
Delete postmaster.pid without verifying no Postgres is running
Why it's wrong: Deleting the lock file while another Postgres instance is running can corrupt the data directory.
Sources
📚 Official docs: https://www.postgresql.org/docs/current/errcodes-appendix.html
🔧 Source ref: Class F0 — Configuration File Error
Confidence assessment
✅ HIGH confidence
Postgres-specific. Stable across all versions.
See also
🔗 Related errors
📄 Reference pages