From: ludo@gnu.org (Ludovic Courtès)
To: Danny Milosavljevic <dannym@scratchpost.org>
Cc: 27735@debbugs.gnu.org
Subject: bug#27735: Unbootable images with GuixSD on... "GuixSD"
Date: Tue, 18 Jul 2017 13:49:01 +0200 [thread overview]
Message-ID: <87bmoi0xua.fsf@gnu.org> (raw)
In-Reply-To: <20170717191731.2d3ad604@scratchpost.org> (Danny Milosavljevic's message of "Mon, 17 Jul 2017 19:17:31 +0200")
[-- Attachment #1: Type: text/plain, Size: 355 bytes --]
Hello,
Danny Milosavljevic <dannym@scratchpost.org> 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):
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: Type: text/x-patch, Size: 3494 bytes --]
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)
[-- Attachment #3: Type: text/plain, Size: 145 bytes --]
We cannot use the store file name’s hash, unfortunately, because the
UUID has to be given on the “host side.”
Thoughts?
Ludo’.
next prev parent reply other threads:[~2017-07-18 11:50 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-07-17 14:40 bug#27735: Unbootable images with GuixSD on... "GuixSD" Tobias Geerinckx-Rice
2017-07-17 14:51 ` bug#27735: [PATCH 1/2] build, vm: Use a slightly less generic label Tobias Geerinckx-Rice
2017-07-17 17:20 ` Danny Milosavljevic
2017-07-17 17:58 ` Tobias Geerinckx-Rice
2017-07-18 10:09 ` Ludovic Courtès
2017-07-18 12:30 ` Tobias Geerinckx-Rice
2017-07-18 13:48 ` Danny Milosavljevic
2017-07-17 17:17 ` bug#27735: Unbootable images with GuixSD on... "GuixSD" Danny Milosavljevic
2017-07-17 18:12 ` Tobias Geerinckx-Rice
2017-07-17 18:37 ` Tobias Geerinckx-Rice
2017-07-18 11:49 ` Ludovic Courtès [this message]
2017-07-18 15:09 ` Tobias Geerinckx-Rice
2017-07-18 18:59 ` Ludovic Courtès
2017-07-18 20:42 ` Tobias Geerinckx-Rice
2017-07-19 19:11 ` Danny Milosavljevic
2017-07-19 22:32 ` bug#27735: Lookup by UUID Ludovic Courtès
2017-07-20 17:38 ` Danny Milosavljevic
2017-07-20 20:32 ` Ludovic Courtès
2017-07-20 21:51 ` Danny Milosavljevic
2017-08-05 17:50 ` Danny Milosavljevic
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87bmoi0xua.fsf@gnu.org \
--to=ludo@gnu.org \
--cc=27735@debbugs.gnu.org \
--cc=dannym@scratchpost.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 external index
https://git.savannah.gnu.org/cgit/guix.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.