How to Generate and Resolve 128-Bit Unique Identifiers in Ubuntu Using systemd-id128

Modern Linux distributions rely on 128-bit cryptographic and pseudo-random identifiers to distinguish machine installations, identify individual boot cycles, allocate systemd journal files, and declare standardized GPT partition types. While standard utilities like uuidgen generate generic RFC 4122 UUID strings, systemd incorporates an optimized 128-bit identifier format designed for high-performance indexing and deterministic hashing. To generate new random identifiers, inspect machine and boot IDs, derive application-specific tokens, and resolve Discoverable Partitions Specification (DPS) types, Ubuntu provides the dedicated systemd-id128 command.

Understanding systemd 128-Bit Identifiers

A systemd 128-bit ID is fundamentally a 16-byte integer formatted either as a continuous 32-character hexadecimal string without hyphens (the native systemd format, e.g., a3c5e2194f1b402bb8c0d952671e9841) or as a traditional hyphenated UUID formatted into 8-4-4-4-12 groupings.

Systemd uses these identifiers across multiple core facilities:

  • /etc/machine-id: The persistent 128-bit identifier assigned to an operating system installation during initial provisioning.
  • /proc/sys/kernel/random/boot_id: A transient 128-bit identifier regenerated dynamically by the kernel on every system reboot.
  • SD-ID128 Partition Types: Standardized GPT partition type GUIDs defined by the systemd Discoverable Partitions Specification (DPS) that allow automated mounting of root, home, swap, and var partitions without manual /etc/fstab entries.

Generating Random 128-Bit Identifiers

When developing system services, configuration management templates, or application database tables that require cryptographically secure unique keys, systemd-id128 provides instantaneous ID generation sourced directly from Linux kernel entropy.

To generate a standard 32-character hexadecimal ID:

systemd-id128 new

The command outputs a continuous alphanumeric string:

f7b189c426e84d72b53908f51a2491de

To generate the identifier formatted as a traditional RFC 4122 hyphenated UUID string, pass the -u (UUID) switch:

systemd-id128 new -u

Output:

f7b189c4-26e8-4d72-b539-08f51a2491de

Querying Machine and Boot Identifiers

Automation scripts frequently need to query the host machine’s identity or verify whether the system has rebooted between scheduled task executions.

Inspecting the Persistent Machine ID

To query the host installation machine ID formatted as a standard UUID:

systemd-id128 machine-id -u

The output returns the exact UUID stored inside /etc/machine-id. This identifier remains constant across reboots and software updates, providing an ideal anchor for node registration in clustered environments.

Inspecting the Ephemeral Boot ID

To retrieve the identifier corresponding to the active boot session:

systemd-id128 boot-id -u

This matches the value stored in /proc/sys/kernel/random/boot_id, allowing logging pipelines to group audit entries by boot cycle.

Deriving Application-Specific Identifiers

In containerized environments, cloud templates, or distributed microservices, you may want an application or daemon to possess a stable unique identifier derived directly from the host system’s machine ID, but without exposing the actual host /etc/machine-id itself. Revealing raw machine IDs across public APIs can introduce tracking or fingerprinting concerns.

The systemd-id128 utility solves this by implementing HMAC-SHA256 keyed hashing to generate reproducible, application-scoped IDs from an application name string:

systemd-id128 machine-id -a "my-custom-service" -u

Every time this command is executed on the same physical host, it returns the identical deterministic UUID for my-custom-service. On any other host, it generates a completely different UUID, providing stable local device binding without leaking underlying hardware identifiers.

Resolving Discoverable Partition Type GUIDs

Modern systemd distributions automatically mount disk partitions based on their GPT partition type GUIDs. To view the complete dictionary of well-known 128-bit identifiers recognized by the systemd storage architecture, use the show command:

systemd-id128 show

The output lists recognized system architecture types and partition flags:

NAME                 ID                               UUID
root-x86-64          4f68bce3e8cd4db196e7fbcaf984b709 4f68bce3-e8cd-4db1-96e7-fbcaf984b709
home                 933ac7e12eb44f13b820c6815c4de5d2 933ac7e1-2eb4-4f13-b820-c6815c4de5d2
swap                 0657fd6da4ab43c484e50933c84b4f4f 0657fd6d-a4ab-43c4-84e5-0933c84b4f4f
srv                  3b8f842520e04f3b8141117180b2d57e 3b8f8425-20e0-4f3b-8141-117180b2d57e

To query a specific partition type identifier directly:

systemd-id128 show root-x86-64 -u

This capability eliminates the need to look up partition GUID tables manually when writing disk-partitioning automation scripts with fdisk, sfdisk, or parted.

Get the best tech tips delivered straight to your inbox.

Join thousands of readers mastering Apple, Google, Microsoft, and Linux.