devicestate: allow auto-refresh when registration is skipped (noregister)#8
Merged
Conversation
…ter)
canAutoRefresh only returns true early when ensureOperationalAttempts >= 3
("we tried to get a serial for a while, allow refresh anyway"); otherwise it
requires a serial. Syncloud has no serial vault, so before PR #6 snapd kept
attempting registration, failed, and after 3 attempts that fallback enabled
auto-refresh — the perpetual "Initialize device" error was ugly but it is what
kept auto-refresh alive.
PR #6 (snapd 666) added the /run/snapd/noregister marker so ensureOperational
returns before ever attempting registration. That removed the error but left
ensureOperationalAttempts at 0, so the >= 3 fallback never fires and, with no
serial, canAutoRefresh returns false permanently. Every device that upgraded to
snapd 666 stopped auto-refreshing (snap refresh --time shows next: n/a); a
reboot does not help because the marker is recreated each boot and attempts
stays 0.
Treat the noregister marker as an explicit opt-out of registration that should
still permit auto-refresh, mirroring the marker check in ensureOperational.
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.
Problem
Every device that auto-upgraded to snapd 666 stopped auto-refreshing —
snap refresh --timeshowsnext: n/aand all snaps freeze at their pre-upgrade revisions. A reboot /systemctl restart snapddoes not fix it.Root cause
canAutoRefresh()(overlord/devicestate/devicestate.go) only allows auto-refresh early whenensureOperationalAttempts >= 3("we tried to get a serial for a while, allow refresh anyway"); otherwise it requires a serial, which Syncloud never has (no serial vault).PR #6 (
27b3bb7dce, snapd 666) added the/run/snapd/noregistermarker soensureOperationalreturns before attempting registration. That leavesensureOperationalAttemptsat 0, so the>= 3fallback never fires and, with no serial,canAutoRefreshreturnsfalsepermanently. Before #6 the perpetual "Initialize device" error was ugly, but it bumped attempts past 3 — which is what kept auto-refresh alive.A reboot doesn't help because the marker is recreated each boot and attempts resets to 0.
Fix
Treat the
noregistermarker as an explicit opt-out of registration that should still permit auto-refresh, mirroring the marker check already inensureOperational.Test
TestCanAutoRefreshNoRegister: seeded + model + no serial + 0 attempts →false; then with thenoregistermarker present →true.Rollout
Publish snapd 667 with this fix. Each device's daily platform
SnapdUpgradeJob(runs independently of the broken snap auto-refresh) upgrades snapd 666→667, after which auto-refresh resumes and apps catch up. No user action required.