unofficial mirror of guix-patches@gnu.org 
 help / color / mirror / code / Atom feed
From: "Ludovic Courtès" <ludo@gnu.org>
To: Mathieu Othacehe <othacehe@gnu.org>
Cc: 44169@debbugs.gnu.org
Subject: [bug#44169] [PATCH 3/3] installer: Use UUIDs in the 'swap-devices' field.
Date: Mon, 26 Oct 2020 11:18:07 +0100	[thread overview]
Message-ID: <871rhle1eo.fsf@gnu.org> (raw)
In-Reply-To: <87imb1i2kf.fsf@gnu.org> (Mathieu Othacehe's message of "Fri, 23 Oct 2020 13:50:24 +0200")

[-- Attachment #1: Type: text/plain, Size: 1239 bytes --]

Hi!

Mathieu Othacehe <othacehe@gnu.org> skribis:

>> +              `((swap-devices (list ,@(map (lambda (uuid)
>> +                                             `(uuid ,uuid))
>> +                                           uuids))))))
>
> I fear that this will break the "gui-installed-os" test. The
> "installation-target-os-for-gui-tests" procedure declares "/dev/vda2" as
> swap-device, while the installer will declare it using an UUID.
>
> This mismatch will probably make "shepherd services" test unhappy. We
> could maybe set a swap label during installation and use it in the
> installer tests?

Good point, I had overlooked that.

I came up with the following trick: during installation, once user
partitions are formatted, we set a pre-defined UUID on /dev/vda2, and we
use that label in ‘installation-target-os-for-gui-tests’.

It works, but I think it’s racy: the config file could be generated
before we’ve changed the UUID.

Problem is that since formatting is the last step that occurs before
config file generation, there’s no synchronization point where the
installer could wait for the client (i.e., wait until the client has run
‘swaplabel’.)

Ideas?

Thanks,
Ludo’.


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: Type: text/x-patch, Size: 4207 bytes --]

diff --git a/gnu/installer/newt/partition.scm b/gnu/installer/newt/partition.scm
index ed38287fe8..1854b35656 100644
--- a/gnu/installer/newt/partition.scm
+++ b/gnu/installer/newt/partition.scm
@@ -777,5 +777,9 @@ by pressing the Exit button.~%~%")))
     ;; Make sure the disks are not in use before proceeding to formatting.
     (free-parted non-install-devices)
     (format-user-partitions user-partitions-with-pass)
+    (syslog "user partitions formatted~%")
+
+    ;; Let clients know that the partitions are ready.
+    (send-to-clients '(partitions-formatted))
     (destroy-form-and-pop form)
     user-partitions))
diff --git a/gnu/installer/tests.scm b/gnu/installer/tests.scm
index 58bf0a2700..5962391e61 100644
--- a/gnu/installer/tests.scm
+++ b/gnu/installer/tests.scm
@@ -286,8 +286,8 @@ instrumented for further testing."
                                edit-configuration-file))
   "Converse over PORT to choose the partitioning method.  When ENCRYPTED? is
 true, choose full-disk encryption with PASSPHRASE as the LUKS passphrase.
-This conversation goes past the final dialog box that shows the configuration
-file, actually starting the installation process."
+This conversation stops when the user partitions have been formatted, right
+before the final dialog box that shows the configuration file."
   (converse port
     ((list-selection (title "Partitioning method")
                      (multiple-choices? #f)
@@ -330,15 +330,19 @@ file, actually starting the installation process."
      #t)
     ((info (title "Preparing partitions") _ ...)
      (values))                                    ;nothing to return
+    ((partitions-formatted)
+     (values))))
+
+(define (conclude-installation port)
+  "Conclude the installation by checking over PORT that we get the generated
+configuration file, accepting it and starting the installation, and then
+receiving the final messages once the 'guix system init' process has
+completed."
+  (converse port
     ((file-dialog (title "Configuration file")
                   (text _)
                   (file ,configuration-file))
-     (edit-configuration-file configuration-file))))
-
-(define (conclude-installation port)
-  "Conclude the installation by checking over PORT that we get the final
-messages once the 'guix system init' process has completed."
-  (converse port
+     (edit-configuration-file configuration-file))
     ((pause)                                      ;"Press Enter to continue."
      #t)
     ((installation-complete)                      ;congratulations!
diff --git a/gnu/tests/install.scm b/gnu/tests/install.scm
index 86bd93966b..0dc5f6ad94 100644
--- a/gnu/tests/install.scm
+++ b/gnu/tests/install.scm
@@ -1211,6 +1211,14 @@ build (current-guix) and then store a couple of full system images.")
                         #$marionette)
       (screenshot "installer-run.ppm")
 
+      (unless #$encrypted?
+        ;; Choose a fixed UUID for the swap partition that matches what
+        ;; 'installation-target-os-for-gui-tests' expects.
+        (marionette-eval* '(invoke #$(file-append util-linux "/sbin/swaplabel")
+                                   "-U" "11111111-2222-3333-4444-123456789abc"
+                                   "/dev/vda2")
+                          #$marionette))
+
       (marionette-eval* '(conclude-installation installer-socket)
                         #$marionette)
 
@@ -1257,8 +1265,12 @@ build (current-guix) and then store a couple of full system images.")
                            '("wheel" "audio" "video"))))
                    %base-user-accounts))
     ;; The installer does not create a swap device in guided mode with
-    ;; encryption support.
-    (swap-devices (if encrypted? '() '("/dev/vda2")))
+    ;; encryption support.  The installer produces a UUID for the partition;
+    ;; this "UUID" is explicitly set in 'gui-test-program' to the value shown
+    ;; below.
+    (swap-devices (if encrypted?
+                      '()
+                      (list (uuid "11111111-2222-3333-4444-123456789abc"))))
     (services (cons (service dhcp-client-service-type)
                     (operating-system-user-services %minimal-os-on-vda)))))
 

  reply	other threads:[~2020-10-26 10:50 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-10-23  9:58 [bug#44169] [PATCH 0/3] Referring to swap with UUIDs and labels Ludovic Courtès
2020-10-23 10:07 ` [bug#44169] [PATCH 1/3] file-systems: Allow swap space lookup by UUID/label Ludovic Courtès
2020-10-23 10:07   ` [bug#44169] [PATCH 2/3] services: swap: Allow for UUIDs and file system labels Ludovic Courtès
2020-10-23 10:07   ` [bug#44169] [PATCH 3/3] installer: Use UUIDs in the 'swap-devices' field Ludovic Courtès
2020-10-23 11:50     ` Mathieu Othacehe
2020-10-26 10:18       ` Ludovic Courtès [this message]
2020-10-26 12:06         ` Mathieu Othacehe
2020-10-28 13:58           ` Ludovic Courtès
2020-10-30  0:17             ` bug#44169: " Ludovic Courtès
2020-11-01 18:18               ` [bug#44169] " Mathieu Othacehe
2020-10-23 11:43   ` [bug#44169] [PATCH 1/3] file-systems: Allow swap space lookup by UUID/label Mathieu Othacehe
2020-10-23 16:31     ` Ludovic Courtès
2020-10-23 17:02       ` Mathieu Othacehe
2020-10-24 15:07         ` Ludovic Courtès
2020-10-26 11:56           ` Mathieu Othacehe
2020-10-28 13:54             ` [bug#44169] [PATCH v2 " Ludovic Courtès
2020-10-28 13:54               ` [bug#44169] [PATCH v2 2/3] services: swap: Allow for UUIDs and file system labels Ludovic Courtès
2020-10-28 13:54               ` [bug#44169] [PATCH v2 3/3] installer: Use UUIDs in the 'swap-devices' field Ludovic Courtès

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://guix.gnu.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=871rhle1eo.fsf@gnu.org \
    --to=ludo@gnu.org \
    --cc=44169@debbugs.gnu.org \
    --cc=othacehe@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).