nixos/containers: Create an empty machine-id file

Since systemd version 230, it is required to have a machine-id file
prior to the startup of the container. If the file is empty, a transient
machine ID is generated by systemd-nspawn.

See systemd/systemd#3014 for more details on the matter.

This unbreaks all of the containers-* NixOS tests.

Signed-off-by: aszlig <aszlig@redmoonstudios.org>
Cc: @edolstra
Closes: #15808
This commit is contained in:
aszlig 2016-05-29 17:58:55 +02:00
parent 8d1fec55f6
commit dc38003af9
No known key found for this signature in database
GPG Key ID: D0EBD0EC8C2DC961

View File

@ -309,6 +309,10 @@ in
touch "$root/etc/os-release"
fi
if ! [ -e "$root/etc/machine-id" ]; then
touch "$root/etc/machine-id"
fi
mkdir -p -m 0755 \
"/nix/var/nix/profiles/per-container/$INSTANCE" \
"/nix/var/nix/gcroots/per-container/$INSTANCE"