From 649fce02e9ffcee82b3afb564d66ef98fa824d72 Mon Sep 17 00:00:00 2001
From: Jens Nolte <git@queezle.net>
Date: Sat, 14 Aug 2021 23:54:23 +0200
Subject: [PATCH] Use partprobe instead of sleep when waiting for a new
 partition table

---
 bin/lib/installation.nix | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/bin/lib/installation.nix b/bin/lib/installation.nix
index 99f6bda..54e16a7 100644
--- a/bin/lib/installation.nix
+++ b/bin/lib/installation.nix
@@ -26,6 +26,7 @@ let
   btrfs-bin = "${btrfsProgs}/bin/btrfs";
   fzf-bin = "${fzf}/bin/fzf";
   jq-bin = "${jq}/bin/jq";
+  partprobe-bin = "${busybox}/bin/partprobe";
 
   swap = (if template ? swap then template.swap else "8G");
   luks = template.luks;
@@ -179,8 +180,8 @@ assert (typeOf swap) == "string";
       ''}
     '' else abort "Invalid bootloader configured in template: ${template.bootloader}" }
 
-    # Partitons take a while to settle, waiting makes sure the old partitions have disappeared and new partitions are available
-    sleep 1s
+    # Ensure partition table changes have been registered by the kernel
+    ${partprobe-bin} $block_device
 
     print_info "Creating partitions"
 
-- 
GitLab