Subject: bug#60010: [version 1.4.0] AMD screen stays black; modprobe fails

From: "pelzflorian (Florian Pelz)" <[email-masked]>
Date: Tue, 13 Dec 2022 14:51:12 +0100

"pelzflorian (Florian Pelz)" <[email-masked]> writes:
> I will next try using 'load-linux-modules-from-directory' and no
> modprobe.

I tried the attached patch.  Doesn’t work, still black (in QEMU).

Says the dmesg:
> [   11.183789] shepherd[1]: Service user-homes has been started.
> [   11.184555] shepherd[1]: Service user-processes has been started.
> [   11.185587] shepherd[1]: Service host-name has been started.
> [   11.186350] shepherd[1]: Service user-homes has been started.
> [   11.187383] shepherd[1]: Failed to start maybe-uvesafb in the background.
> [   15.213524] 8021q: 802.1Q VLAN Support v1.8
> [   15.213541] 8021q: adding VLAN 0 to HW filter on device eth0

And nothing more.

Maybe there is a mistake in my patch.

Regards,
Florian

diff --git a/gnu/system/install.scm b/gnu/system/install.scm
index f6f1923121..8456cc1570 100644
--- a/gnu/system/install.scm
+++ b/gnu/system/install.scm
@@ -37,6 +37,7 @@ (define-module (gnu system install)
   #:use-module ((guix store) #:select (%store-prefix))
   #:use-module (guix utils)
   #:use-module (gnu installer)
+  #:use-module (gnu build linux-modules)
   #:use-module (gnu system locale)
   #:use-module (gnu services avahi)
   #:use-module (gnu services dbus)
@@ -289,14 +290,20 @@ (define (uvesafb-shepherd-service _)
          (provision '(maybe-uvesafb))
          (requirement '(file-systems))
          (start #~(lambda ()
-                    (or (file-exists? "/dev/fb0")
-                        (invoke #+(file-append kmod "/bin/modprobe")
-                                "uvesafb"
-                                (string-append "v86d=" #$v86d "/sbin/v86d")
-                                "mode_option=1024x768"))))
+                    (unless (file-exists? "/dev/fb0")
+                      (load-linux-modules-from-directory '("uvesafb") "\
+/run/booted-system/kernel/lib/modules"))))
          (respawn? #f)
          (one-shot? #t))))
 
+(define uvesafb-config
+  (computed-file "uvesafb.conf"
+                 #~(with-output-to-file #$output
+                     (lambda ()
+                       (display
+                        (string-append "options v86d=" #$v86d "/sbin/v86d"
+                                       " " "mode_option=1024x768"))))))
+
 (define uvesafb-service-type
   (service-type
    (name 'uvesafb)
@@ -450,7 +457,10 @@ (define bare-bones-os
      ;; installer.  Some may also need a kernel parameter like nomodeset
      ;; or vga=793, but we leave that for the user to specify in GRUB.
      `(,@(if (supported-package? v86d system)
-             (list (service uvesafb-service-type))
+             (list (simple-service 'uvesafb-config etc-service-type
+                                             (list `("modprobe.d/uvesafb.conf"
+                                                     ,uvesafb-config)))
+                   (service uvesafb-service-type))
              '())))))
 
 (define %issue