KamoCRM

A computer that has never restarted can never sleep

FixKlusterServices
Shipped
September 23, 2026 at 2:11 PM UTC
Author
Kamo
Commit
89eaa9b

prepare-sleep writes the swap file and the resume wiring, then reports readiness — and readiness reads `resume=` from /proc/cmdline, which the kernel fixed at boot. Writing grub.d and running update-grub therefore cannot make the RUNNING kernel resumable. Readiness stays false until the machine restarts. Nothing restarts it. Sleeping is what powers a computer down, sleeping needs readiness, readiness needs the restart. A freshly provisioned computer sits at "cannot go to sleep" forever, holding its tier's memory on a node for as long as it exists, and the only sign is a lastError nobody has a reason to read. Observed on the first computer ever provisioned: {"kernelSupportsDisk": true, "swapLargeEnough": true, "resumeConfigured": false} swapBytes 3221221376, swapNeededBytes 2095474483 Two of the three preconditions already satisfied, the third unreachable by design. configure() now reports whether it wrote the wiring, and prepare-sleep restarts the machine once when it did. Safe at that moment specifically — prepare-sleep runs at the end of provisioning and before an idle sleep, both of which mean nobody is working — but checked rather than assumed with IDLE.rdp_sessions(), because it also runs after a kernel upgrade on a machine that may well be in use. The restart is detached and delayed three seconds so the caller gets its 200 first, the same reasoning sleep_now already uses for the power cut. A second run that changes nothing returns false and does not bounce the machine.

All changes

Like what you see shipping?

All of it arrives in your workspace on its own. Start on the free plan and read this page again in a month.

Start Free ForeverView Pricing