From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp0 ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms0.migadu.com with LMTPS id wHVNMQHS3GAEWAEAgWs5BA (envelope-from ) for ; Wed, 30 Jun 2021 22:20:17 +0200 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp0 with LMTPS id aIH1LAHS3GChGAAA1q6Kng (envelope-from ) for ; Wed, 30 Jun 2021 20:20:17 +0000 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 4D5D31D348 for ; Wed, 30 Jun 2021 22:20:16 +0200 (CEST) Received: from localhost ([::1]:45440 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lyggw-0002Oa-Rt for larch@yhetil.org; Wed, 30 Jun 2021 16:20:14 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:41262) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lyggl-0002Nv-5w for guix-patches@gnu.org; Wed, 30 Jun 2021 16:20:03 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:47347) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lyggk-0007wD-UN for guix-patches@gnu.org; Wed, 30 Jun 2021 16:20:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1lyggk-0004H8-QC for guix-patches@gnu.org; Wed, 30 Jun 2021 16:20:02 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#49301] [PATCH 2/3] linux-boot: Honour fsck.mode & fsck.repair. Resent-From: Tobias Geerinckx-Rice Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Wed, 30 Jun 2021 20:20:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 49301 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 49301@debbugs.gnu.org Received: via spool by 49301-submit@debbugs.gnu.org id=B49301.162508439116387 (code B ref 49301); Wed, 30 Jun 2021 20:20:02 +0000 Received: (at 49301) by debbugs.gnu.org; 30 Jun 2021 20:19:51 +0000 Received: from localhost ([127.0.0.1]:58890 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lyggZ-0004GF-3h for submit@debbugs.gnu.org; Wed, 30 Jun 2021 16:19:51 -0400 Received: from tobias.gr ([80.241.217.52]:49468) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lyggV-0004Fr-KV for 49301@debbugs.gnu.org; Wed, 30 Jun 2021 16:19:48 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; s=2018; bh=l4cHhdsuxKAxy O970IdDcpg8NDgrOi1s9k5sAuq4SAE=; h=references:in-reply-to:date: subject:to:from; d=tobias.gr; b=hBSx5x2UeeK0C4AOhaj9csUZdAfT67X40RCQq9 PG9qaAtYMZHOtDNRBWIK4HWydJUNo6Do2TVN4O6tOv2E/HqtB1OGc43MgpGN80H4puRLod q9IMtvdA4iy5kUno8v9mYFu3aEPOX9pslLiatD2FwU7efw14AD0176Tl04FOHoljRCgKR4 C0qRWQAXetVptFrnq9wcbVt444m1wyDXm/PvAKqZ956leOx9567ZN0MMGZ4jXSHqyS+u1C 4/dEGsSF5O89hb2sdOhPHo15xj1PhjqFTuMqivxE9NxdAImpZCYWnbstjE/phfCn+S/f2v kmAL2drY+RZi3fP4rM37ZqLg== Received: by submission.tobias.gr (OpenSMTPD) with ESMTPSA id 661ca2db (TLSv1.3:AEAD-AES256-GCM-SHA384:256:NO) for <49301@debbugs.gnu.org>; Wed, 30 Jun 2021 20:19:43 +0000 (UTC) Date: Wed, 30 Jun 2021 22:20:17 +0200 Message-Id: <20210630202018.19124-2-me@tobias.gr> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210630202018.19124-1-me@tobias.gr> References: <20210630202018.19124-1-me@tobias.gr> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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+larch=yhetil.org@gnu.org Sender: "Guix-patches" Reply-to: Tobias Geerinckx-Rice X-ACL-Warn: , Tobias Geerinckx-Rice via Guix-patches From: Tobias Geerinckx-Rice via Guix-patches via X-Migadu-Flow: FLOW_IN ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1625084417; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding:resent-cc: resent-from:resent-sender:resent-message-id:in-reply-to:in-reply-to: references:references:list-id:list-help:list-unsubscribe: list-subscribe:list-post:dkim-signature; bh=l4cHhdsuxKAxyO970IdDcpg8NDgrOi1s9k5sAuq4SAE=; b=p6A1DfvidrBD+Rna3Mqbs1CqQHL22XayCGzuJIk4JCawtwmnv6PKwQhnQZTfLKpjpQztlQ UJEm+H//7kKJqxYXpVJM3DO/U8D4BlsMFGfXjTCpp61ihp8Qpci1z9XuAYtN2CiIHuw9Fh yAc6G8GUEm8VlGDqEVUj+tqVFISBt8n888vKUEpMcPDQdAWoK4mU4xCVoa9KNmlvGEqHDe ZoIr/rwGXzQoVAWr5fBHaUA3TMjAHRRPzJJfXj64ek9leN07rmMmPkfMHF+v8K+5cTgg/0 ++Weixt8NE+sVOohDz6+ewtV6JBTG6iizJoT5pfbVjCUtvDTYA+erVJooQK7wQ== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1625084417; a=rsa-sha256; cv=none; b=UokVEQcZnt4s34crpDgadp8GoZfX54XJr3DrCM4IYD9mxaEf4dNrwojkehWMmAiYudiw70 veu2nTNrb87560CKEkftibMTCHFWzHMb32iAyJGPMD2iInCL04L2WwpqBHN7ytoiqhWhx8 7TThs7z+0w2Oz5nMHV3XPWSiCZtBhQAK828JF+hyLoPb3q4c5CNGuiTSlz6DT8+AiypWHk IHCfRb3ogPlRbG1ep1fH5fvWkUo4Bc6EElQ9UpcyesSpweZkV49PtdJnoS+PpH9cMeCNaY 1sS34aywwraEPYjBDQuHfsk0Ihq7J5ZKKEq/PMzP0n6Rh7mOYK25spKJnebkgg== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=tobias.gr header.s=2018 header.b=hBSx5x2U; dmarc=pass (policy=none) header.from=gnu.org; spf=pass (aspmx1.migadu.com: domain of guix-patches-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=guix-patches-bounces@gnu.org X-Migadu-Spam-Score: -2.92 Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=tobias.gr header.s=2018 header.b=hBSx5x2U; dmarc=pass (policy=none) header.from=gnu.org; spf=pass (aspmx1.migadu.com: domain of guix-patches-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=guix-patches-bounces@gnu.org X-Migadu-Queue-Id: 4D5D31D348 X-Spam-Score: -2.92 X-Migadu-Scanner: scn1.migadu.com X-TUID: t4r3msb/6L+a * gnu/build/linux-boot.scm (boot-system): Honour ‘fsck.mode=’ and ‘fsck.repair=’ kernel command line options. * doc/guix.texi (Initial RAM Disk): Document both. --- doc/guix.texi | 19 ++++++++++++++++++ gnu/build/linux-boot.scm | 43 +++++++++++++++++++++++++++++----------- 2 files changed, 50 insertions(+), 12 deletions(-) diff --git a/doc/guix.texi b/doc/guix.texi index 9fb5709f4f..0d17830a66 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -32703,6 +32703,25 @@ name like @code{/dev/sda1}, a file system label, or a file system UUID. When unspecified, the device name from the root file system of the operating system declaration is used. +@item fsck.mode=@var{mode} +Whether to check the @var{root} file system for errors before mounting +it. @var{mode} is one of @code{skip} (never check), @code{force} (always +check), or @code{auto} to respect the root file-system object's 'check?' +setting (@pxref{File Systems}) and run a full scan only if the file system +was not cleanly shut down. + +@code{auto} is the default if this option is not present or if @var{mode} +is not one of the above. + +@item fsck.repair=@var{level} +The level of repairs to perform automatically if errors are found in the +@var{root} file system. @var{level} is one of @code{no} (do not write to +@var{root} at all if possible), @code{yes} (repair as much as possible), +or @code{preen} to repair problems considered safe to repair automatically. + +@code{preen} is the default if this option is not present or if @var{level} +is not one of the above. + @item --system=@var{system} Have @file{/run/booted-system} and @file{/run/current-system} point to @var{system}. diff --git a/gnu/build/linux-boot.scm b/gnu/build/linux-boot.scm index 325e26c29a..c54b3b9b5a 100644 --- a/gnu/build/linux-boot.scm +++ b/gnu/build/linux-boot.scm @@ -561,7 +561,31 @@ upon error." ;; record. (root-device (or (and=> (find-long-option "--root" args) device-string->file-system-device) - root-fs-device))) + root-fs-device)) + (fsck.mode (find-long-option "fsck.mode" args))) + + (define (check? fs) + (match fsck.mode + ("skip" #f) + ("force" #t) + ;; Handle #f because ROOT may be #f. + (_ (if fs (file-system-check? fs) #t)))) ; default mode is "auto" + + (define (skip-check-if-clean? fs) + (match fsck.mode + ("force" #f) + ;; Handle #f FS because ROOT may be #f. + (_ (and=> fs file-system-skip-check-if-clean?)))) + + (define (repair fs) + (let ((arg (find-long-option "fsck.repair" args))) + (if arg + (match arg + ("no" #f) + ("yes" #t) + (_ 'preen)) ; default ARG is "preen" + ;; Handle #f because ROOT may be #f. + (if fs (file-system-repair fs) 'preen)))) (when (member "--repl" args) (start-repl)) @@ -621,24 +645,19 @@ upon error." #:volatile-root? volatile-root? #:flags root-fs-flags #:options root-options - #:check? (if root-fs - (file-system-check? root-fs) - #t) + #:check? (check? root-fs) #:skip-check-if-clean? - (and=> root-fs - file-system-skip-check-if-clean?) - #:repair (if root-fs - (file-system-repair root-fs) - 'preen)) + (skip-check-if-clean? root-fs) + #:repair (repair root-fs)) (mount "none" "/root" "tmpfs")) ;; Mount the specified file systems. (for-each (lambda (fs) (mount-file-system fs - #:check? (file-system-check? fs) + #:check? (check? fs) #:skip-check-if-clean? - (file-system-skip-check-if-clean? fs) - #:repair (file-system-repair fs))) + (skip-check-if-clean? fs) + #:repair (repair fs))) (remove root-mount-point? mounts)) (setenv "EXT2FS_NO_MTAB_OK" #f) -- 2.32.0