From a5b7b6e47a3b4e5cdb12e6367d3136ff60529036 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Na=C3=AFm=20Favier?= Date: Sun, 1 Jan 2023 17:18:20 +0100 Subject: [PATCH] nixos/nixos-enter: hide systemd-tmpfiles errors Due to missing `/etc/machine-id` in the new root, systemd-tmpfiles outputs a bunch of scary warnings like "Failed to replace specifiers in '/run/log/journal/%m'". We only care about /tmp, so hide them. `-E` is an alias for `--exclude-prefix=/dev --exclude-prefix=/proc --exclude-prefix=/run --exclude-prefix=/sys`. --- nixos/modules/installer/tools/nixos-enter.sh | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) mode change 100644 => 100755 nixos/modules/installer/tools/nixos-enter.sh diff --git a/nixos/modules/installer/tools/nixos-enter.sh b/nixos/modules/installer/tools/nixos-enter.sh old mode 100644 new mode 100755 index 30113ee00508..60a86d89abb4 --- a/nixos/modules/installer/tools/nixos-enter.sh +++ b/nixos/modules/installer/tools/nixos-enter.sh @@ -100,8 +100,9 @@ chroot_add_resolv_conf "$mountPoint" || echo "$0: failed to set up resolv.conf" # Run the activation script. Set $LOCALE_ARCHIVE to supress some Perl locale warnings. LOCALE_ARCHIVE="$system/sw/lib/locale/locale-archive" IN_NIXOS_ENTER=1 chroot "$mountPoint" "$system/activate" 1>&2 || true - # Create /tmp - chroot "$mountPoint" "$system/sw/bin/systemd-tmpfiles" --create --remove --exclude-prefix=/dev 1>&2 || true + # Create /tmp. This is needed for nix-build and the NixOS activation script to work. + # Hide the unhelpful "failed to replace specifiers" errors caused by missing /etc/machine-id. + chroot "$mountPoint" "$system/sw/bin/systemd-tmpfiles" --create --remove -E 2> /dev/null || true ) unset TMPDIR