Blob Blame History Raw
From f7e32e558df19e875ecb5424903923160ed2da1c Mon Sep 17 00:00:00 2001
From: Pino Toscano <ptoscano@redhat.com>
Date: Wed, 30 Mar 2016 10:15:49 +0200
Subject: [PATCH] appliance: init: generate /etc/machine-id

Some of the systemd-tmpfiles snippets need the machine ID of the running
system; the current lack of this file produces warning messages during
the appliance boot like:

[/usr/lib/tmpfiles.d/systemd.conf:26] Failed to replace specifiers: /run/log/journal/%m
[/usr/lib/tmpfiles.d/systemd.conf:28] Failed to replace specifiers: /run/log/journal/%m
[/usr/lib/tmpfiles.d/systemd.conf:29] Failed to replace specifiers: /run/log/journal/%m

Thus create a new randomly-generated /etc/machine-id on boot.

(cherry picked from commit 807433bc230987270680ad28643e9c1741790c29)
---
 appliance/init | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/appliance/init b/appliance/init
index 4a04bce..b05c0ed 100755
--- a/appliance/init
+++ b/appliance/init
@@ -87,6 +87,10 @@ fi
 mkdir -p /run/tmpfiles.d
 kmod static-nodes --format=tmpfiles --output=/run/tmpfiles.d/kmod.conf
 
+# Create a machine-id with a random UUID
+machine_id=$(dd if=/dev/urandom bs=16 count=1 status=none | od -x -A n)
+echo "${machine_id// /}" > /etc/machine-id
+
 # Set up tmpfiles (must run after kmod.conf is created above).
 systemd-tmpfiles --prefix=/dev --create --boot
 
-- 
1.8.3.1