Make Mender node_id generation always authoritative on RPi - #41
Open
jehanazad wants to merge 2 commits into
Open
Make Mender node_id generation always authoritative on RPi#41jehanazad wants to merge 2 commits into
jehanazad wants to merge 2 commits into
Conversation
…irst boot The Mender device identity script caches node_id to /data/mender/node_id on first run. If this file exists in the rootfs at image creation time it gets baked into the data partition, causing every flashed device to share the same identity and appear as a single device in the Mender dashboard. Remove it during postprocessing alongside machine-id, which is already cleaned for the same reason. https://claude.ai/code/session_014KRrakaPXvCUSgXQcjvKhs
Devices were appearing as duplicates in the Mender dashboard because a stale node_id (from the device used to build/test the golden image) was persisted on the data partition. Every device flashed from that image inherited the same identity. Two-layer fix: 1. Identity script: on RPi hardware, always derive node_id from the hardware serial rather than trusting a cached value. The cache is refreshed if stale, so existing devices self-heal on next mender-authd invocation without manual intervention. 2. Postprocessing: explicitly remove node_id from the data partition during image creation (defence-in-depth, mirrors existing machine-id removal). https://claude.ai/code/session_014KRrakaPXvCUSgXQcjvKhs
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.
Summary
This change modifies the Mender device identity generation to always derive the node_id from the Raspberry Pi serial number on RPi hardware, rather than only on first boot. This ensures that stale node_id values baked into golden images are automatically refreshed, while maintaining backward compatibility with cached values on non-RPi hardware.
Key Changes
/proc/cpuinfoserial, not just on first bootrootfs2imageandrootfs2image.edinow remove cached node_id files during image generation to ensure each device generates its own unique ID on first bootmv) is maintained for cache updatesImplementation Details
/proc/cpuinfo)retprefix + last 8 hex characters of serialhttps://claude.ai/code/session_014KRrakaPXvCUSgXQcjvKhs