summary refs log tree commit diff
path: root/nixos/modules/installer/tools/nixos-enter.sh
diff options
context:
space:
mode:
authorNaïm Favier <n@monade.li>2023-01-01 17:18:20 +0100
committerNaïm Favier <n@monade.li>2023-01-01 17:18:20 +0100
commita5b7b6e47a3b4e5cdb12e6367d3136ff60529036 (patch)
tree91329d17d55392c8b49630c2aaceedcce4f3935c /nixos/modules/installer/tools/nixos-enter.sh
parent5a9a3353342fc2a964c58f91ef8cbb19585c3af8 (diff)
downloadnixpkgs-a5b7b6e47a3b4e5cdb12e6367d3136ff60529036.tar
nixpkgs-a5b7b6e47a3b4e5cdb12e6367d3136ff60529036.tar.gz
nixpkgs-a5b7b6e47a3b4e5cdb12e6367d3136ff60529036.tar.bz2
nixpkgs-a5b7b6e47a3b4e5cdb12e6367d3136ff60529036.tar.lz
nixpkgs-a5b7b6e47a3b4e5cdb12e6367d3136ff60529036.tar.xz
nixpkgs-a5b7b6e47a3b4e5cdb12e6367d3136ff60529036.tar.zst
nixpkgs-a5b7b6e47a3b4e5cdb12e6367d3136ff60529036.zip
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`.
Diffstat (limited to 'nixos/modules/installer/tools/nixos-enter.sh')
-rwxr-xr-x[-rw-r--r--]nixos/modules/installer/tools/nixos-enter.sh5
1 files changed, 3 insertions, 2 deletions
diff --git a/nixos/modules/installer/tools/nixos-enter.sh b/nixos/modules/installer/tools/nixos-enter.sh
index 30113ee0050..60a86d89abb 100644..100755
--- 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