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.
This commit is contained in:
Mathieu Othacehe 2020-08-06 11:24:58 +02:00
parent 738c0d9621
commit 5697a524a7
No known key found for this signature in database
GPG Key ID: 8354763531769CA6
2 changed files with 9 additions and 0 deletions

@ -318,6 +318,7 @@ selected keymap."
cryptsetup
dosfstools ;mkfs.fat
e2fsprogs ;mkfs.ext4
lvm2-static ;dmsetup
btrfs-progs
jfsutils ;jfs_mkfs
ntfs-3g ;mkfs.ntfs

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