Subject: bug#27735: Unbootable images with GuixSD on... "GuixSD"

From: [email-masked] (Ludovic Courtès)
Date: Tue, 18 Jul 2017 20:59:33 +0200

Heya,

Tobias Geerinckx-Rice <[email-masked]> skribis:

> On 18/07/17 13:49, Ludovic Courtès wrote:
>> What about generating a UUID in a deterministic yet somewhat unique
>> fashion along these lines (untested):
>
> Not great, but I can't think of a better way. :-)

Yup.

>> +  (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)))
>> +
>
> Why not throw SIZE into this mix as well?

Because it can be the symbol 'guess or a number, so that makes things
needlessly complicated IMO.

> When building without ‘--image-size’ (the default nowadays), it's a
> function of the exact size of the entire graph and reasonably sensitive
> to most kinds of input changes.

The actual size is not known until the derivation is built; we don’t
have access to that information here.

>> We cannot use the store file name’s hash, unfortunately, because the
>> UUID has to be given on the “host side.”
>
> That is unfortunate, but a best-effort heuristic will do.

Yeah, still better than a hard-coded label I guess.

Ludo’.