LinuxCommandLibrary

dbus-uuidgen

Generate a unique machine ID

SYNOPSIS

dbus-uuidgen [--version] [--help] [--get-machine-id] [--ensure[=FILE]]

PARAMETERS

--version
    Print version information and exit.

--help
    Print command-line usage help and exit.

--get-machine-id
    Print machine UUID from standard location (/var/lib/dbus/machine-id). Errors if invalid or missing.

--ensure[=FILE]
    Ensure FILE has valid UUID; generate and write new one if needed. Defaults to /var/lib/dbus/machine-id.

DESCRIPTION

dbus-uuidgen is a utility from the D-Bus message bus system used to generate UUID version 4 (random) identifiers. These UUIDs uniquely identify the local machine, primarily populating the /var/lib/dbus/machine-id file.

This file is critical for D-Bus-enabled services, systemd, and applications needing a stable, unique host ID without relying on changeable hostnames. Running the command without options outputs a new 32-character hexadecimal UUID to stdout, suitable for manual file creation during system setup.

It supports retrieving or ensuring valid IDs, preventing errors in sessionless environments. Modern distributions automate this via init scripts or systemd, but manual use persists for custom setups or recovery.

CAVEATS

Regenerating machine ID often disrupts services relying on persistence (e.g., logs, DHCP leases). Use only when necessary; prefer systemd tools on modern systems.

DEFAULT USAGE

No options: Prints new random UUID to stdout, e.g., for dbus-uuidgen > /var/lib/dbus/machine-id.

UUID FORMAT

Outputs 32 hex chars + 4 hyphens (e.g., 12345678-1234-5678-9abc-def012345678), compliant with RFC 4122.

HISTORY

Developed as part of D-Bus (freedesktop.org project) around 2002. Evolved in D-Bus 1.0+ for standardized machine ID handling, integrated with systemd since ~2010.

SEE ALSO

Copied to clipboard