Postgres machine not properly starting or restarting

Current Status Button (on the top right corner of app dashboard): “Suspended”

Error on “Start machine”: “Machine failed to start: Unknown response while starting machine”

on fly logs --app {machine-name} --instance {machine-id}, the errors below infinitely repeat:

2025-01-02T21:27:26Z proxy[machine-id] ewr [info]Starting machine
2025-01-02T21:27:26Z proxy[machine-id] ewr [error][PM07] failed to change machine state: machine still active, refusing to start
2025-01-02T21:27:28Z proxy[machine-id] ewr [info]Starting machine
2025-01-02T21:27:28Z proxy[machine-id] ewr [error][PM07] failed to change machine state: machine still active, refusing to start
2025-01-02T21:27:29Z proxy[machine-id] ewr [info]Starting machine
2025-01-02T21:27:29Z proxy[machine-id] ewr [error][PM07] failed to change machine state: machine still active, refusing to start
  • starting the machine from app dashboard failed
  • starting/restarting it on terminal via fly start/restart failed
Error: could not start machine {machine-id}: failed to start VM {machine-id}: failed_precondition: machine still active, refusing to start

Restarting machine {machine-id}
Error: failed to restart machine {machine-id}: could not stop machine {machine-id}: failed to restart VM {machine-id}: failed_precondition: machine still active, refusing to start
  • stopping it on terminal via fly stop seems working, but, after that, fly start still does not work
Sending kill signal to machine {machine-id}...
{machine-id} has been successfully stopped

i read a related thread [Postgres database down, can't restart instance or machine], and found the answer saying “The particular host on which your VM resides had trouble earlier in the week and was down for a few hours.” ( @roadmr )

do i just have to wait till the host is coming back?

[Postgres database down, can't restart instance or machine - #6 by nolan-fly, “Destroying a machine doesn’t destroy its attached volumes.” ( @nolan-fly )]
or do i need to destroy the machine and create a new one connecting to the volume of the old machine?

Hi… This method is actually kind of a pain to get exactly right; it’s inelegant but easier to create a completely new Fly Postgres app that’s based on the old one’s volume.

If you have a volume snapshot that is newer than the last point in time that that database actually had a commit (e.g., an INSERT SQL statement), then you can use the official recovery instructions:

https://fly.io/docs/postgres/managing/backup-and-restore/#restoring-from-a-snapshot

(Note that it’s super-important to match the --image-ref; you will get very confusing errors otherwise, :dragon:.)

Hope this helps a little!

1 Like

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.