Files
mesh-catalog/modules/hostname/README.md
T
jochen 138d9afd7b Rename hosts to hostname, which also writes /etc/hostname (hq ADR 0223)
Two files say one fact, the machine's name, and nothing owned /etc/hostname.
The name written is the operator's hostname setting, with no default: three
of four machines call themselves something other than their mesh name, and
renaming one is the operator's call. It takes effect at the next boot.
2026-10-05 23:43:14 +02:00

35 lines
2.1 KiB
Markdown

# hostname
The machine's names (novox/hq ADR 0199, ADR 0223): it holds the node seat `node-hostname` and owns
the two files that say what a machine is called — `/etc/hostname` and the machine's own lines in
`/etc/hosts`. It was `hosts`, holding `node-hosts-file`; the seat was renamed, and the old name
resolves to it as an alias.
## What it writes
- **`/etc/hostname`, whole**: the module's `hostname` setting, and nothing else. There is no
default. A machine's name is the operator's: the mesh's name for a machine and the name it calls
itself need not be the same, and writing the mesh's name silently would rename a machine. Set it
per machine — `settings set hostname '{"hostname": "<name>"}' --node <node>` — before the module
is assigned there; without it the module is left out of that machine's declaration, naming the
key. A mesh-wide `{"hostname": "${machine:name}"}` makes every machine call itself by its mesh
name, and a machine's own setting still overrides it.
- **The machine's own lines in `/etc/hosts`**, as the mesh's marked region at the start of the file:
`localhost` and `127.0.1.1` with the machine's mesh name. Every other line is the operator's, kept
byte for byte and given back when the module goes.
## When a new name takes effect
At the machine's **next boot**. The kernel's name is set from `/etc/hostname` when the machine
starts; writing the file changes what `hostnamectl` reports as the static name and nothing that is
running. The module declares nothing that would set it live: a graphical session's X authority is
keyed by the name the session started under, so changing it underneath a running session refuses
every new window until the person logs in again. Reboot when that is acceptable, or run
`hostnamectl hostname <name>` by hand.
## Its verbs
`<node>/node-hostname.entries`, `.add` and `.remove`: the hosts file's lines, each marked whose it
is; add one address and its names to the operator's lines; remove a name or an address from them.
They change the machine's file and nothing else. `/etc/hostname` has no verb — it is the setting.