Skip to content

node id is hardware-derived on embedded; retire the bootstrap log sink - #564

Open
TurkeyMan wants to merge 1 commit into
masterfrom
ow/embedded-identity-and-log-sink
Open

node id is hardware-derived on embedded; retire the bootstrap log sink#564
TurkeyMan wants to merge 1 commit into
masterfrom
ow/embedded-identity-and-log-sink

Conversation

@TurkeyMan

Copy link
Copy Markdown
Member

Two small fixes in src/manager, both found bringing up a bare-metal target with a single UART.

Node identity is hardware-derived on embedded.

node_id() already prefers a chip-burned id where the platform has one, and falls back to generating a random id and persisting it to conf/node.id. On a micro that fallback is wrong twice over: there is no writable config to persist to, and a fresh id every boot would churn peering identity across reboots. The observed result was a warning on every boot and an ephemeral identity:

system: couldn't persist node id to conf/node.id; identity is ephemeral this boot

Generation and the file are now desktop-only. An embedded platform without unique_device_id() reports the gap rather than papering over it — which makes it a concrete piece of platform work (ESP32 already implements it; BK7231 needs efuse / RF-calibration MAC).

Retire the bootstrap log sink when a consumer attaches.

The bootstrap sink writes raw to stdout before the command system exists, and is meant to be replaced "as soon as [the startup commands] can". It is only retired from a /log/sink object's startup(). But a console session that streams the log — initial-command="/log/print --stream", which is how a single-wire console is configured — registers a consumer, not a sink object, so the handover never happened.

With both live on one UART the output duplicated and interleaved mid-token:

[Info] console-session 'default': online
[Info] console-session 'default': online      <- same line, both writers
[Em<garbage>[Info] serial 'console': online

register_consumer now retires it too.

A micro has no writable config to persist an id in, and generating a fresh one
each boot would churn peering identity, so node_id() now takes the chip-burned
id or reports the platform gap. Generation and conf/node.id are desktop only.

The bootstrap log sink wrote raw to stdout until a /log/sink object replaced
it, but a console session streaming the log registers a consumer instead, so
on a single-wire console it never retired and raced the session for the UART.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant