devicestate: silence device-registration noise from trusted-baked assertions#3
Open
cyberb wants to merge 1 commit into
Open
devicestate: silence device-registration noise from trusted-baked assertions#3cyberb wants to merge 1 commit into
cyberb wants to merge 1 commit into
Conversation
The syncloud brand account and root account-key are baked into the trusted assertion set (asserts/sysdb.trusted), but the device service still streams them alongside the serial when registering the device. Committing the returned ancillary batch fails because the assertion database refuses to add an assertion whose primary key clashes with a trusted one, so device registration (the 'Initialize device' change) perpetually shows Error in 'snap changes': cannot add "account-key" assertion with primary key clashing with a trusted assertion: [hIedp1AvrWlcDI4uS_qjoFLzjKl5enu4G2FYJpgB3Pj...] Drop ancillary assertions that already exist in the trusted set when building the batch. When the batch ends up empty the serial is accepted via the acceptSerialOnly path, whose fetcher resolves the trusted signing key via FindPredefined and skips it, so registration completes cleanly and the noise disappears. This keeps the change small and contained; the eventual store-side fix (not streaming already-trusted assertions) would let an unmodified upstream snapd work as well.
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
A user device error report showed a perpetually-errored
Initialize devicechange insnap changes:The device works fine, but the errored change is confusing noise in every debug report.
Root cause
Syncloud bakes its brand
accountand rootaccount-key(hIedp1Av...) into the trusted assertion set (asserts/sysdb.trusted). During device registration the device service still streams those same assertions alongside the serial. Committing that ancillary batch fails becauseDatabase.Addrefuses any assertion whose primary key clashes with a trusted one, so theRequest device serialtask errors out.Fix
When decoding the serial response stream in
submitSerialRequest, drop ancillary assertions that already exist in the trusted set. If the batch ends up empty, the serial is accepted via the existingacceptSerialOnlypath — its fetcher resolves the (trusted) signing key throughFindPredefinedand skips it — so registration completes cleanly and the noise disappears.The change is deliberately small and contained to the syncloud device-registration flow; it does not touch the core assertion database semantics. The eventual store-side fix (not streaming assertions that are already trusted on the device) would let an unmodified upstream snapd work as well — this keeps us moving toward dropping the fork without requiring it now.
Tests
TestClashesWithTrustedunit test.TestFullDeviceRegistrationHappy*,TestDoRequestSerialIdempotent*) still pass. (The broader suite's network tests hang in an offline sandbox and were excluded — unrelated to this change.)