LinuxCommandLibrary

systemd-id128

Generate or manipulate 128-bit IDs

TLDR

Generate a new random identifier

$ systemd-id128 new
copy

Print the identifier of the current machine
$ systemd-id128 machine-id
copy

Print the identifier of the current boot
$ systemd-id128 boot-id
copy

Print the identifier of the current service invocation (this is available in systemd services)
$ systemd-id128 invocation-id
copy

Generate a new random identifier and print it as a UUID (five groups of digits separated by hyphens)
$ systemd-id128 new [[-u|--uuid]]
copy

SYNOPSIS

systemd-id128 [OPTIONS...] COMMAND [ID...]

Examples:
systemd-id128 new
systemd-id128 machine-id
systemd-id128 encode fedcba9876543210fedcba9876543210

PARAMETERS

new
    Generates and prints a new, truly random 128-bit ID in hexadecimal format.

machine-id
    Prints the unique machine ID of the current system, typically read from /etc/machine-id.

boot-id
    Prints the unique ID of the current system boot, generated per boot.

varvfs-id
    Prints the 128-bit ID identifying the random seed file in /var/lib/systemd/random.

uuid
    Prints the 128-bit ID associated with the current user, based on their UID.

list []
    Lists known 128-bit IDs. If is provided, lists specific IDs; otherwise, lists common system IDs.

encode
    Encodes a 32-character hexadecimal 128-bit ID string into a 22-character base64-encoded string.

decode
    Decodes a 22-character base64-encoded 128-bit ID string back into its 32-character hexadecimal representation.

print-id [--pretty|--global|--uuid|--machine-id|--boot-id]
    Prints a specific ID. --pretty formats it with hyphens. Can specify which ID to print.

status
    Displays the status of the machine ID, including its persistence and any issues.

-h, --help
    Shows a short help message and exits.

--version
    Shows a short version string and exits.

--json=pretty|full|short|compact
    Formats output as JSON, with different levels of verbosity and formatting.

--no-pager
    Do not pipe output into a pager.

--strict
    Enables strict parsing of command line arguments, failing on unknown options.

DESCRIPTION

systemd-id128 is a utility included with the systemd suite that provides functionality for generating, managing, and converting 128-bit IDs, also known as UUIDs (Universally Unique Identifiers) or GUIDs (Globally Unique Identifiers). These IDs are crucial for systemd's internal operations, identifying machines, boots, users, and various system components uniquely. The command allows users to retrieve the system's machine ID, the current boot ID, and even a user's unique ID. Beyond simple display, systemd-id128 can generate new random 128-bit IDs, and offers conversion utilities to encode these IDs from their standard hexadecimal representation to a base64 format and vice-versa. This tool is fundamental for systemd-based systems requiring robust and unique identification for logging, configuration, and service management.

CAVEATS

The machine-id is persistent across reboots unless manually changed or regenerated. Exposing it publicly could potentially allow tracking of a specific machine.
The boot-id is unique for each boot, but generally not globally unique across all boots of all machines.
Care should be taken when using the new command, as generating excessive IDs or replacing critical system IDs without understanding the implications can lead to system instability.

ID TYPES EXPLAINED

systemd-id128 interacts with several types of 128-bit IDs:
Machine ID: A unique identifier for the entire system, persistent across reboots, stored in /etc/machine-id. It's crucial for systemd-journald and other services.
Boot ID: A unique identifier for each system boot. It changes every time the system is restarted.
User UUID: A UUID derived from a user's UID, providing a stable identifier for a user account across sessions.

ID FORMAT AND ENCODING

128-bit IDs are typically represented as 32 hexadecimal characters (e.g., 1234567890abcdef1234567890abcdef).
systemd-id128 provides encode and decode commands to convert these IDs to and from a compact 22-character base64 representation, which is useful for situations where shorter strings are preferred, such as in DNS records or command-line arguments.

HISTORY

systemd-id128 is an integral part of the systemd project, introduced early in its development lifecycle. Its functionality underpins systemd's robust system identification scheme, which relies heavily on 128-bit IDs for various purposes, including logging, journal entries, and service instance identification. It formalizes and provides a standardized way to interact with these crucial identifiers within the systemd ecosystem, rather than relying on external tools like uuidgen for system-level ID management.

SEE ALSO

uuidgen(1), machine-id(5), systemd(1), sd_id128(3)

Copied to clipboard