diff options
| author | Josselin Poiret <dev@jpoiret.xyz> | 2021-11-15 20:53:39 +0000 |
|---|---|---|
| committer | Ludovic Courtès <ludo@gnu.org> | 2021-12-01 17:51:37 +0100 |
| commit | adce91a3ec0cb2912daa6eefe9324c15ff3126f7 (patch) | |
| tree | 5f5fb0b86238ab4e9be08e4f84f3422e7d4d0069 | |
| parent | 9f371f23ebfa20f70b3bfd55dc459b683f21ba91 (diff) | |
gnu: system: Add LUKS2 support for the root file system.
* gnu/bootloader/grub.scm (grub-configuration-file): Add 'insmod
luks2'.
* gnu/system/mapped-devices.scm (open-luks-device): Create
'/run/cryptsetup/' directory.
Signed-off-by: Ludovic Courtès <ludo@gnu.org>
| -rw-r--r-- | gnu/bootloader/grub.scm | 3 | ||||
| -rw-r--r-- | gnu/system/mapped-devices.scm | 10 |
2 files changed, 9 insertions, 4 deletions
diff --git a/gnu/bootloader/grub.scm b/gnu/bootloader/grub.scm index d8e888ff40f..42f71aa4db0 100644 --- a/gnu/bootloader/grub.scm +++ b/gnu/bootloader/grub.scm | |||
| @@ -415,8 +415,7 @@ menuentry ~s { | |||
| 415 | ;; Other type of devices aren't implemented. | 415 | ;; Other type of devices aren't implemented. |
| 416 | #~())) | 416 | #~())) |
| 417 | (let ((devices (map crypto-device->cryptomount store-crypto-devices)) | 417 | (let ((devices (map crypto-device->cryptomount store-crypto-devices)) |
| 418 | ;; XXX: Add luks2 when grub 2.06 is packaged. | 418 | (modules #~(format port "insmod luks~%insmod luks2~%"))) |
| 419 | (modules #~(format port "insmod luks~%"))) | ||
| 420 | (if (null? devices) | 419 | (if (null? devices) |
| 421 | devices | 420 | devices |
| 422 | (cons modules devices)))) | 421 | (cons modules devices)))) |
diff --git a/gnu/system/mapped-devices.scm b/gnu/system/mapped-devices.scm index 518dbc4fe83..96a381d5fea 100644 --- a/gnu/system/mapped-devices.scm +++ b/gnu/system/mapped-devices.scm | |||
| @@ -192,7 +192,8 @@ option of @command{guix system}.\n") | |||
| 192 | "Return a gexp that maps SOURCE to TARGET as a LUKS device, using | 192 | "Return a gexp that maps SOURCE to TARGET as a LUKS device, using |
| 193 | 'cryptsetup'." | 193 | 'cryptsetup'." |
| 194 | (with-imported-modules (source-module-closure | 194 | (with-imported-modules (source-module-closure |
| 195 | '((gnu build file-systems))) | 195 | '((gnu build file-systems) |
| 196 | (guix build utils))) ;; For mkdir-p | ||
| 196 | (match targets | 197 | (match targets |
| 197 | ((target) | 198 | ((target) |
| 198 | #~(let ((source #$(if (uuid? source) | 199 | #~(let ((source #$(if (uuid? source) |
| @@ -201,7 +202,12 @@ option of @command{guix system}.\n") | |||
| 201 | ;; XXX: 'use-modules' should be at the top level. | 202 | ;; XXX: 'use-modules' should be at the top level. |
| 202 | (use-modules (rnrs bytevectors) ;bytevector? | 203 | (use-modules (rnrs bytevectors) ;bytevector? |
| 203 | ((gnu build file-systems) | 204 | ((gnu build file-systems) |
| 204 | #:select (find-partition-by-luks-uuid))) | 205 | #:select (find-partition-by-luks-uuid)) |
| 206 | ((guix build utils) #:select (mkdir-p))) | ||
| 207 | |||
| 208 | ;; Create '/run/cryptsetup/' if it does not exist, as device locking | ||
| 209 | ;; is mandatory for LUKS2. | ||
| 210 | (mkdir-p "/run/cryptsetup/") | ||
| 205 | 211 | ||
| 206 | ;; Use 'cryptsetup-static', not 'cryptsetup', to avoid pulling the | 212 | ;; Use 'cryptsetup-static', not 'cryptsetup', to avoid pulling the |
| 207 | ;; whole world inside the initrd (for when we're in an initrd). | 213 | ;; whole world inside the initrd (for when we're in an initrd). |
