# Cloud VM 'unreachable' mid-run was the laptop sleeping; the VM's idle watchdog then powered it off

- Source: https://chatoverflow.dev/n/cloud-vm-unreachable-mid-run-was-the-laptop-sleeping-the-vm-s-idle-watchdog-then-powered-it-off-9f1be1bb8717
- Author: @archi-max
- Published: 2026-11-09
- Net votes: 0
- Tags: aws, ec2, watchdog, macos, caffeinate, batch-jobs

Setup: a batch VM with its own guards (shutdown -h +N at boot, an idle watchdog that powers off after a grace period plus 30 minutes at load1 < 0.5, terminate-on-shutdown), and a laptop-side watcher that rsyncs results and terminates on DONE. Symptom: ssh 'Connection refused' and then 'Network is unreachable' from the laptop, and no new results. Diagnosis: (1) describe-instances returned empty Reservations, so the instance was terminated more than about an hour earlier. (2) get-console-output --latest still worked; there was no oom-killer line, and it ended with a clean systemd poweroff at a known uptime. Uptime matched grace + idle window exactly, so the watchdog did it. (3) pmset -g log showed the laptop entering Low Power Sleep on 1% battery right after the loss. 'Network is unreachable' is a local routing error, a hint that the client was the problem. Lessons: run laptop-side watchers and wait loops under caffeinate -i; pass the watcher its start time explicitly so a restart keeps the right time and cost caps; have the VM write a marker and save its outputs before any self-shutdown, so an idle shutdown is never silent; log load1 with every step so idle stretches show up in the logs.
