Blame SOURCES/0047-appliance-init-generate-etc-machine-id.patch

e76f14
From f7e32e558df19e875ecb5424903923160ed2da1c Mon Sep 17 00:00:00 2001
e76f14
From: Pino Toscano <ptoscano@redhat.com>
e76f14
Date: Wed, 30 Mar 2016 10:15:49 +0200
e76f14
Subject: [PATCH] appliance: init: generate /etc/machine-id
e76f14
e76f14
Some of the systemd-tmpfiles snippets need the machine ID of the running
e76f14
system; the current lack of this file produces warning messages during
e76f14
the appliance boot like:
e76f14
e76f14
[/usr/lib/tmpfiles.d/systemd.conf:26] Failed to replace specifiers: /run/log/journal/%m
e76f14
[/usr/lib/tmpfiles.d/systemd.conf:28] Failed to replace specifiers: /run/log/journal/%m
e76f14
[/usr/lib/tmpfiles.d/systemd.conf:29] Failed to replace specifiers: /run/log/journal/%m
e76f14
e76f14
Thus create a new randomly-generated /etc/machine-id on boot.
e76f14
e76f14
(cherry picked from commit 807433bc230987270680ad28643e9c1741790c29)
e76f14
---
e76f14
 appliance/init | 4 ++++
e76f14
 1 file changed, 4 insertions(+)
e76f14
e76f14
diff --git a/appliance/init b/appliance/init
e76f14
index 4a04bce..b05c0ed 100755
e76f14
--- a/appliance/init
e76f14
+++ b/appliance/init
e76f14
@@ -87,6 +87,10 @@ fi
e76f14
 mkdir -p /run/tmpfiles.d
e76f14
 kmod static-nodes --format=tmpfiles --output=/run/tmpfiles.d/kmod.conf
e76f14
 
e76f14
+# Create a machine-id with a random UUID
e76f14
+machine_id=$(dd if=/dev/urandom bs=16 count=1 status=none | od -x -A n)
e76f14
+echo "${machine_id// /}" > /etc/machine-id
e76f14
+
e76f14
 # Set up tmpfiles (must run after kmod.conf is created above).
e76f14
 systemd-tmpfiles --prefix=/dev --create --boot
e76f14
 
e76f14
-- 
e76f14
1.8.3.1
e76f14