Repository navigation
Unconfirmed changes no longer survive a reboot (#9) - #50
Merged
Merged
Conversation
…rker, rolled back at boot The confirm state lived in tmpfs (/run/mini-router/confirm-pending) and was written only after the apply had finished, so a power cut, watchdog reset or crash during an apply or inside the confirm window kept a configuration nobody had accepted. - The marker is /etc/mini-router/confirm-pending (JSON: snapshot, state applying|pending|reverting, deadline, origin), fsynced right after the snapshot and before the first new file; it goes away (after a sync) only when the change is accepted (apply without --confirm, `mr confirm`) or the rollback has put the old files back. - `mr rollback --boot`: restores the marker's snapshot offline (files, removed files, default runlevel links; nothing restarted) and logs it. mr-preinit runs it after pivoting into the overlay, before firstboot and init; Alpine installs get the mr-unconfirmed boot service. - The confirm timer and the web UI's revert only act on a pending change and mark it reverting; `mr confirm` refuses while the apply is still running or being rolled back; an explicit `mr rollback` settles a pending change. - Tests: boot rollback, interrupted apply, unreadable marker / missing snapshot, confirm states, timer; nandsim selftest P8 (power cut in the window -> old config at boot; confirmed -> kept). Closes #9
This was referenced Sep 25, 2026
Closed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
/etc/mini-router/confirm-pending(JSON:snapshot,state= applying | pending | reverting,deadline,via). It is fsynced right after the snapshot and before the first new file is written, and removed (after async) only when the change is accepted (apply without--confirm,mr confirm) or a rollback has put the old files back.mr rollback --boot: restores the marker's snapshot offline — files back, files the change created removed, default runlevel links matched to the restored config (linkRunlevel), nothing restarted — and records it in/etc/router-changes.log(timestamp: best guess from the marker / mr-clock reference, the board has no RTC).mr-preinitruns it after pivoting into the overlay, beforefirstbootand init (logged to the kernel log). Alpine installs (no preinit) get themr-unconfirmedboot-runlevel service;install.shenables it.mr confirmrefuses while the apply is still running or being rolled back; an explicitmr rollbacksettles a pending change.Why
/runis tmpfs and the marker was written only after the apply had finished. A power cut, watchdog reset or kernel oops during an apply or inside the confirm window kept a configuration nobody had confirmed — the exact case the confirm window exists for (RouterOS Safe Mode and VyOS go back to the old config here).Verification
tools/ci.shpasses (private and public trees). New unit tests (mr/apply_test.go): boot rollback of an unconfirmed change (restored and removed files, runlevel links incl. dangling per-WAN instances, change log, marker gone, no-op without a marker), interrupted apply, unreadable marker / missing snapshot (reported once, not retried every boot),mr confirmin every state, the timer leaves other changes alone.apply --confirmleaves it (snapshot, new router.yaml, a file created by the change, a runlevel link, the marker): after boot the old LAN address is back, the created file and the link are gone, marker removed, kernel log and change log have the rollback line; the same state without the marker (confirmed) boots with the new config.Closes #9
https://claude.ai/code/session_01HWeUjo1dmS7gBkCYHrVjCr