Merge "Set machine-id to uninitialized to trigger first boot"

This commit is contained in:
Zuul 2022-04-28 01:35:54 +00:00 committed by Gerrit Code Review
commit 555cecb670

View File

@ -6,10 +6,17 @@ fi
set -eu
set -o pipefail
if [ -e /etc/machine-id ]; then
> /etc/machine-id
fi
if [ -e /var/lib/dbus/machine-id ]; then
> /var/lib/dbus/machine-id
fi
# According to documented First Boot Semantics writing "uninitialized" will trigger the full
# first boot behaviour.
# https://www.freedesktop.org/software/systemd/man/machine-id.html#First%20Boot%20Semantics
# On older versions of systemd before first boot semantics were formalised, any non-uuid value
# will trigger a new machine-id to be generated, so "uninitialized" also works.
# Previously this was done here by truncating /etc/machine-id.
if [ -e /etc/machine-id ]; then
echo uninitialized > /etc/machine-id
fi