Subject: Re: bug#33639: ISO installer image is broken on i686

From: Ludovic Courtès <[email-masked]>
Date: Mon, 08 Apr 2019 10:50:29 +0200

Hello,

"Thomas Schmitt" <[email-masked]> skribis:

> The fact that the VM always sees the expected size but the host sees varying
> sizes supports the suspicion that at the end of the VM its i/o buffers or
> virtual disk are not always properly flushed to the i/o system of the host.
> The varying success smells like a race condition.

Indeed, that rings a bell: I fixed a similar issue in commit
0dc7d298a33f83d5f02a962b5f1bd24ee0e8ef07.

Florian: could you check whether the patch below solves the problem for
you?

Thanks,
Ludo’.

diff --git a/gnu/system/vm.scm b/gnu/system/vm.scm
index db9b1707d7..3ee03c84a0 100644
--- a/gnu/system/vm.scm
+++ b/gnu/system/vm.scm
@@ -240,7 +240,11 @@ made available under the /xchg CIFS share."
                                   #:target-arm32? #$(target-arm32?)
                                   #:disk-image-format #$disk-image-format
                                   #:disk-image-size size
-                                  #:references-graphs graphs))))))
+                                  #:references-graphs graphs)
+
+                ;; Make sure I/O buffers get flushed.  This is particularly
+                ;; important when MAKE-DISK-IMAGE? is true.
+                (sync))))))
 
     (gexp->derivation name builder
                       ;; TODO: Require the "kvm" feature.
@@ -530,10 +534,7 @@ should set REGISTER-CLOSURES? to #f."
                  #$os
                  #:compressor '(#+(file-append gzip "/bin/gzip") "-9n")
                  #:creation-time (make-time time-utc 0 1)
-                 #:transformations `((,root-directory -> "")))
-
-                ;; Make sure the tarball is fully written before rebooting.
-                (sync))))))
+                 #:transformations `((,root-directory -> ""))))))))
     (expression->derivation-in-linux-vm
      name build
      #:make-disk-image? #f