From mboxrd@z Thu Jan 1 00:00:00 1970 From: ludo@gnu.org (Ludovic =?UTF-8?Q?Court=C3=A8s?=) Subject: bug#27735: Unbootable images with GuixSD on... "GuixSD" Date: Tue, 18 Jul 2017 13:49:01 +0200 Message-ID: <87bmoi0xua.fsf@gnu.org> References: <327af9f3-fdfb-7916-f0ea-9aec0fae20f3@tobias.gr> <20170717191731.2d3ad604@scratchpost.org> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:43215) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dXR0v-00013M-7A for bug-guix@gnu.org; Tue, 18 Jul 2017 07:50:06 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dXR0s-0000Sw-52 for bug-guix@gnu.org; Tue, 18 Jul 2017 07:50:05 -0400 Received: from debbugs.gnu.org ([208.118.235.43]:42734) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1dXR0s-0000So-1b for bug-guix@gnu.org; Tue, 18 Jul 2017 07:50:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1dXR0r-00088O-Qr for bug-guix@gnu.org; Tue, 18 Jul 2017 07:50:01 -0400 Sender: "Debbugs-submit" Resent-Message-ID: In-Reply-To: <20170717191731.2d3ad604@scratchpost.org> (Danny Milosavljevic's message of "Mon, 17 Jul 2017 19:17:31 +0200") List-Id: Bug reports for GNU Guix List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-guix-bounces+gcggb-bug-guix=m.gmane.org@gnu.org Sender: "bug-Guix" To: Danny Milosavljevic Cc: 27735@debbugs.gnu.org --=-=-= Content-Type: text/plain Hello, Danny Milosavljevic skribis: >> The real problem here is that we're using a label as a UUID. > > I agree. Unfortunately Guix UUIDs are difficult to use consistently or I would have changed it over to begin with. What about generating a UUID in a deterministic yet somewhat unique fashion along these lines (untested): --=-=-= Content-Type: text/x-patch Content-Disposition: inline diff --git a/gnu/system/vm.scm b/gnu/system/vm.scm index ec3fb031a..6b53eacbf 100644 --- a/gnu/system/vm.scm +++ b/gnu/system/vm.scm @@ -56,9 +56,12 @@ #:use-module (gnu system file-systems) #:use-module (gnu system) #:use-module (gnu services) + #:use-module ((gnu build file-systems) + #:select (string->iso9660-uuid)) #:use-module (srfi srfi-1) #:use-module (srfi srfi-26) + #:use-module (rnrs bytevectors) #:use-module (ice-9 match) #:export (expression->derivation-in-linux-vm @@ -344,12 +347,29 @@ to USB sticks meant to be read-only." (if (string=? "iso9660" file-system-type) string-upcase identity)) + (define root-label - ;; Volume name of the root file system. Since we don't know which device - ;; will hold it, we use the volume name to find it (using the UUID would - ;; be even better, but somewhat less convenient.) + ;; Volume name of the root file system. (normalize-label "GuixSD_image")) + (define root-uuid + ;; UUID of the root file system, computed in a deterministic fashion. + (if (string=? "iso9660" file-system-type) + (let ((pad (compose (cut string-pad <> 2 #\0) + number->string))) + (string->iso9660-uuid + (string-append "1970-01-01-" + (pad (hash name 24)) + (pad (hash file-system-type 60)) + (pad (hash (operating-system-host-name os) 60))))) + (uint-list->bytevector + (list (hash (string-append file-system-type name) + (expt 2 64)) + (hash (operating-system-host-name os) + (expt 2 64))) + (endianness little) + 8))) + (define file-systems-to-keep (remove (lambda (fs) (string=? (file-system-mount-point fs) "/")) @@ -367,8 +387,8 @@ to USB sticks meant to be read-only." ;; Force our own root file system. (file-systems (cons (file-system (mount-point "/") - (device root-label) - (title 'label) + (device root-uuid) + (title 'uuid) (type file-system-type)) file-systems-to-keep))))) @@ -376,8 +396,7 @@ to USB sticks meant to be read-only." (bootcfg (operating-system-bootcfg os))) (if (string=? "iso9660" file-system-type) (iso9660-image #:name name - #:file-system-label root-label - #:file-system-uuid #f + #:file-system-uuid root-uuid #:os-drv os-drv #:bootcfg-drv bootcfg #:bootloader (bootloader-configuration-bootloader @@ -395,7 +414,7 @@ to USB sticks meant to be read-only." file-system-type) "ext4" file-system-type) - #:file-system-label root-label + #:file-system-label root-label ;FIXME: use ROOT-UUID #:copy-inputs? #t #:register-closures? #t #:inputs `(("system" ,os-drv) --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable We cannot use the store file name=E2=80=99s hash, unfortunately, because the UUID has to be given on the =E2=80=9Chost side.=E2=80=9D Thoughts? Ludo=E2=80=99. --=-=-=--