mirror of
https://git.in.rschanz.org/ryan77627/guix.git
synced 2024-11-07 07:26:13 -05:00
installer: parted: Retry failing read-partition-uuid call.
Fixes: <https://issues.guix.gnu.org/53541>. * gnu/installer/parted.scm (read-partition-uuid/retry): New procedure. (check-user-partitions): Use it.
This commit is contained in:
parent
5197b07e0e
commit
ab974ed709
1 changed files with 20 additions and 1 deletions
|
@ -319,6 +319,25 @@ (define (find-user-partition-by-parted-object user-partitions
|
|||
partition))
|
||||
user-partitions))
|
||||
|
||||
(define (read-partition-uuid/retry file-name)
|
||||
"Call READ-PARTITION-UUID with 5 retries spaced by 1 second. This is useful
|
||||
if the partition table is updated by the kernel at the time this function is
|
||||
called, causing the underlying /dev to be absent."
|
||||
(define max-retries 5)
|
||||
|
||||
(let loop ((retry max-retries))
|
||||
(catch #t
|
||||
(lambda ()
|
||||
(read-partition-uuid file-name))
|
||||
(lambda _
|
||||
(if (> retry 0)
|
||||
(begin
|
||||
(sleep 1)
|
||||
(loop (- retry 1)))
|
||||
(error
|
||||
(format #f (G_ "Could not open ~a after ~a retries~%.")
|
||||
file-name max-retries)))))))
|
||||
|
||||
|
||||
;;
|
||||
;; Devices
|
||||
|
@ -1108,7 +1127,7 @@ (define (check-uuid)
|
|||
(need-formatting?
|
||||
(user-partition-need-formatting? user-partition)))
|
||||
(or need-formatting?
|
||||
(read-partition-uuid file-name)
|
||||
(read-partition-uuid/retry file-name)
|
||||
(raise
|
||||
(condition
|
||||
(&cannot-read-uuid
|
||||
|
|
Loading…
Reference in a new issue