Skip to main content

host_machine_id

Function host_machine_id 

Source
pub fn host_machine_id() -> Option<String>
Expand description

A durable per-machine identifier that survives reboots.

/etc/machine-id is the systemd-era answer and /var/lib/dbus/machine-id the older one; a host with neither falls back to a boot-scoped id, which is weaker but still never shared between machines.

Deliberately not [crate::platform::host::machine_id_from], which treats an unreadable machine-id file as a hard error. That strictness exists to stop one user’s processes deriving two different identities and each believing it is the singleton. A fact reported to a caller that is only comparing machines has the opposite preference: keep looking, and answer with the best id available.