diff --git a/man/machine-id.xml b/man/machine-id.xml index f4d94e8800..ebee065a61 100644 --- a/man/machine-id.xml +++ b/man/machine-id.xml @@ -99,8 +99,8 @@ be used. If this file is empty or missing, systemd will attempt to use the D-Bus machine ID from /var/lib/dbus/machine-id, the value of the kernel command line option container_uuid, the KVM DMI - product_uuid (on KVM systems), and finally a randomly generated - UUID. + product_uuid or the devicetree vm,uuid + (on KVM systems), and finally a randomly generated UUID. After the machine ID is established, systemd1 diff --git a/src/core/machine-id-setup.c b/src/core/machine-id-setup.c index 9d3096e3ac..284b77c1fc 100644 --- a/src/core/machine-id-setup.c +++ b/src/core/machine-id-setup.c @@ -68,6 +68,11 @@ static int generate_machine_id(const char *root, sd_id128_t *ret) { log_info("Initializing machine ID from KVM UUID."); return 0; } + /* on POWER, it's exported here instead */ + if (id128_read("/sys/firmware/devicetree/base/vm,uuid", ID128_UUID, ret) >= 0) { + log_info("Initializing machine ID from KVM UUID."); + return 0; + } } } diff --git a/src/hostname/hostnamed.c b/src/hostname/hostnamed.c index 75cba5827c..9e4f4fb59e 100644 --- a/src/hostname/hostnamed.c +++ b/src/hostname/hostnamed.c @@ -116,6 +116,8 @@ static int context_read_data(Context *c) { return r; r = id128_read("/sys/class/dmi/id/product_uuid", ID128_UUID, &c->uuid); + if (r == -ENOENT) + r = id128_read("/sys/firmware/devicetree/base/vm,uuid", ID128_UUID, &c->uuid); if (r < 0) log_full_errno(r == -ENOENT ? LOG_DEBUG : LOG_WARNING, r, "Failed to read product UUID, ignoring: %m");