Truncate /etc/machine-id instead of deleting it.

If /etc/machine-id exists but is empty, systemd will do tricks
with bind-mounts to ensure that a valid transient UUID is bind-mounted
over it, which is exactly what we want for a live system.

If /etc/machine-id does not exist, systemd-journald
will just fail, which is undesirable.
This commit is contained in:
Simon McVittie 2014-04-25 18:02:06 +01:00 committed by Daniel Baumann
parent 0c3f19cf25
commit eeb4680557
1 changed files with 8 additions and 4 deletions

View File

@ -2,8 +2,12 @@
set -e
# Remove systemd machine id.
#
# This removes systemd machine id that cache that makes each system unique.
# Blank out systemd machine id. If it does not exist, systemd-journald
# will fail, but if it exists and is empty, systemd will automatically
# set up a new unique ID.
rm -f /etc/machine-id
if [ -e /etc/machine-id ]
then
rm -f /etc/machine-id
: > /etc/machine-id
fi