linux-initrd: Skip initrd module check when 'modules.alias' can't be found.

Fixes <https://bugs.gnu.org/30760>.
Reported by Tomáš Čech <sleep_walker@gnu.org>.

* gnu/system/linux-initrd.scm (check-device-initrd-modules): Call
'known-module-aliases' and catch 'system-error around it.  Pass it to
'matching-modules'.
This commit is contained in:
Ludovic Courtès 2018-03-10 00:15:59 +01:00
parent 464f544739
commit 8d5c14edf5
No known key found for this signature in database
GPG Key ID: 090B11993D9AEBB5
1 changed files with 23 additions and 13 deletions

View File

@ -353,17 +353,27 @@ loaded at boot time in the order in which they appear."
(define (check-device-initrd-modules device linux-modules location) (define (check-device-initrd-modules device linux-modules location)
"Raise an error if DEVICE needs modules beyond LINUX-MODULES to operate. "Raise an error if DEVICE needs modules beyond LINUX-MODULES to operate.
DEVICE must be a \"/dev\" file name." DEVICE must be a \"/dev\" file name."
(let ((modules (delete-duplicates (define aliases
(append-map matching-modules ;; Attempt to load 'modules.alias' from the current kernel, assuming we're
(device-module-aliases device))))) ;; on GuixSD, and assuming that corresponds to the kernel we'll be
(unless (every (cute member <> linux-modules) modules) ;; installing. Skip the whole thing if that file cannot be read.
(raise (condition (catch 'system-error
(&message (lambda ()
(message (format #f (G_ "you may need these modules \ (known-module-aliases))
(const #f)))
(when aliases
(let ((modules (delete-duplicates
(append-map (cut matching-modules <> aliases)
(device-module-aliases device)))))
(unless (every (cute member <> linux-modules) modules)
(raise (condition
(&message
(message (format #f (G_ "you may need these modules \
in the initrd for ~a:~{ ~a~}") in the initrd for ~a:~{ ~a~}")
device modules))) device modules)))
(&fix-hint (&fix-hint
(hint (format #f (G_ "Try adding them to the (hint (format #f (G_ "Try adding them to the
@code{initrd-modules} field of your @code{operating-system} declaration, along @code{initrd-modules} field of your @code{operating-system} declaration, along
these lines: these lines:
@ -373,8 +383,8 @@ these lines:
(initrd-modules (append (list~{ ~s~}) (initrd-modules (append (list~{ ~s~})
%base-initrd-modules))) %base-initrd-modules)))
@end example\n") @end example\n")
modules))) modules)))
(&error-location (&error-location
(location (source-properties->location location)))))))) (location (source-properties->location location)))))))))
;;; linux-initrd.scm ends here ;;; linux-initrd.scm ends here