From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:50847) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eqgAn-0004jF-HI for guix-patches@gnu.org; Tue, 27 Feb 2018 09:24:06 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eqgAk-00010q-9m for guix-patches@gnu.org; Tue, 27 Feb 2018 09:24:05 -0500 Received: from debbugs.gnu.org ([208.118.235.43]:54921) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1eqgAk-00010k-66 for guix-patches@gnu.org; Tue, 27 Feb 2018 09:24:02 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1eqgAj-0003PB-TY for guix-patches@gnu.org; Tue, 27 Feb 2018 09:24:01 -0500 Subject: [bug#30629] [PATCH 0/5] Detect missing modules in the initrd References: <20180227141720.12513-1-ludo@gnu.org> In-Reply-To: <20180227141720.12513-1-ludo@gnu.org> Resent-Message-ID: From: Ludovic =?UTF-8?Q?Court=C3=A8s?= Date: Tue, 27 Feb 2018 15:22:40 +0100 Message-Id: <20180227142245.12674-1-ludo@gnu.org> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+kyle=kyleam.com@gnu.org Sender: "Guix-patches" To: 30629@debbugs.gnu.org Hello Guix! This patch series aims to allow ‘guix system init’ & co. to detect kernel modules that are missing from the initrd, which would typically render the system unbootable. To do that it adds code in (gnu build linux-modules) to determine the modules needed for a particular device: --8<---------------cut here---------------start------------->8--- $ sudo ./pre-inst-env guile GNU Guile 2.2.3 Copyright (C) 1995-2017 Free Software Foundation, Inc. Guile comes with ABSOLUTELY NO WARRANTY; for details type `,show w'. This program is free software, and you are welcome to redistribute it under certain conditions; type `,show c' for details. Enter `,help' for help. scheme@(guile-user)> ,use (gnu build linux-modules) scheme@(guile-user)> ,use (srfi srfi-1) scheme@(guile-user)> (append-map matching-modules (device-module-aliases "/dev/sda2")) $1 = ("ahci" "ahci") --8<---------------cut here---------------end--------------->8--- It then adds an ‘initrd-modules’ field to ‘operating-system’ as a way to expose the list of modules requested for the initrd. Finally, it augments ‘guix system’ to perform the necessary checks. It works, but with a few caveats: 1. ‘device-module-aliases’ returns the empty list for /dev/dm-0, which is a LUKS device on my laptop. I’m not sure what it would take to have it return “dm-crypt”, etc. Same for RAID devices. 2. Let’s assume you have: (initrd-modules '("a")). ‘guix system’ could report that module “b” is missing, even if “b” is actually a dependency of “a” and will therefore be automatically included in the initrd. I think that’s an acceptable limitation (fixing it is non-trivial since we’d ideally need to build the target kernel so we can inspect its modules and determine their closure.) You’re welcome to give it a try. In particular it’d be great if you could check that ‘device-module-aliases’ returns the right thing on your machine, as I shown in the example above. Note that, in addition to that, we could also have a tool to generate a template ‘operating-system’ declaration. Let’s say: guix system template desktop encrypted-root would generate a config based on the desktop config but with the right ‘initrd-modules’. Feedback & suggestions welcome! Ludo’. Ludovic Courtès (5): Add (guix glob). linux-modules: Add 'device-module-aliases' and related procedures. linux-initrd: Separate file system module logic. system: Add 'initrd-modules' field. guix system: Check for the lack of modules in the initrd. Makefile.am | 4 +- doc/guix.texi | 42 ++++++++--- gnu/build/linux-modules.scm | 161 +++++++++++++++++++++++++++++++++++++++++- gnu/system.scm | 8 +++ gnu/system/install.scm | 7 +- gnu/system/linux-initrd.scm | 94 ++++++++++++++---------- gnu/system/mapped-devices.scm | 53 ++++++++++---- gnu/tests/install.scm | 11 ++- guix/glob.scm | 97 +++++++++++++++++++++++++ guix/scripts/system.scm | 67 +++++++++++++++--- tests/glob.scm | 58 +++++++++++++++ 11 files changed, 519 insertions(+), 83 deletions(-) create mode 100644 guix/glob.scm create mode 100644 tests/glob.scm -- 2.16.2