all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* [bug#28696] [PATCH 0/5] Support UUIDs for the EFI System Partition (FAT)
@ 2017-10-04  7:24 Ludovic Courtès
  2017-10-04  7:25 ` [bug#28696] [PATCH 1/5] file-systems: 'mount-file-system' now takes a <file-system> object Ludovic Courtès
                   ` (2 more replies)
  0 siblings, 3 replies; 9+ messages in thread
From: Ludovic Courtès @ 2017-10-04  7:24 UTC (permalink / raw)
  To: 28696

Hello!

This patch series fixes what Roel reported at
<https://lists.gnu.org/archive/html/help-guix/2017-09/msg00094.html>: it
allows users to refer to their EFI System Partition and to FAT file
systems in general by UUID.

I’ve tested it on my UEFI laptop where /boot/efi is actually FAT16, not
FAT32 (I suppose UEFI supports both).

Let me know what you think!

Ludo’.

Ludovic Courtès (5):
  file-systems: 'mount-file-system' now takes a <file-system> object.
  file-systems: Preserve UUID types when serializing.
  file-systems: Add support for FAT16.
  uuid: Change "fat32" to "fat".
  doc: Give an example with a FAT UUID.

 doc/guix.texi                                |   5 ++
 gnu/build/file-systems.scm                   | 115 +++++++++++++++++----------
 gnu/build/linux-boot.scm                     |  20 ++---
 gnu/build/linux-container.scm                |   3 +-
 gnu/services/base.scm                        |   6 +-
 gnu/system/examples/lightweight-desktop.tmpl |   8 +-
 gnu/system/file-systems.scm                  |  10 ++-
 gnu/system/linux-initrd.scm                  |   6 +-
 gnu/system/uuid.scm                          |  30 +++----
 9 files changed, 126 insertions(+), 77 deletions(-)

-- 
2.14.2

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [bug#28696] [PATCH 1/5] file-systems: 'mount-file-system' now takes a <file-system> object.
  2017-10-04  7:24 [bug#28696] [PATCH 0/5] Support UUIDs for the EFI System Partition (FAT) Ludovic Courtès
@ 2017-10-04  7:25 ` Ludovic Courtès
  2017-10-04  7:25   ` [bug#28696] [PATCH 2/5] file-systems: Preserve UUID types when serializing Ludovic Courtès
                     ` (3 more replies)
  2017-10-09 20:54 ` [bug#28696] [PATCH 0/5] Support UUIDs for the EFI System Partition (FAT) Roel Janssen
  2017-10-11  9:13 ` bug#28696: " Ludovic Courtès
  2 siblings, 4 replies; 9+ messages in thread
From: Ludovic Courtès @ 2017-10-04  7:25 UTC (permalink / raw)
  To: 28696

* gnu/build/file-systems.scm (mount-file-system): Rename 'spec' to 'fs'
and assume it's a <file-system>.
* gnu/build/linux-boot.scm (boot-system): Assume MOUNTS is a list of
<file-system> and adjust accordingly.
* gnu/build/linux-container.scm (mount-file-systems): Remove
'file-system->spec' call.
* gnu/services/base.scm (file-system-shepherd-service): Add
'spec->file-system' call.  Add (gnu system file-systems) to 'modules'.
* gnu/system/linux-initrd.scm (raw-initrd): Use (gnu system
file-systems).  Add 'spec->file-system' call for #:mounts.
---
 gnu/build/file-systems.scm    | 65 ++++++++++++++++++++++---------------------
 gnu/build/linux-boot.scm      | 20 ++++++-------
 gnu/build/linux-container.scm |  3 +-
 gnu/services/base.scm         |  6 ++--
 gnu/system/linux-initrd.scm   |  6 +++-
 5 files changed, 53 insertions(+), 47 deletions(-)

diff --git a/gnu/build/file-systems.scm b/gnu/build/file-systems.scm
index 32885f1d2..8b1a4cb19 100644
--- a/gnu/build/file-systems.scm
+++ b/gnu/build/file-systems.scm
@@ -20,9 +20,11 @@
 
 (define-module (gnu build file-systems)
   #:use-module (gnu system uuid)
+  #:use-module (gnu system file-systems)
   #:use-module (guix build utils)
   #:use-module (guix build bournish)
-  #:use-module (guix build syscalls)
+  #:use-module ((guix build syscalls)
+                #:hide (file-system-type))
   #:use-module (rnrs io ports)
   #:use-module (rnrs bytevectors)
   #:use-module (ice-9 match)
@@ -552,11 +554,8 @@ corresponds to the symbols listed in FLAGS."
       (()
        0))))
 
-(define* (mount-file-system spec #:key (root "/root"))
-  "Mount the file system described by SPEC under ROOT.  SPEC must have the
-form:
-
-  (DEVICE TITLE MOUNT-POINT TYPE (FLAGS ...) OPTIONS CHECK?)
+(define* (mount-file-system fs #:key (root "/root"))
+  "Mount the file system described by FS, a <file-system> object, under ROOT.
 
 DEVICE, MOUNT-POINT, and TYPE must be strings; OPTIONS can be a string or #f;
 FLAGS must be a list of symbols.  CHECK? is a Boolean indicating whether to
@@ -582,34 +581,36 @@ run a file system check."
                             (if options
                                 (string-append "," options)
                                 "")))))
-  (match spec
-    ((source title mount-point type (flags ...) options check?)
-     (let ((source      (canonicalize-device-spec source title))
-           (mount-point (string-append root "/" mount-point))
-           (flags       (mount-flags->bit-mask flags)))
-       (when check?
-         (check-file-system source type))
+  (let ((type        (file-system-type fs))
+        (options     (file-system-options fs))
+        (source      (canonicalize-device-spec (file-system-device fs)
+                                               (file-system-title fs)))
+        (mount-point (string-append root "/"
+                                    (file-system-mount-point fs)))
+        (flags       (mount-flags->bit-mask (file-system-flags fs))))
+    (when (file-system-check? fs)
+      (check-file-system source type))
 
-       ;; Create the mount point.  Most of the time this is a directory, but
-       ;; in the case of a bind mount, a regular file or socket may be needed.
-       (if (and (= MS_BIND (logand flags MS_BIND))
-                (not (file-is-directory? source)))
-           (unless (file-exists? mount-point)
-             (mkdir-p (dirname mount-point))
-             (call-with-output-file mount-point (const #t)))
-           (mkdir-p mount-point))
+    ;; Create the mount point.  Most of the time this is a directory, but
+    ;; in the case of a bind mount, a regular file or socket may be needed.
+    (if (and (= MS_BIND (logand flags MS_BIND))
+             (not (file-is-directory? source)))
+        (unless (file-exists? mount-point)
+          (mkdir-p (dirname mount-point))
+          (call-with-output-file mount-point (const #t)))
+        (mkdir-p mount-point))
 
-       (cond
-        ((string-prefix? "nfs" type)
-         (mount-nfs source mount-point type flags options))
-        (else
-         (mount source mount-point type flags options)))
+    (cond
+     ((string-prefix? "nfs" type)
+      (mount-nfs source mount-point type flags options))
+     (else
+      (mount source mount-point type flags options)))
 
-       ;; For read-only bind mounts, an extra remount is needed, as per
-       ;; <http://lwn.net/Articles/281157/>, which still applies to Linux 4.0.
-       (when (and (= MS_BIND (logand flags MS_BIND))
-                  (= MS_RDONLY (logand flags MS_RDONLY)))
-         (let ((flags (logior MS_BIND MS_REMOUNT MS_RDONLY)))
-           (mount source mount-point type flags #f)))))))
+    ;; For read-only bind mounts, an extra remount is needed, as per
+    ;; <http://lwn.net/Articles/281157/>, which still applies to Linux 4.0.
+    (when (and (= MS_BIND (logand flags MS_BIND))
+               (= MS_RDONLY (logand flags MS_RDONLY)))
+      (let ((flags (logior MS_BIND MS_REMOUNT MS_RDONLY)))
+        (mount source mount-point type flags #f)))))
 
 ;;; file-systems.scm ends here
diff --git a/gnu/build/linux-boot.scm b/gnu/build/linux-boot.scm
index 360ef3fae..3712abe91 100644
--- a/gnu/build/linux-boot.scm
+++ b/gnu/build/linux-boot.scm
@@ -1,5 +1,5 @@
 ;;; GNU Guix --- Functional package management for GNU
-;;; Copyright © 2013, 2014, 2015, 2016 Ludovic Courtès <ludo@gnu.org>
+;;; Copyright © 2013, 2014, 2015, 2016, 2017 Ludovic Courtès <ludo@gnu.org>
 ;;; Copyright © 2017 Mathieu Othacehe <m.othacehe@gmail.com>
 ;;;
 ;;; This file is part of GNU Guix.
@@ -27,9 +27,11 @@
   #:use-module (ice-9 match)
   #:use-module (ice-9 ftw)
   #:use-module (guix build utils)
-  #:use-module (guix build syscalls)
+  #:use-module ((guix build syscalls)
+                #:hide (file-system-type))
   #:use-module (gnu build linux-modules)
   #:use-module (gnu build file-systems)
+  #:use-module (gnu system file-systems)
   #:export (mount-essential-file-systems
             linux-command-line
             find-long-option
@@ -349,19 +351,17 @@ supports kernel command-line options '--load', '--root', and '--repl'.
 Mount the root file system, specified by the '--root' command-line argument,
 if any.
 
-MOUNTS must be a list suitable for 'mount-file-system'.
+MOUNTS must be a list of <file-system> objects.
 
 When VOLATILE-ROOT? is true, the root file system is writable but any changes
 to it are lost."
-  (define root-mount-point?
-    (match-lambda
-     ((device _ "/" _ ...) #t)
-     (_ #f)))
+  (define (root-mount-point? fs)
+    (string=? (file-system-mount-point fs) "/"))
 
   (define root-fs-type
-    (or (any (match-lambda
-              ((device _ "/" type _ ...) type)
-              (_ #f))
+    (or (any (lambda (fs)
+               (and (root-mount-point? fs)
+                    (file-system-type fs)))
              mounts)
         "ext4"))
 
diff --git a/gnu/build/linux-container.scm b/gnu/build/linux-container.scm
index 95bfd92dd..70e789403 100644
--- a/gnu/build/linux-container.scm
+++ b/gnu/build/linux-container.scm
@@ -152,8 +152,7 @@ for the process."
 
   ;; Mount user-specified file systems.
   (for-each (lambda (file-system)
-              (mount-file-system (file-system->spec file-system)
-                                 #:root root))
+              (mount-file-system file-system #:root root))
             mounts)
 
   ;; Jail the process inside the container's root file system.
diff --git a/gnu/services/base.scm b/gnu/services/base.scm
index 64620a9b0..541ca76f1 100644
--- a/gnu/services/base.scm
+++ b/gnu/services/base.scm
@@ -307,7 +307,8 @@ FILE-SYSTEM."
                                                                 '#$packages))))
                            (lambda ()
                              (mount-file-system
-                              '#$(file-system->spec file-system)
+                              (spec->file-system
+                               '#$(file-system->spec file-system))
                               #:root "/"))
                            (lambda ()
                              (setenv "PATH" $PATH)))
@@ -322,9 +323,10 @@ FILE-SYSTEM."
                       (umount #$target)
                       #f))
 
-            ;; We need an additional module.
+            ;; We need additional modules.
             (modules `(((gnu build file-systems)
                         #:select (mount-file-system))
+                       (gnu system file-systems)
                        ,@%default-modules)))))))
 
 (define (file-system-shepherd-services file-systems)
diff --git a/gnu/system/linux-initrd.scm b/gnu/system/linux-initrd.scm
index 5a7aec5c8..e78be8cd3 100644
--- a/gnu/system/linux-initrd.scm
+++ b/gnu/system/linux-initrd.scm
@@ -174,9 +174,11 @@ to it are lost."
                            '((gnu build linux-boot)
                              (guix build utils)
                              (guix build bournish)
+                             (gnu system file-systems)
                              (gnu build file-systems)))
      #~(begin
          (use-modules (gnu build linux-boot)
+                      (gnu system file-systems)
                       (guix build utils)
                       (guix build bournish)   ;add the 'bournish' meta-command
                       (srfi srfi-26)
@@ -193,7 +195,9 @@ to it are lost."
              (set-path-environment-variable "PATH" '("bin" "sbin")
                                             '#$helper-packages)))
 
-         (boot-system #:mounts '#$(map file-system->spec file-systems)
+         (boot-system #:mounts
+                      (map spec->file-system
+                           '#$(map file-system->spec file-systems))
                       #:pre-mount (lambda ()
                                     (and #$@device-mapping-commands))
                       #:linux-modules '#$linux-modules
-- 
2.14.2

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [bug#28696] [PATCH 2/5] file-systems: Preserve UUID types when serializing.
  2017-10-04  7:25 ` [bug#28696] [PATCH 1/5] file-systems: 'mount-file-system' now takes a <file-system> object Ludovic Courtès
@ 2017-10-04  7:25   ` Ludovic Courtès
  2017-10-04  7:25   ` [bug#28696] [PATCH 3/5] file-systems: Add support for FAT16 Ludovic Courtès
                     ` (2 subsequent siblings)
  3 siblings, 0 replies; 9+ messages in thread
From: Ludovic Courtès @ 2017-10-04  7:25 UTC (permalink / raw)
  To: 28696

Reported by Roel Janssen <roel@gnu.org>
at <https://lists.gnu.org/archive/html/help-guix/2017-09/msg00094.html>.

* gnu/system/file-systems.scm (file-system->spec): When DEVICE is a
UUID, serialize it in a way that preserves its type.
(spec->file-system): Adjust accordingly.
* gnu/build/file-systems.scm (canonicalize-device-spec): Add case for
when SPEC is 'uuid?'.
---
 gnu/build/file-systems.scm  | 11 ++++++-----
 gnu/system/file-systems.scm | 10 ++++++++--
 2 files changed, 14 insertions(+), 7 deletions(-)

diff --git a/gnu/build/file-systems.scm b/gnu/build/file-systems.scm
index 8b1a4cb19..dea5bc619 100644
--- a/gnu/build/file-systems.scm
+++ b/gnu/build/file-systems.scm
@@ -450,8 +450,7 @@ the following:
      \"/dev/sda1\";
   • 'label', in which case SPEC is known to designate a partition label--e.g.,
      \"my-root-part\";
-  • 'uuid', in which case SPEC must be a UUID (a 16-byte bytevector)
-     designating a partition;
+  • 'uuid', in which case SPEC must be a UUID designating a partition;
   • 'any', in which case SPEC can be anything.
 "
   (define max-trials
@@ -497,9 +496,11 @@ the following:
      (resolve find-partition-by-label spec identity))
     ((uuid)
      (resolve find-partition-by-uuid
-              (if (string? spec)
-                  (string->uuid spec)
-                  spec)
+              (cond ((string? spec)
+                     (string->uuid spec))
+                    ((uuid? spec)
+                     (uuid-bytevector spec))
+                    (else spec))
               uuid->string))
     (else
      (error "unknown device title" title))))
diff --git a/gnu/system/file-systems.scm b/gnu/system/file-systems.scm
index 52f16676f..fbd2b11cd 100644
--- a/gnu/system/file-systems.scm
+++ b/gnu/system/file-systems.scm
@@ -18,6 +18,7 @@
 
 (define-module (gnu system file-systems)
   #:use-module (ice-9 match)
+  #:use-module (rnrs bytevectors)
   #:use-module (srfi srfi-1)
   #:use-module (guix records)
   #:use-module (gnu system uuid)
@@ -157,7 +158,7 @@ initrd code."
   (match fs
     (($ <file-system> device title mount-point type flags options _ _ check?)
      (list (if (uuid? device)
-               (uuid-bytevector device)
+               `(uuid ,(uuid-type device) ,(uuid-bytevector device))
                device)
            title mount-point type flags options check?))))
 
@@ -166,7 +167,12 @@ initrd code."
   (match sexp
     ((device title mount-point type flags options check?)
      (file-system
-       (device device) (title title)
+       (device (match device
+                 (('uuid (? symbol? type) (? bytevector? bv))
+                  (bytevector->uuid bv type))
+                 (_
+                  device)))
+       (title title)
        (mount-point mount-point) (type type)
        (flags flags) (options options)
        (check? check?)))))
-- 
2.14.2

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [bug#28696] [PATCH 3/5] file-systems: Add support for FAT16.
  2017-10-04  7:25 ` [bug#28696] [PATCH 1/5] file-systems: 'mount-file-system' now takes a <file-system> object Ludovic Courtès
  2017-10-04  7:25   ` [bug#28696] [PATCH 2/5] file-systems: Preserve UUID types when serializing Ludovic Courtès
@ 2017-10-04  7:25   ` Ludovic Courtès
  2017-10-04  7:25   ` [bug#28696] [PATCH 4/5] uuid: Change "fat32" to "fat" Ludovic Courtès
  2017-10-04  7:25   ` [bug#28696] [PATCH 5/5] doc: Give an example with a FAT UUID Ludovic Courtès
  3 siblings, 0 replies; 9+ messages in thread
From: Ludovic Courtès @ 2017-10-04  7:25 UTC (permalink / raw)
  To: 28696

* gnu/build/file-systems.scm (check-fat32-file-system): Rename to...
(check-fat-file-system): ... this.
(check-file-system): Adjust accordingly.
(fat16-superblock?, read-fat16-superblock)
(fat16-superblock-uuid, fat16-superblock-volume-name): New procedures.
(%partition-label-readers, %partition-uuid-readers): Add FAT16.
---
 gnu/build/file-systems.scm | 39 +++++++++++++++++++++++++++++++++++----
 1 file changed, 35 insertions(+), 4 deletions(-)

diff --git a/gnu/build/file-systems.scm b/gnu/build/file-systems.scm
index dea5bc619..5d6c335bb 100644
--- a/gnu/build/file-systems.scm
+++ b/gnu/build/file-systems.scm
@@ -194,7 +194,7 @@ if DEVICE does not contain a btrfs file system."
 Trailing spaces are trimmed."
   (string-trim-right (latin1->string (sub-bytevector sblock 71 11) (lambda (c) #f)) #\space))
 
-(define (check-fat32-file-system device)
+(define (check-fat-file-system device)
   "Return the health of a fat file system on DEVICE."
   (match (status:exit-val
           (system* "fsck.vfat" "-v" "-a" device))
@@ -203,6 +203,33 @@ Trailing spaces are trimmed."
     (_ 'fatal-error)))
 
 \f
+;;;
+;;; FAT16 file systems.
+;;;
+
+(define (fat16-superblock? sblock)
+  "Return #t when SBLOCK is a fat16 boot record."
+  (bytevector=? (sub-bytevector sblock 54 8)
+                (string->utf8 "FAT16   ")))
+
+(define (read-fat16-superblock device)
+  "Return the raw contents of DEVICE's fat16 superblock as a bytevector, or
+#f if DEVICE does not contain a fat16 file system."
+  (read-superblock device 0 62 fat16-superblock?))
+
+(define (fat16-superblock-uuid sblock)
+  "Return the Volume ID of a fat superblock SBLOCK as a 4-byte bytevector."
+  (sub-bytevector sblock 39 4))
+
+(define (fat16-superblock-volume-name sblock)
+  "Return the volume name of SBLOCK as a string of at most 11 characters, or
+#f if SBLOCK has no volume name.  The volume name is a latin1 string.
+Trailing spaces are trimmed."
+  (string-trim-right (latin1->string (sub-bytevector sblock 43 11)
+                                     (lambda (c) #f))
+                     #\space))
+
+\f
 ;;;
 ;;; ISO9660 file systems.
 ;;;
@@ -386,7 +413,9 @@ partition field reader that returned a value."
         (partition-field-reader read-btrfs-superblock
                                 btrfs-superblock-volume-name)
         (partition-field-reader read-fat32-superblock
-                                fat32-superblock-volume-name)))
+                                fat32-superblock-volume-name)
+        (partition-field-reader read-fat16-superblock
+                                fat16-superblock-volume-name)))
 
 (define %partition-uuid-readers
   (list (partition-field-reader read-iso9660-superblock
@@ -396,7 +425,9 @@ partition field reader that returned a value."
         (partition-field-reader read-btrfs-superblock
                                 btrfs-superblock-uuid)
         (partition-field-reader read-fat32-superblock
-                                fat32-superblock-uuid)))
+                                fat32-superblock-uuid)
+        (partition-field-reader read-fat16-superblock
+                                fat16-superblock-uuid)))
 
 (define read-partition-label
   (cut read-partition-field <> %partition-label-readers))
@@ -511,7 +542,7 @@ the following:
     (cond
      ((string-prefix? "ext" type) check-ext2-file-system)
      ((string-prefix? "btrfs" type) check-btrfs-file-system)
-     ((string-suffix? "fat" type) check-fat32-file-system)
+     ((string-suffix? "fat" type) check-fat-file-system)
      (else #f)))
 
   (if check-procedure
-- 
2.14.2

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [bug#28696] [PATCH 4/5] uuid: Change "fat32" to "fat".
  2017-10-04  7:25 ` [bug#28696] [PATCH 1/5] file-systems: 'mount-file-system' now takes a <file-system> object Ludovic Courtès
  2017-10-04  7:25   ` [bug#28696] [PATCH 2/5] file-systems: Preserve UUID types when serializing Ludovic Courtès
  2017-10-04  7:25   ` [bug#28696] [PATCH 3/5] file-systems: Add support for FAT16 Ludovic Courtès
@ 2017-10-04  7:25   ` Ludovic Courtès
  2017-10-04  7:25   ` [bug#28696] [PATCH 5/5] doc: Give an example with a FAT UUID Ludovic Courtès
  3 siblings, 0 replies; 9+ messages in thread
From: Ludovic Courtès @ 2017-10-04  7:25 UTC (permalink / raw)
  To: 28696

* gnu/system/uuid.scm (%fat32-endianness): Rename to...
(%fat-endianness): ... this.
(fat32-uuid->string): Rename to...
(fat-uuid->string): ... this.
(%fat32-uuid-rx): Rename to..
(%fat-uuid-rx): ... this.
(string->fat32-uuid): Rename to...
(string->fat-uuid): ... this.
(%uuid-parsers, %uuid-printers): Add 'fat16.
---
 gnu/system/uuid.scm | 30 +++++++++++++++---------------
 1 file changed, 15 insertions(+), 15 deletions(-)

diff --git a/gnu/system/uuid.scm b/gnu/system/uuid.scm
index 6470abb8c..26953a9a9 100644
--- a/gnu/system/uuid.scm
+++ b/gnu/system/uuid.scm
@@ -41,7 +41,7 @@
             string->ext3-uuid
             string->ext4-uuid
             string->btrfs-uuid
-            string->fat32-uuid
+            string->fat-uuid
             iso9660-uuid->string
 
             ;; XXX: For lack of a better place.
@@ -163,25 +163,25 @@ ISO9660 UUID representation."
 
 \f
 ;;;
-;;; FAT32.
+;;; FAT32/FAT16.
 ;;;
 
-(define-syntax %fat32-endianness
-  ;; Endianness of FAT file systems.
+(define-syntax %fat-endianness
+  ;; Endianness of FAT32/FAT16 file systems.
   (identifier-syntax (endianness little)))
 
-(define (fat32-uuid->string uuid)
-  "Convert fat32 UUID, a 4-byte bytevector, to its string representation."
-  (let ((high  (bytevector-uint-ref uuid 0 %fat32-endianness 2))
-        (low (bytevector-uint-ref uuid 2 %fat32-endianness 2)))
+(define (fat-uuid->string uuid)
+  "Convert FAT32/FAT16 UUID, a 4-byte bytevector, to its string representation."
+  (let ((high  (bytevector-uint-ref uuid 0 %fat-endianness 2))
+        (low (bytevector-uint-ref uuid 2 %fat-endianness 2)))
     (format #f "~:@(~x-~x~)" low high)))
 
-(define %fat32-uuid-rx
+(define %fat-uuid-rx
   (make-regexp "^([[:xdigit:]]{4})-([[:xdigit:]]{4})$"))
 
-(define (string->fat32-uuid str)
-  "Parse STR, which is in FAT32 format, and return a bytevector or #f."
-  (match (regexp-exec %fat32-uuid-rx str)
+(define (string->fat-uuid str)
+  "Parse STR, which is in FAT32/FAT16 format, and return a bytevector or #f."
+  (match (regexp-exec %fat-uuid-rx str)
     (#f
      #f)
     (rx-match
@@ -189,7 +189,7 @@ ISO9660 UUID representation."
                                    (match:substring rx-match 2) 16)
                                   (string->number
                                    (match:substring rx-match 1) 16))
-                            %fat32-endianness
+                            %fat-endianness
                             2))))
 
 \f
@@ -215,14 +215,14 @@ ISO9660 UUID representation."
 (define %uuid-parsers
   (vhashq
    ('dce 'ext2 'ext3 'ext4 'btrfs 'luks => string->dce-uuid)
-   ('fat32 'fat => string->fat32-uuid)
+   ('fat32 'fat16 'fat => string->fat-uuid)
    ('iso9660 => string->iso9660-uuid)))
 
 (define %uuid-printers
   (vhashq
    ('dce 'ext2 'ext3 'ext4 'btrfs 'luks => dce-uuid->string)
    ('iso9660 => iso9660-uuid->string)
-   ('fat32 'fat => fat32-uuid->string)))
+   ('fat32 'fat16 'fat => fat-uuid->string)))
 
 (define* (string->uuid str #:optional (type 'dce))
   "Parse STR as a UUID of the given TYPE.  On success, return the
-- 
2.14.2

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [bug#28696] [PATCH 5/5] doc: Give an example with a FAT UUID.
  2017-10-04  7:25 ` [bug#28696] [PATCH 1/5] file-systems: 'mount-file-system' now takes a <file-system> object Ludovic Courtès
                     ` (2 preceding siblings ...)
  2017-10-04  7:25   ` [bug#28696] [PATCH 4/5] uuid: Change "fat32" to "fat" Ludovic Courtès
@ 2017-10-04  7:25   ` Ludovic Courtès
  3 siblings, 0 replies; 9+ messages in thread
From: Ludovic Courtès @ 2017-10-04  7:25 UTC (permalink / raw)
  To: 28696

* gnu/system/examples/lightweight-desktop.tmpl <file-systems>: Add a
UUID for the /boot/efi partition.
* doc/guix.texi (Using the Configuration System): Mention it.
---
 doc/guix.texi                                | 5 +++++
 gnu/system/examples/lightweight-desktop.tmpl | 8 ++++----
 2 files changed, 9 insertions(+), 4 deletions(-)

diff --git a/doc/guix.texi b/doc/guix.texi
index b9d127c47..13b6d721f 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -8396,6 +8396,7 @@ management, power management, and more, would look like this:
 @include os-config-desktop.texi
 @end lisp
 
+@cindex UEFI
 A graphical UEFI system with a choice of lightweight window managers
 instead of full-blown desktop environments would look like this:
 
@@ -8403,6 +8404,10 @@ instead of full-blown desktop environments would look like this:
 @include os-config-lightweight-desktop.texi
 @end lisp
 
+This example refers to the @file{/boot/efi} partition by its UUID,
+@code{1234-ABCD}.  Replace this UUID with the right UUID on your system,
+as returned by the @command{blkid} command.
+
 @xref{Desktop Services}, for the exact list of services provided by
 @var{%desktop-services}.  @xref{X.509 Certificates}, for background
 information about the @code{nss-certs} package that is used here.
diff --git a/gnu/system/examples/lightweight-desktop.tmpl b/gnu/system/examples/lightweight-desktop.tmpl
index fb7cfebf6..d13c04c76 100644
--- a/gnu/system/examples/lightweight-desktop.tmpl
+++ b/gnu/system/examples/lightweight-desktop.tmpl
@@ -17,16 +17,16 @@
                 (bootloader grub-efi-bootloader)
                 (target "/boot/efi")))
 
-  ;; Assume the target root file system is labelled "my-root".
+  ;; Assume the target root file system is labelled "my-root",
+  ;; and the EFI System Partition has UUID 1234-ABCD.
   (file-systems (cons* (file-system
                          (device "my-root")
                          (title 'label)
                          (mount-point "/")
                          (type "ext4"))
                        (file-system
-                         ;; Specify partition here since FAT
-                         ;; labels are currently unsupported.
-                         (device "/dev/sda1")
+                         (device (uuid "1234-ABCD" 'fat))
+                         (title 'uuid)
                          (mount-point "/boot/efi")
                          (type "vfat"))
                        %base-file-systems))
-- 
2.14.2

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [bug#28696] [PATCH 0/5] Support UUIDs for the EFI System Partition (FAT)
  2017-10-04  7:24 [bug#28696] [PATCH 0/5] Support UUIDs for the EFI System Partition (FAT) Ludovic Courtès
  2017-10-04  7:25 ` [bug#28696] [PATCH 1/5] file-systems: 'mount-file-system' now takes a <file-system> object Ludovic Courtès
@ 2017-10-09 20:54 ` Roel Janssen
  2017-10-11 19:49   ` Ludovic Courtès
  2017-10-11  9:13 ` bug#28696: " Ludovic Courtès
  2 siblings, 1 reply; 9+ messages in thread
From: Roel Janssen @ 2017-10-09 20:54 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: 28696


Ludovic Courtès writes:

> Hello!
>
> This patch series fixes what Roel reported at
> <https://lists.gnu.org/archive/html/help-guix/2017-09/msg00094.html>: it
> allows users to refer to their EFI System Partition and to FAT file
> systems in general by UUID.
>
> I’ve tested it on my UEFI laptop where /boot/efi is actually FAT16, not
> FAT32 (I suppose UEFI supports both).
>
> Let me know what you think!
>
> Ludo’.
>
> Ludovic Courtès (5):
>   file-systems: 'mount-file-system' now takes a <file-system> object.
>   file-systems: Preserve UUID types when serializing.
>   file-systems: Add support for FAT16.
>   uuid: Change "fat32" to "fat".
>   doc: Give an example with a FAT UUID.
>
>  doc/guix.texi                                |   5 ++
>  gnu/build/file-systems.scm                   | 115 +++++++++++++++++----------
>  gnu/build/linux-boot.scm                     |  20 ++---
>  gnu/build/linux-container.scm                |   3 +-
>  gnu/services/base.scm                        |   6 +-
>  gnu/system/examples/lightweight-desktop.tmpl |   8 +-
>  gnu/system/file-systems.scm                  |  10 ++-
>  gnu/system/linux-initrd.scm                  |   6 +-
>  gnu/system/uuid.scm                          |  30 +++----
>  9 files changed, 126 insertions(+), 77 deletions(-)

Sorry for the delay.  It's really awesome that you've work so hard to
fix the issue I reported.  I really appreciate it!

I tried it with:
  (file-system
    (title 'uuid)
    (device (uuid "72E5-26A0" 'fat))
    (mount-point "/boot/efi")
    (type "vfat"))

And it works.  These changes look good to me.

Thanks again,
Roel Janssen

^ permalink raw reply	[flat|nested] 9+ messages in thread

* bug#28696: [PATCH 0/5] Support UUIDs for the EFI System Partition (FAT)
  2017-10-04  7:24 [bug#28696] [PATCH 0/5] Support UUIDs for the EFI System Partition (FAT) Ludovic Courtès
  2017-10-04  7:25 ` [bug#28696] [PATCH 1/5] file-systems: 'mount-file-system' now takes a <file-system> object Ludovic Courtès
  2017-10-09 20:54 ` [bug#28696] [PATCH 0/5] Support UUIDs for the EFI System Partition (FAT) Roel Janssen
@ 2017-10-11  9:13 ` Ludovic Courtès
  2 siblings, 0 replies; 9+ messages in thread
From: Ludovic Courtès @ 2017-10-11  9:13 UTC (permalink / raw)
  To: 28696-done

Hello,

Ludovic Courtès <ludo@gnu.org> skribis:

> This patch series fixes what Roel reported at
> <https://lists.gnu.org/archive/html/help-guix/2017-09/msg00094.html>: it
> allows users to refer to their EFI System Partition and to FAT file
> systems in general by UUID.

I went ahead and pushed this series.  Let me know if anything’s wrong!

Ludo’.

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [bug#28696] [PATCH 0/5] Support UUIDs for the EFI System Partition (FAT)
  2017-10-09 20:54 ` [bug#28696] [PATCH 0/5] Support UUIDs for the EFI System Partition (FAT) Roel Janssen
@ 2017-10-11 19:49   ` Ludovic Courtès
  0 siblings, 0 replies; 9+ messages in thread
From: Ludovic Courtès @ 2017-10-11 19:49 UTC (permalink / raw)
  To: Roel Janssen; +Cc: 28696

Hi Roel,

Roel Janssen <roel@gnu.org> skribis:

> Sorry for the delay.  It's really awesome that you've work so hard to
> fix the issue I reported.  I really appreciate it!
>
> I tried it with:
>   (file-system
>     (title 'uuid)
>     (device (uuid "72E5-26A0" 'fat))
>     (mount-point "/boot/efi")
>     (type "vfat"))
>
> And it works.  These changes look good to me.

Awesome, thanks for testing!

Most likely you can also do:

               (device "EFI")
               (title 'label)

though I wouldn’t recommend that because if there’s, say, a bootable
UEFI dongle plugged in when you boot, you could end up mounting that one
instead of your actual hard disk.

Ludo’.

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2017-10-11 19:50 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-10-04  7:24 [bug#28696] [PATCH 0/5] Support UUIDs for the EFI System Partition (FAT) Ludovic Courtès
2017-10-04  7:25 ` [bug#28696] [PATCH 1/5] file-systems: 'mount-file-system' now takes a <file-system> object Ludovic Courtès
2017-10-04  7:25   ` [bug#28696] [PATCH 2/5] file-systems: Preserve UUID types when serializing Ludovic Courtès
2017-10-04  7:25   ` [bug#28696] [PATCH 3/5] file-systems: Add support for FAT16 Ludovic Courtès
2017-10-04  7:25   ` [bug#28696] [PATCH 4/5] uuid: Change "fat32" to "fat" Ludovic Courtès
2017-10-04  7:25   ` [bug#28696] [PATCH 5/5] doc: Give an example with a FAT UUID Ludovic Courtès
2017-10-09 20:54 ` [bug#28696] [PATCH 0/5] Support UUIDs for the EFI System Partition (FAT) Roel Janssen
2017-10-11 19:49   ` Ludovic Courtès
2017-10-11  9:13 ` bug#28696: " Ludovic Courtès

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.