mirror of
https://github.com/libguestfs/libguestfs.git
synced 2026-03-21 22:53:37 +00:00
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.
This commit is contained in:
@@ -85,6 +85,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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user