postgres issue - won't mount
anishroytx01
PROOP

18 days ago

We are trying to use a backup for our data in postgres, but whenever it is mounted we see the error 2025-11-26 22:20:43.394 UTC [6] FATAL: bogus data in lock file "postmaster.pid": "�". But we can't access the volume to run rm /var/lib/postgresql/data/postmaster.pid. What can we do since all our data is on our backup.

$20 Bounty

2 Replies

gl1tchblade
FREE

17 days ago

The stale postmaster.pid file from the backup is blocking Postgres from starting. Since you can't shell into a crashed service, the easiest fix is to deploy a simple Alpine container, mount the same volume to it, run rm /var/lib/postgresql/data/postmaster.pid, then detach the volume and reattach it to your Postgres service. Alternatively, you could spin up a fresh Postgres instance and restore your backup there instead—that sidesteps the pid file issue entirely.


bytekeim

Hyy!i think the correct and simpler method is the one that does not require detaching/reattaching the volume (the Alpine cleaner method without detach).railway even explicitly recommends this pattern in their CLI guide:“Deploy a simple file browser service that mounts the same volume as your main application.” → https://docs.railway.app/guides/clithis means you can keep the volume attached to your crashed Postgres service and mount it to an Alpine container simultaneously. Delete the file → redeploy Postgres → done. No detach, no reattach, no CLI needed, zero risk of mistakes.so you keep the volume attached to your Postgres service the whole time.Do this:1- create a new empty service (any name, e.g. cleaner)2- source = Docker image → alpine:latest3- start command :sh -c "apk add --no-cache coreutils && echo '=== CLEANING POSTMASTER.PID ===' && ls -la /data | grep pid && rm -fv /data/postmaster.pid && echo '=== DONE – PID FILE DELETED ===' && sleep 3600"4- go to the volumes tab in this new service → add your existing Postgres volume → Mount path: /data5-deploy and check logs u will see the postmaster.pid file listed and then deleted.6- immediately delete the cleaner service (or just stop it).7 - go back to your Postgres service and redeploy.this method is safe and simple. i think Detaching/reattaching is unnecessary.

medim
MODERATOR

17 days ago

You still need to unmount the volume from the Postgres service and mount it to the Filebrowser template.
There's also no 'Volumes' tab in a service.

Please be careful with what you recommend to other users.


Loading...