diff options
| author | Danny Milosavljevic <dannym@friendly-machines.com> | 2026-02-08 21:50:42 +0100 |
|---|---|---|
| committer | Danny Milosavljevic <dannym@friendly-machines.com> | 2026-04-09 19:55:05 +0200 |
| commit | b90597b98d46767207a0e92a84fb39c344472b69 (patch) | |
| tree | 9278f56f2a91341f67cf203c826f729364b04d44 /gnu/bootloader | |
| parent | 338f665b97afdb0928002aa538c21be56d1585a3 (diff) | |
guix: Ask LUKS password only once on boot when using GRUB.
* gnu/bootloader/grub.scm (make-grub-configuration): Modify.
* gnu/system/mapped-devices.scm (open-luks-device): Modify.
* gnu/tests/install.scm (%encrypted-root-installation-script): Modify.
(%encrypted-root-os): Make debugging possible.
* doc/guix.texi (Mapped Devices): Cross-reference automatic LUKS master key
passing.
(BootloaderConfiguration): Document automatic LUKS master key passing via
GRUB's (proc)/luks_script. Update extra-initrd documentation.
Change-Id: I5be74a524de04232d156e750109707fe7e50c28a
Diffstat (limited to 'gnu/bootloader')
| -rw-r--r-- | gnu/bootloader/grub.scm | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/gnu/bootloader/grub.scm b/gnu/bootloader/grub.scm index 88c8d13c543..3a37f7f2947 100644 --- a/gnu/bootloader/grub.scm +++ b/gnu/bootloader/grub.scm | |||
| @@ -404,7 +404,10 @@ when booting a root file system on a Btrfs subvolume." | |||
| 404 | (initrd (normalize-file (menu-entry-initrd entry) | 404 | (initrd (normalize-file (menu-entry-initrd entry) |
| 405 | device-mount-point | 405 | device-mount-point |
| 406 | store-directory-prefix)) | 406 | store-directory-prefix)) |
| 407 | (extra-initrd (bootloader-configuration-extra-initrd config))) | 407 | (extra-initrd (bootloader-configuration-extra-initrd config)) |
| 408 | (luks-script-initrd | ||
| 409 | (and (pair? store-crypto-devices) | ||
| 410 | "newc:etc/luks_script:(proc)/luks_script"))) | ||
| 408 | ;; Here DEVICE is the store and DEVICE-MOUNT-POINT is its mount point. | 411 | ;; Here DEVICE is the store and DEVICE-MOUNT-POINT is its mount point. |
| 409 | ;; Use the right file names for LINUX and INITRD in case | 412 | ;; Use the right file names for LINUX and INITRD in case |
| 410 | ;; DEVICE-MOUNT-POINT is not "/", meaning that the store is on a | 413 | ;; DEVICE-MOUNT-POINT is not "/", meaning that the store is on a |
| @@ -412,14 +415,20 @@ when booting a root file system on a Btrfs subvolume." | |||
| 412 | 415 | ||
| 413 | ;; When STORE-DIRECTORY-PREFIX is defined, prepend it the linux and | 416 | ;; When STORE-DIRECTORY-PREFIX is defined, prepend it the linux and |
| 414 | ;; initrd paths, to allow booting from a Btrfs subvolume. | 417 | ;; initrd paths, to allow booting from a Btrfs subvolume. |
| 418 | |||
| 419 | ;; When the store is on an encrypted device, inject GRUB's | ||
| 420 | ;; (proc)/luks_script into the initrd as /etc/luks_script so the | ||
| 421 | ;; initrd can use the already-decrypted master key to open LUKS | ||
| 422 | ;; volumes without prompting for the password a second time. | ||
| 415 | #~(format port "menuentry ~s { | 423 | #~(format port "menuentry ~s { |
| 416 | ~a | 424 | ~a |
| 417 | linux ~a ~a | 425 | linux ~a ~a |
| 418 | initrd ~a ~a | 426 | initrd ~a ~a ~a |
| 419 | }~%" | 427 | }~%" |
| 420 | #$label | 428 | #$label |
| 421 | #$(grub-root-search device linux) | 429 | #$(grub-root-search device linux) |
| 422 | #$linux (string-join (list #$@arguments)) | 430 | #$linux (string-join (list #$@arguments)) |
| 431 | (or #$luks-script-initrd "") | ||
| 423 | (or #$extra-initrd "") | 432 | (or #$extra-initrd "") |
| 424 | #$initrd))) | 433 | #$initrd))) |
| 425 | (multiboot-kernel | 434 | (multiboot-kernel |
| @@ -464,7 +473,7 @@ menuentry ~s { | |||
| 464 | ;; Other type of devices aren't implemented. | 473 | ;; Other type of devices aren't implemented. |
| 465 | #~())) | 474 | #~())) |
| 466 | (let ((devices (map crypto-device->cryptomount store-crypto-devices)) | 475 | (let ((devices (map crypto-device->cryptomount store-crypto-devices)) |
| 467 | (modules #~(format port "insmod luks~%insmod luks2~%"))) | 476 | (modules #~(format port "insmod procfs~%insmod luks~%insmod luks2~%"))) |
| 468 | (if (null? devices) | 477 | (if (null? devices) |
| 469 | devices | 478 | devices |
| 470 | (cons modules devices)))) | 479 | (cons modules devices)))) |
