1
0
Fork 1
mirror of https://github.com/NixOS/nixpkgs.git synced 2024-11-18 11:40:45 +00:00

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`.
This commit is contained in:
Naïm Favier 2023-01-01 17:18:20 +01:00
parent 5a9a335334
commit a5b7b6e47a
No known key found for this signature in database
GPG key ID: 95AFCE8211908325

5
nixos/modules/installer/tools/nixos-enter.sh Normal file → Executable file
View file

@ -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