summary refs log tree commit diff
path: root/gnu/installer/parted.scm
diff options
context:
space:
mode:
authorMathieu Othacehe <othacehe@gnu.org>2020-08-06 11:24:58 +0200
committerMathieu Othacehe <othacehe@gnu.org>2020-08-06 11:31:38 +0200
commit5697a524a75efae6144fcfaad730115910a34171 (patch)
treec6776a019a2cb91ef60813e680a8cba734243b07 /gnu/installer/parted.scm
parent738c0d96215325419872dea92042c9106bddb03a (diff)
downloadguix-5697a524a75efae6144fcfaad730115910a34171.tar.gz
installer: Remove logical devices.
If a device contains an active logical volume, BLKRRPART will report that the
device is busy. This will cause this device to be filtered by
"non-install-devices" procedure, which is not desired.

Make sure to deactivate all logical volumes before device probing.

Fixes <https://issues.guix.gnu.org/42683>.

* gnu/installer.scm (installer-program): Add lvm2-static to the inputs.
* gnu/installer/parted.scm (remove-logical-devices): New procedure,
(init-parted): call it.
Diffstat (limited to 'gnu/installer/parted.scm')
-rw-r--r--gnu/installer/parted.scm8
1 files changed, 8 insertions, 0 deletions
diff --git a/gnu/installer/parted.scm b/gnu/installer/parted.scm
index 47e0a9e78d..ff5f6afd19 100644
--- a/gnu/installer/parted.scm
+++ b/gnu/installer/parted.scm
@@ -330,6 +330,11 @@ fail. See rereadpt function in wipefs.c of util-linux for an explanation."
   (device-sync device)
   (device-close device))
 
+(define (remove-logical-devices)
+  "Remove all active logical devices."
+  (with-null-output-ports
+   (invoke "dmsetup" "remove_all")))
+
 (define (non-install-devices)
   "Return all the available devices, except the busy one, allegedly the
 install device. DEVICE-IS-BUSY? is a parted call, checking if the device is
@@ -1340,6 +1345,9 @@ USER-PARTITIONS, or return nothing."
 (define (init-parted)
   "Initialize libparted support."
   (probe-all-devices!)
+  ;; Remove all logical devices, otherwise "device-is-busy?" will report true
+  ;; on all devices containaing active logical volumes.
+  (remove-logical-devices)
   (exception-set-handler (lambda (exception)
                            EXCEPTION-OPTION-UNHANDLED)))