From d61cc625fa0a536ca4b6ac8bfd9ddc178078b2ac Mon Sep 17 00:00:00 2001 From: Andrey Krainyak Date: Wed, 2 Aug 2023 16:37:22 +0800 Subject: [PATCH] nixos-install: fix removal of non-empty `/mnt` After building the target system, `nixos-install` tries to remove `/mnt` on the target filesystem. And the script may fail without any explanation, if `/mnt` isn't empty. This commit makes the installation process carry on even if there are files under `/mnt`. See https://github.com/NixOS/nixpkgs/issues/244643. --- nixos/modules/installer/tools/nixos-install.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nixos/modules/installer/tools/nixos-install.sh b/nixos/modules/installer/tools/nixos-install.sh index 20fec525e70b..4e42875c0365 100755 --- a/nixos/modules/installer/tools/nixos-install.sh +++ b/nixos/modules/installer/tools/nixos-install.sh @@ -206,7 +206,7 @@ if [[ -z $noBootLoader ]]; then mount --rbind --mkdir / "$mountPoint" mount --make-rslave "$mountPoint" /run/current-system/bin/switch-to-configuration boot - umount -R "$mountPoint" && rmdir "$mountPoint" + umount -R "$mountPoint" && (rmdir "$mountPoint" 2>/dev/null || true) EOF )" fi