Description | This article describes how to fix PostgreSQL Docker startup failure caused by a stale PID file after a reboot. |
Scope | FortiClient EMS Linux |
Solution |
Description:
After an unexpected reboot of a server running FortiClient EMS and PostgreSQL inside a Docker container, the EMS service may recover successfully, but the PostgreSQL container may fail to start or remain running.
This behavior is often caused by a stale 'repmgrd' PID file left over from before the reboot, preventing PostgreSQL from initializing properly.
After the reboot, the PostgreSQL container repeatedly fails to start and enters a restart loop. Log shows the following error:
[ERROR] PID file "/tmp/repmgrd.pid" exists and seems to contain a valid PID
This error occurs because the 'repmgrd' daemon detects a stale process ID file and incorrectly assumes an instance is still running.
Solution:
docker exec -it <container_name> bash
rm -f /tmp/repmgrd.pid
Exit
docker restart container_name
docker exec -it <container_name> bash -c "/opt/bitnami/scripts/postgresql-repmgr/entrypoint.sh repmgr -f /opt/bitnami/repmgr/conf/repmgr.conf cluster show"
The node should be online and properly rejoined as a standby.
Additional Notes:
Due to the restart loop of the container, it may be necessary to perform the above actions quickly before the container is restarted again. |
The Fortinet Security Fabric brings together the concepts of convergence and consolidation to provide comprehensive cybersecurity protection for all users, devices, and applications and across all network edges.
Copyright 2025 Fortinet, Inc. All Rights Reserved.