Problem
Every Rebuild board is called recore, so recore.local is only unambiguous
while there is exactly one on the network. With two, avahi detects the conflict
and renames one to recore-2.local — and which one gets renamed depends on
boot order, so the mapping from name to board is not stable across a reboot.
For a user with one printer this is right and should stay the default. For the
test rig it is a blocker: four cells (A5, A6, A7, A8) on one network cannot be
told apart by name at all.
Why the name matters more than it looks
Addressing these boards by IP is not a workable fallback:
- The board takes a new DHCP lease readily. One A8 moved through four addresses
in a single evening of testing.
eth0 has no MAC in the device tree or efuse, so it takes a
locally-administered address that can change per boot. A DHCP reservation has
nothing stable to key on.
So mDNS is the only durable handle on a board, which makes the hostname
load-bearing rather than cosmetic.
Proposal
An opt-in unique hostname derived from the serial number, e.g.
recore-0498.
The serial number is already available and already surfaced: it lives at
/mnt/config/serial_number, get-recore-serial-number reads it, and Reflash's
/api/get_info reports it — the A8 on the bench answers 0498.
Suggested shape:
- A toggle in Reflash's options, alongside magic mode and reboot-when-done,
written into /etc/rebuild-settings with the rest of the settings.
- Applied by
rebuild-first-run, which already runs once on first boot and
already sources /etc/rebuild-settings. Nothing sets the hostname there
today, so it is a clean place to add it.
- Default off. Most users have one board and expect
recore.local; this
should not change under them.
Worth deciding deliberately
Publish both names. avahi can advertise additional CNAMEs, so a board could
answer to both recore-0498.local and recore.local. Single-board users and
every existing document keep working, while multi-board setups get something
unambiguous. That seems strictly better than swapping one name for another, at
the cost of the conflict still existing for anyone who turns it on with two
boards — which is exactly who wanted it off.
A board with no serial provisioned. get-recore-serial-number exists partly
to detect that case. The fallback has to be plain recore rather than something
like recore- or recore-unknown, or the unprovisioned boards collide with
each other instead.
What else keys on the hostname. Moonraker's trusted-client and CORS
configuration, anything in the Klipper config referring to the host, and any
bookmark a user has. Changing the hostname after those are written is the part
most likely to surprise someone.
SSH host keys. Not affected by the name, but worth noting alongside: a rig
that reflashes constantly already sees the key change on every flash, which is
why validate-image.sh uses a throwaway known_hosts.
Related
Reflash: "consider a different hostname for Reflash images" — the same collision
from the other side. Both images calling themselves recore means a single
board flips between two systems with one name within a minute of each other,
which is how recore.local ends up resolving to nothing (Rebuild #87). The two
changes are independent but they interact, so it is worth deciding the naming
for both at once.
Problem
Every Rebuild board is called
recore, sorecore.localis only unambiguouswhile there is exactly one on the network. With two, avahi detects the conflict
and renames one to
recore-2.local— and which one gets renamed depends onboot order, so the mapping from name to board is not stable across a reboot.
For a user with one printer this is right and should stay the default. For the
test rig it is a blocker: four cells (A5, A6, A7, A8) on one network cannot be
told apart by name at all.
Why the name matters more than it looks
Addressing these boards by IP is not a workable fallback:
in a single evening of testing.
eth0has no MAC in the device tree or efuse, so it takes alocally-administered address that can change per boot. A DHCP reservation has
nothing stable to key on.
So mDNS is the only durable handle on a board, which makes the hostname
load-bearing rather than cosmetic.
Proposal
An opt-in unique hostname derived from the serial number, e.g.
recore-0498.The serial number is already available and already surfaced: it lives at
/mnt/config/serial_number,get-recore-serial-numberreads it, and Reflash's/api/get_inforeports it — the A8 on the bench answers0498.Suggested shape:
written into
/etc/rebuild-settingswith the rest of the settings.rebuild-first-run, which already runs once on first boot andalready sources
/etc/rebuild-settings. Nothing sets the hostname theretoday, so it is a clean place to add it.
recore.local; thisshould not change under them.
Worth deciding deliberately
Publish both names. avahi can advertise additional CNAMEs, so a board could
answer to both
recore-0498.localandrecore.local. Single-board users andevery existing document keep working, while multi-board setups get something
unambiguous. That seems strictly better than swapping one name for another, at
the cost of the conflict still existing for anyone who turns it on with two
boards — which is exactly who wanted it off.
A board with no serial provisioned.
get-recore-serial-numberexists partlyto detect that case. The fallback has to be plain
recorerather than somethinglike
recore-orrecore-unknown, or the unprovisioned boards collide witheach other instead.
What else keys on the hostname. Moonraker's trusted-client and CORS
configuration, anything in the Klipper config referring to the host, and any
bookmark a user has. Changing the hostname after those are written is the part
most likely to surprise someone.
SSH host keys. Not affected by the name, but worth noting alongside: a rig
that reflashes constantly already sees the key change on every flash, which is
why
validate-image.shuses a throwawayknown_hosts.Related
Reflash: "consider a different hostname for Reflash images" — the same collision
from the other side. Both images calling themselves
recoremeans a singleboard flips between two systems with one name within a minute of each other,
which is how
recore.localends up resolving to nothing (Rebuild #87). The twochanges are independent but they interact, so it is worth deciding the naming
for both at once.