From patchwork Mon Nov 15 20:53:39 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Josselin Poiret X-Patchwork-Id: 34515 Return-Path: X-Original-To: patchwork@mira.cbaines.net Delivered-To: patchwork@mira.cbaines.net Received: by mira.cbaines.net (Postfix, from userid 113) id 4D4B727BBE5; Mon, 15 Nov 2021 20:54:10 +0000 (GMT) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, MAILING_LIST_MULTI,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,T_DKIM_INVALID, URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.2 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTPS id 0E36C27BBE1 for ; Mon, 15 Nov 2021 20:54:10 +0000 (GMT) Received: from localhost ([::1]:36138 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mmizR-0004td-4r for patchwork@mira.cbaines.net; Mon, 15 Nov 2021 15:54:09 -0500 Received: from eggs.gnu.org ([209.51.188.92]:33484) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mmizK-0004so-Je for guix-patches@gnu.org; Mon, 15 Nov 2021 15:54:02 -0500 Received: from debbugs.gnu.org ([209.51.188.43]:44771) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mmizK-0006QM-Be for guix-patches@gnu.org; Mon, 15 Nov 2021 15:54:02 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1mmizK-0000pb-9d for guix-patches@gnu.org; Mon, 15 Nov 2021 15:54:02 -0500 X-Loop: help-debbugs@gnu.org Subject: [bug#51514] [PATCH v2 1/3] gnu: system: Add LUKS2 support for the root file system. Resent-From: Josselin Poiret Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Mon, 15 Nov 2021 20:54:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 51514 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: Ludovic =?utf-8?q?Court=C3=A8s?= Cc: Josselin Poiret , 51514@debbugs.gnu.org Received: via spool by 51514-submit@debbugs.gnu.org id=B51514.16370096363164 (code B ref 51514); Mon, 15 Nov 2021 20:54:02 +0000 Received: (at 51514) by debbugs.gnu.org; 15 Nov 2021 20:53:56 +0000 Received: from localhost ([127.0.0.1]:56311 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mmizA-0000ol-3o for submit@debbugs.gnu.org; Mon, 15 Nov 2021 15:53:56 -0500 Received: from jpoiret.xyz ([206.189.101.64]:36636) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mmiz7-0000oZ-Fp for 51514@debbugs.gnu.org; Mon, 15 Nov 2021 15:53:50 -0500 Received: from authenticated-user (jpoiret.xyz [206.189.101.64]) by jpoiret.xyz (Postfix) with ESMTPA id 79BE5184F5F; Mon, 15 Nov 2021 20:53:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=jpoiret.xyz; s=dkim; t=1637009628; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=DgRXqcT8Ad8glOqczTOLb8TMfpdfYL55jruUiZdNPXk=; b=IqUbWupvBCKlC33SH71OQY0oQhP4DUgM4mgmh9ix2QkvILQqAVa7jNPAopF7Cr7gAy+Kcz gBNTWrDCfs2PBMzSfJ4iotXyqt9UUPl0vw3uJBhzcu7EDodW9+q9iKL/5A9zTTc+G5ACFy CvlJYBjgPiBjxVOg7J4gAWhDbCL09hc6fdoktipMLk3WqE6T1qkDDpZn39GzL08Ik84jm+ G2Wo1cQVVZqrmS1iV6Kq/ifYPHWycUxMnvRpuBLxMG5TBKIA7GxS+xf7KfdjLeS6lcwAce Gesq6bXEoN90o3pnn+vHWKQxlRbL+C/DIh564zMKypYS3QvrTTjkzzhtfQybPA== Date: Mon, 15 Nov 2021 20:53:39 +0000 Message-Id: <20211115205341.9724-2-dev@jpoiret.xyz> In-Reply-To: <20211115205341.9724-1-dev@jpoiret.xyz> References: <87h7chdmzh.fsf_-_@gnu.org> <20211115205341.9724-1-dev@jpoiret.xyz> MIME-Version: 1.0 X-Spamd-Bar: / Authentication-Results: jpoiret.xyz; auth=pass smtp.auth=jpoiret@jpoiret.xyz smtp.mailfrom=dev@jpoiret.xyz X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org Sender: "Guix-patches" Reply-to: Josselin Poiret X-ACL-Warn: , Josselin Poiret via Guix-patches X-Patchwork-Original-From: Josselin Poiret via Guix-patches via From: Josselin Poiret X-getmail-retrieved-from-mailbox: Patches * gnu/bootloader/grub.scm (grub-configuration-file): Add 'insmod luks2'. * gnu/system/mapped-devices.scm (open-luks-device): Create '/run/cryptsetup/' directory. --- gnu/bootloader/grub.scm | 3 +-- 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 d8e888ff40..42f71aa4db 100644 --- a/gnu/bootloader/grub.scm +++ b/gnu/bootloader/grub.scm @@ -415,8 +415,7 @@ (define (crypto-device->cryptomount dev) ;; Other type of devices aren't implemented. #~())) (let ((devices (map crypto-device->cryptomount store-crypto-devices)) - ;; XXX: Add luks2 when grub 2.06 is packaged. - (modules #~(format port "insmod luks~%"))) + (modules #~(format port "insmod luks~%insmod luks2~%"))) (if (null? devices) devices (cons modules devices)))) diff --git a/gnu/system/mapped-devices.scm b/gnu/system/mapped-devices.scm index 518dbc4fe8..96a381d5fe 100644 --- a/gnu/system/mapped-devices.scm +++ b/gnu/system/mapped-devices.scm @@ -192,7 +192,8 @@ (define (open-luks-device source targets) "Return a gexp that maps SOURCE to TARGET as a LUKS device, using 'cryptsetup'." (with-imported-modules (source-module-closure - '((gnu build file-systems))) + '((gnu build file-systems) + (guix build utils))) ;; For mkdir-p (match targets ((target) #~(let ((source #$(if (uuid? source) @@ -201,7 +202,12 @@ (define (open-luks-device source targets) ;; XXX: 'use-modules' should be at the top level. (use-modules (rnrs bytevectors) ;bytevector? ((gnu build file-systems) - #:select (find-partition-by-luks-uuid))) + #:select (find-partition-by-luks-uuid)) + ((guix build utils) #:select (mkdir-p))) + + ;; Create '/run/cryptsetup/' if it does not exist, as device locking + ;; is mandatory for LUKS2. + (mkdir-p "/run/cryptsetup/") ;; Use 'cryptsetup-static', not 'cryptsetup', to avoid pulling the ;; whole world inside the initrd (for when we're in an initrd).