Subject: bug#40682: frozen installer in WiFi section -guix 1.1.0

From: Ludovic Courtès <[email-masked]>
Date: Sun, 19 Apr 2020 01:30:47 +0200

Hi,

SergioBG BG <[email-masked]> skribis:

> Here the screenshot of Frozen.

Thanks.  Looking at the screenshot, it would seem that the installer is
stuck somewhere in ‘connman-connect-with-auth’, but it’s hard to tell
why/where.

I was able to reproduce it in ‘guix system vm’ with the patch below.

Cc: Mathieu in case they have an idea…

To be continued…

Thanks,
Ludo’.

PS: Nyacc contains libdbus bindings as an example of its FFI tooling,
    perhaps we should give it a try and use it here.  It could be more
    robust than piping through ‘connmanctl’.

diff --git a/gnu/system/install.scm b/gnu/system/install.scm
index 0965c4d237..826f6d356d 100644
--- a/gnu/system/install.scm
+++ b/gnu/system/install.scm
@@ -322,6 +322,52 @@ the user's target storage device rather than on the RAM disk."
     "Load the @code{uvesafb} kernel module with the right options.")
    (default-value #t)))
 
+(define (simulated-wifi-shepherd-services hostapd)
+  (define config
+    (plain-file "hostapd.conf" "\
+interface=wlan1
+ssid=Test Net
+channel=1\n"))
+
+  (list (shepherd-service
+         (provision '(hostapd))
+         (requirement '(mac-sim-module unblocked-wifi))
+         (start #~(make-forkexec-constructor
+                   (list #$(file-append hostapd "/sbin/hostapd")
+                         #$config)
+                   #:log-file "/var/log/hostapd.log"))
+         (stop #~(make-kill-destructor)))
+        (shepherd-service
+         (provision '(unblocked-wifi))
+         (requirement '(mac-sim-module))
+         (start #~(lambda _
+                    (invoke #$(file-append util-linux "/sbin/rfkill")
+                            "unblock" "0")
+                    (invoke #$(file-append util-linux "/sbin/rfkill")
+                            "unblock" "1")))
+         (one-shot? #t))
+        (shepherd-service
+         (provision '(mac-sim-module))
+         (requirement '(term-tty3))
+         (modules '((guix build utils)))
+         (start #~(lambda _
+                    ;; XXX: We can't use 'load-linux-module*' here because it
+                    ;; expects a flat module directory.
+                    (setenv "LINUX_MODULE_DIRECTORY"
+                            "/run/booted-system/kernel/lib/modules")
+                    (invoke #$(file-append kmod "/bin/modprobe")
+                            "mac80211_hwsim")))
+         (one-shot? #t))))
+
+(define simulated-wifi-service-type
+  (service-type
+   (name 'simulated-wifi)
+   (extensions
+    (list (service-extension shepherd-root-service-type
+                             simulated-wifi-shepherd-services)))
+   (default-value hostapd)
+   (description "Run hostapd to simulate WiFi connectivity.")))
+
 (define %installation-services
   ;; List of services of the installation system.
   (let ((motd (plain-file "motd" "
@@ -366,6 +412,8 @@ Access documentation at any time by pressing Alt-F2.\x1b[0m
           ;; The usual services.
           (syslog-service)
 
+          (service simulated-wifi-service-type)
+
           ;; The build daemon.  Register the default substitute server key(s)
           ;; as trusted to allow the installation process to use substitutes by
           ;; default.