- Порезанный
- 24 сентября 2026 г. в 01:43 UTC
- Автор
- Kamo
- Обещать
- 45d5dd3
A brand new computer provisioned, came up, reported AWAKE, and ninety seconds later panicked: Kernel panic - not syncing: No working init found. I caused that. _ensure_resume writes the grub fragment, runs update-grub, and only THEN runs update-initramfs -u. resume_restart_decision is satisfied the moment update-grub finishes — it checks grub.cfg — so a watcher tick landing in that window rebooted the machine while the initramfs was still being written. A truncated initrd cannot mount root, the kernel cannot exec init, and the computer is unbootable with nothing in it able to say why. The window was opened by moving the restart into IdleWatcher.tick(), which does not hold the lock that configure() takes. So restart_for_resume now takes that same lock before it decides anything. Non-blocking, deliberately: configure() holds the lock for minutes while it writes a RAM-sized swap file to a network volume, and the idle watcher has to keep polling through that rather than stall behind it. A skipped tick costs thirty seconds and the refusal says exactly why. The regression test holds the lock and asserts that no reboot is issued, then releases it and asserts the next attempt proceeds.
