diff mbox series

[bug#47979,v7,2/3] installer: Recommend 'ntp-service-type' for non-graphical systems.

Message ID f289429b3b62b6bc8de6e61a4f8f175b44a4b507.1640643713.git.leo@famulari.name
State Accepted
Headers show
Series [bug#47979,v7,1/3] installer: Offer the CUPS printing service on a dedicated page. | expand

Checks

Context Check Description
cbaines/applying patch fail View Laminar job
cbaines/issue success View issue
cbaines/applying patch fail View Laminar job
cbaines/issue success View issue
cbaines/applying patch fail View Laminar job
cbaines/issue success View issue
cbaines/applying patch fail View Laminar job
cbaines/issue success View issue
cbaines/applying patch fail View Laminar job
cbaines/issue success View issue

Commit Message

Leo Famulari Dec. 27, 2021, 10:24 p.m. UTC
The system test "gui-installed-os" passes with this commit, but
"gui-installed-desktop-os-encrypted" fails like this:

------
[...]
conversation expecting pattern ((quote checkbox-list) ((quote title) "Network service") ((quote text) _) ((quote items) services))
Dec 27 23:03:44 localhost installer[194]: form #<newt-form 176e9c0> ("Network service"): client 19 replied () 
Dec 27 23:03:44 localhost installer[194]: running form #<newt-form 171ae70> ("Network management") with 1 clients 
conversation expecting pattern ((quote list-selection) ((quote title) "Network management") ((quote multiple-choices?) #f) ((quote items) services))
Dec 27 23:03:44 localhost installer[194]: form #<newt-form 171ae70> ("Network management"): client 19 replied "DHCP client (dynamic IP address assignment)" 
Dec 27 23:03:44 localhost installer[194]: running form #<newt-form 176fcb0> ("Console services") with 1 clients 
conversation expecting pattern ((quote checkbox-list) ((quote title) "Console services") ((quote text) _) ((quote items) services) ((quote null?) (quote desktop-environments)))
/gnu/store/bvbv7a5nfzqwq5d7z33kqr8yzx1q5x70-shepherd-marionette.scm:1:1718: ERROR:
  1. &pattern-not-matched:
      pattern: ((quote checkbox-list) ((quote title) "Console services") ((quote text) _) ((quote items) services) ((quote null?) (quote desktop-environments)))
      sexp: (checkbox-list (title "Console services") (text "Select miscellaneous services to run on your non-graphical system.") (items ("Network time service (NTP), to set the clock automat)
Backtrace:
           2 (primitive-load "/gnu/store/ipxa2igymg4j2b84ivka5qcp5bs?")
In ice-9/eval.scm:
   191:35  1 (_ #f)
    619:8  0 (_ #(#<directory (guile-user) 7ffff5fdbc80> #<variabl?>))

ice-9/eval.scm:619:8: Throw to key `marionette-eval-failure' with args `((quote (choose-services installer-socket #:choose-desktop-environment? (const #f) #:choose-network-service? (const #f).
note: keeping build directory `/tmp/guix-build-installation.drv-9'
builder for `/gnu/store/792rdywf5nzn6rs4as5v9la5sdbwqrjp-installation.drv' failed with exit code 1
build of /gnu/store/792rdywf5nzn6rs4as5v9la5sdbwqrjp-installation.drv failed
------

It seems that this page is being run even when a desktop is selected,
which does not happen when using the installer directly.

Can somebody help me write the system test correctly, so that it's not
run when a desktop is selected?

We had several bug reports with a root cause of "the clock was
incorrect" from users who used the installer to install a non-graphical
Guix System.

* gnu/installer/services.scm (%system-services): Add the ntp-service-type.
* gnu/installer/newt/services.scm (run-system-administration-cbt-page): New
variable.
(run-services-page): Use run-system-administration-cbt-page when not
installing a desktop.
* gnu/installer/tests.scm (choose-services): Add and use a
choose-misc-service?  procedure.
* gnu/tests/install.scm (installation-target-os-for-gui-tests)<services>: Add
ntp-service-type.
---
 gnu/installer/newt/services.scm | 25 ++++++++++++++++++++++++-
 gnu/installer/services.scm      |  8 ++++++++
 gnu/installer/tests.scm         |  9 +++++++++
 gnu/tests/install.scm           |  5 +++--
 4 files changed, 44 insertions(+), 3 deletions(-)

Comments

Leo Famulari Dec. 27, 2021, 11:53 p.m. UTC | #1
On Mon, Dec 27, 2021 at 05:24:09PM -0500, Leo Famulari wrote:
> The system test "gui-installed-os" passes with this commit, but
> "gui-installed-desktop-os-encrypted" fails like this:
> 
> ------
> [...]
> conversation expecting pattern ((quote checkbox-list) ((quote title) "Network service") ((quote text) _) ((quote items) services))
> Dec 27 23:03:44 localhost installer[194]: form #<newt-form 176e9c0> ("Network service"): client 19 replied () 
> Dec 27 23:03:44 localhost installer[194]: running form #<newt-form 171ae70> ("Network management") with 1 clients 
> conversation expecting pattern ((quote list-selection) ((quote title) "Network management") ((quote multiple-choices?) #f) ((quote items) services))
> Dec 27 23:03:44 localhost installer[194]: form #<newt-form 171ae70> ("Network management"): client 19 replied "DHCP client (dynamic IP address assignment)" 
> Dec 27 23:03:44 localhost installer[194]: running form #<newt-form 176fcb0> ("Console services") with 1 clients 
> conversation expecting pattern ((quote checkbox-list) ((quote title) "Console services") ((quote text) _) ((quote items) services) ((quote null?) (quote desktop-environments)))
> /gnu/store/bvbv7a5nfzqwq5d7z33kqr8yzx1q5x70-shepherd-marionette.scm:1:1718: ERROR:
>   1. &pattern-not-matched:
>       pattern: ((quote checkbox-list) ((quote title) "Console services") ((quote text) _) ((quote items) services) ((quote null?) (quote desktop-environments)))
>       sexp: (checkbox-list (title "Console services") (text "Select miscellaneous services to run on your non-graphical system.") (items ("Network time service (NTP), to set the clock automat)
> Backtrace:
>            2 (primitive-load "/gnu/store/ipxa2igymg4j2b84ivka5qcp5bs?")
> In ice-9/eval.scm:
>    191:35  1 (_ #f)
>     619:8  0 (_ #(#<directory (guile-user) 7ffff5fdbc80> #<variabl?>))
> 
> ice-9/eval.scm:619:8: Throw to key `marionette-eval-failure' with args `((quote (choose-services installer-socket #:choose-desktop-environment? (const #f) #:choose-network-service? (const #f).
> note: keeping build directory `/tmp/guix-build-installation.drv-9'
> builder for `/gnu/store/792rdywf5nzn6rs4as5v9la5sdbwqrjp-installation.drv' failed with exit code 1
> build of /gnu/store/792rdywf5nzn6rs4as5v9la5sdbwqrjp-installation.drv failed
> ------
> 
> It seems that this page is being run even when a desktop is selected,
> which does not happen when using the installer directly.
> 
> Can somebody help me write the system test correctly, so that it's not
> run when a desktop is selected?

Any ideas, Mathieu?
Leo Famulari Dec. 28, 2021, 4:54 a.m. UTC | #2
On Mon, Dec 27, 2021 at 05:24:09PM -0500, Leo Famulari wrote:
>   1. &pattern-not-matched:
>       pattern: ((quote checkbox-list) ((quote title) "Console services") ((quote text) _) ((quote items) services) ((quote null?) (quote desktop-environments)))
>       sexp: (checkbox-list (title "Console services") (text "Select miscellaneous services to run on your non-graphical system.") (items ("Network time service (NTP), to set the clock automat)
[...]
> +    ((checkbox-list (title "Console services") (text _)
> +                     (items ,services)
> +     (null? desktop-environments))
                                    ^
                                    |
There's a typo here that could cause the error mentioned above.

> +     (filter choose-misc-service? services))

Rebuilding...
Mathieu Othacehe Dec. 28, 2021, 8:27 a.m. UTC | #3
Hey Leo,

>> +     (null? desktop-environments))
>                                     ^
>                                     |
> There's a typo here that could cause the error mentioned above.

Right. I have started a wip-harden-installer branch, and configured
Cuirass to run the system tests on it:
https://ci.guix.gnu.org/jobset/wip-harden-installer, to prevent my
laptop from burning.

Don't hesitate to push your commits there :).

Thanks,

Mathieu
Leo Famulari Dec. 28, 2021, 8:34 p.m. UTC | #4
On Tue, Dec 28, 2021 at 09:27:29AM +0100, Mathieu Othacehe wrote:
> >> +     (null? desktop-environments))
> >                                     ^
> >                                     |
> > There's a typo here that could cause the error mentioned above.

I fixed this bug and pushed as 0d9d151424ab5823e441f056237819277b8aa072.

Thanks a lot for your help!

> Right. I have started a wip-harden-installer branch, and configured
> Cuirass to run the system tests on it:
> https://ci.guix.gnu.org/jobset/wip-harden-installer, to prevent my
> laptop from burning.

I found that the Guix test suite itself fails on berlin, even in the
build container as used when building current-guix-package in the system
tests, but maybe it succeeds when run on the build nodes via CI:

https://issues.guix.gnu.org/46413

That's why I spent a long time running the system tests on my own
computer.
diff mbox series

Patch

diff --git a/gnu/installer/newt/services.scm b/gnu/installer/newt/services.scm
index b4b5219b20..c218825813 100644
--- a/gnu/installer/newt/services.scm
+++ b/gnu/installer/newt/services.scm
@@ -3,6 +3,7 @@ 
 ;;; Copyright © 2019, 2020 Ludovic Courtès <ludo@gnu.org>
 ;;; Copyright © 2020 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
 ;;; Copyright © 2021 Tobias Geerinckx-Rice <me@tobias.gr>
+;;; Copyright © 2021 Leo Famulari <leo@famulari.name>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -88,6 +89,27 @@  (define (run-printing-services-cbt-page)
         (condition
          (&installer-step-abort)))))))
 
+(define (run-console-services-cbt-page)
+  "Run a page to select various system adminstration services for non-graphical
+systems."
+  (let ((items (filter (lambda (service)
+                         (eq? 'administration
+                              (system-service-type service)))
+                       %system-services)))
+    (run-checkbox-tree-page
+      #:title (G_ "Console services")
+      #:info-text (G_ "Select miscellaneous services to run on your \
+non-graphical system.")
+      #:items items
+      #:selection (map system-service-recommended? items)
+      #:item->text (compose G_ system-service-name)
+      #:checkbox-tree-height 5
+      #:exit-button-callback-procedure
+      (lambda ()
+        (raise
+          (condition
+            (&installer-step-abort)))))))
+
 (define (run-network-management-page)
   "Run a page to select among several network management methods."
   (let ((title (G_ "Network management")))
@@ -119,6 +141,7 @@  (define (run-services-page)
     (append desktop
             (run-networking-cbt-page)
             (if (null? desktop)
-                (list (run-network-management-page))
+                (cons (run-network-management-page)
+                      (run-console-services-cbt-page))
                 '())
             (run-printing-services-cbt-page))))
diff --git a/gnu/installer/services.scm b/gnu/installer/services.scm
index 341d8b69c8..94c49307f0 100644
--- a/gnu/installer/services.scm
+++ b/gnu/installer/services.scm
@@ -3,6 +3,7 @@ 
 ;;; Copyright © 2019 Ludovic Courtès <ludo@gnu.org>
 ;;; Copyright © 2020 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
 ;;; Copyright © 2021 Tobias Geerinckx-Rice <me@tobias.gr>
+;;; Copyright © 2021 Leo Famulari <leo@famulari.name>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -104,6 +105,13 @@  (define %system-services
       (packages '((specification->package "nss-certs")))
       (recommended? #t))
 
+     ;; Miscellaneous system administration services.
+     (system-service
+       (name (G_ "Network time service (NTP), to set the clock automatically"))
+       (type 'administration)
+       (recommended? #t)
+       (snippet '((service ntp-service-type))))
+
      ;; Network connectivity management.
      (system-service
       (name (G_ "NetworkManager network connection manager"))
diff --git a/gnu/installer/tests.scm b/gnu/installer/tests.scm
index 5d931149b8..4175feaed9 100644
--- a/gnu/installer/tests.scm
+++ b/gnu/installer/tests.scm
@@ -221,7 +221,11 @@  (define* (choose-services port
                           (choose-network-management-tool?
                            (lambda (service)
                              (string-contains service "DHCP")))
+                          (choose-misc-service?
+                           (lambda (service)
+                             (string-contains service "NTP")))
                           (choose-other-service? (const #f)))
+
   "Converse over PORT to choose services."
   (define desktop-environments '())
 
@@ -243,6 +247,11 @@  (define desktop-environments '())
      (null? desktop-environments)
      (find choose-network-management-tool? services))
 
+    ((checkbox-list (title "Console services") (text _)
+                     (items ,services)
+     (null? desktop-environments))
+     (filter choose-misc-service? services))
+
     ((checkbox-list (title "Printing and document services") (text _)
                     (items ,services))
      (filter choose-other-service? services))))
diff --git a/gnu/tests/install.scm b/gnu/tests/install.scm
index 154f98b2e1..ae8c6051f1 100644
--- a/gnu/tests/install.scm
+++ b/gnu/tests/install.scm
@@ -1685,8 +1685,9 @@  (define* (installation-target-os-for-gui-tests
          (list
           (swap-space
            (target (uuid "11111111-2222-3333-4444-123456789abc"))))))
-    (services (cons (service dhcp-client-service-type)
-                    (operating-system-user-services %minimal-os-on-vda)))))
+    (services (cons* (service dhcp-client-service-type)
+                     (service ntp-service-type)
+                     (operating-system-user-services %minimal-os-on-vda)))))
 
 (define* (installation-target-desktop-os-for-gui-tests
           #:key (encrypted? #f))