DBUS-UUIDGEN(1)

๐Ÿ’ซ dbus-uuidgen โ€” the UUID generator (user commands, bestie) ๐Ÿ’ซ

okay so real talk, this is dbus-uuidgen, and honestly? it's giving "small but mighty" โœจ she generates or reads a universally unique ID, that's the whole job, and she does it well. ๐ŸŽ€


๐ŸŒธ SYNOPSIS ๐ŸŒธ

dbus-uuidgen [--version] [--ensure [=FILENAME]] [--get [=FILENAME]]

๐Ÿฆ‹ DESCRIPTION ๐Ÿฆ‹

dbus-uuidgen generates or reads a universally unique ID. that's it. that's the vibe. ๐Ÿ’…

okay important disclaimer first bestie, don't skip this: the D-Bus UUID has no relationship to RFC 4122 and does not generate UUIDs compatible with that spec ๐Ÿ˜ญ. many systems have a separate command for that (often called uuidgen โ€” yes the name is confusingly similar, i know, i know, not my fault). so if you need RFC 4122 UUIDs, go to that other girl. ๐Ÿ’€

for more info about D-Bus, see https://www.freedesktop.org/wiki/Software/dbus/. ๐Ÿซถ

the primary usage of dbus-uuidgen is to run in the post-install script of a D-Bus package, like this:

dbus-uuidgen --ensure

this will ensure that /var/lib/dbus/machine-id exists and has the uuid in it โœจ. it won't overwrite an existing uuid, because this id should remain fixed for a single machine until the next reboot at least. no cap. ๐Ÿ”ฅ

the important properties of the machine UUID are, and i quote:

  1. it remains unchanged until the next reboot
  2. it is different for any two running instances of the OS kernel

that is, if two processes see the same UUID, they should also see the same shared memory, UNIX domain sockets, local X displays, localhost.localdomain resolution, process IDs, and so forth. it's an everything matches situation. iykyk. ๐Ÿ‘‘

if you run dbus-uuidgen with no options it just prints a new uuid made up out of thin air โœจ literally conjured. main character energy.

if you run it with --get, it prints the machine UUID by default, or the UUID in the specified file if you specify a file.

โš ๏ธ okay lowkey serious warning time: if you try to change an existing machine-id on a running system, it will probably result in bad things happening ๐Ÿ˜ญ do not try to change this file. and also don't make it the same on two different systems โ€” it needs to be different anytime there are two different kernels running. periodt.

the UUID should be different on two different virtual machines, because there are two different kernels. so no, you can't just copy-paste your machine-id into your VM and call it a day ๐Ÿ™ˆ.


โœจ OPTIONS โœจ

the following options are supported, bestie:

  • --get[=FILENAME] โ€” if you don't give a filename, it defaults to localstatedir/lib/dbus/machine-id (localstatedir is usually /var). if this file exists and is valid, the uuid in the file gets printed on stdout ๐Ÿ’–. otherwise, the command exits with a nonzero status. sad girl hours. ๐Ÿ˜ญ
  • --ensure[=FILENAME] โ€” if you don't give a filename, it defaults to localstatedir/lib/dbus/machine-id (localstatedir is usually /var). if this file exists then it will be validated, and a failure code returned if it contains the wrong thing ๐Ÿšจ. if the file does not exist, it will be created with a new uuid in it. on success, prints no output โ€” silent, mysterious, iconic. ๐ŸŽ€
  • --version โ€” print the version of dbus-uuidgen. that's it, she just tells you her age. ๐Ÿ’…

๐ŸŒˆ AUTHOR ๐ŸŒˆ

see https://dbus.freedesktop.org/doc/AUTHORS for the whole crew ๐Ÿซถ


๐Ÿ› BUGS ๐Ÿ›

please send bug reports to the D-Bus mailing list or bug tracker, see https://www.freedesktop.org/wiki/Software/dbus/ โ€” they genuinely wanna hear from you, no gatekeeping. ๐Ÿ’œ


and that's the page, bestie!! brought to you by D-Bus 1.16.2, dated 03/03/2025 โ€” DBUS-UUIDGEN(1), slay, periodt, go forth and generate responsibly ๐Ÿฆ‹โœจ

๐Ÿ“ฆ where this page comes from