Skip to content

Commit 5d470b8

Browse files
committed
nixos-install: clear executable cache after entering chroot
Clear the cache for executable locations after entering the chroot. The cached locations are no longer valid there. This resolves problems with nixos-install failing to find binaries from coreutils as witnessed in #241356.
1 parent 7353dfc commit 5d470b8

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

pkgs/by-name/ni/nixos-install/nixos-install.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -246,6 +246,8 @@ if [[ -z $noBootLoader ]]; then
246246
export mountPoint
247247
NIXOS_INSTALL_BOOTLOADER=1 nixos-enter --root "$mountPoint" -c "$(cat <<'EOF'
248248
set -e
249+
# Clear the cache for executable locations. They were invalidated by the chroot.
250+
hash -r
249251
# Create a bind mount for each of the mount points inside the target file
250252
# system. This preserves the validity of their absolute paths after changing
251253
# the root with `nixos-enter`.

0 commit comments

Comments
 (0)