Subject: Re: [bug#75808] [PATCH] gnu: system: Disable EFI pstore backend by default

From: Leo Famulari <[email-masked]>
Date: Tue, 28 Jan 2025 15:38:40 -0500

On Fri, Jan 24, 2025 at 06:01:54PM +0200, Roman Riabenko via Guix-patches via wrote:
> * gnu/system.scm (%default-kernel-arguments): Add efi_pstore.pstore_disable=1.

As discussed in the help-guix thread, here is a patch that makes this
change via the build-time configuration system rather than the run-time
command line.

https://lists.gnu.org/archive/html/help-guix/2025-01/msg00201.html
>From c55c77f0758bc35b2543987b8cf3d78af5282a56 Mon Sep 17 00:00:00 2001
Message-ID: <[email-masked]>
From: Roman Riabenko <[email-masked]>
Date: Tue, 28 Jan 2025 13:50:29 -0500
Subject: [PATCH] gnu: system: Disable EFI pstore backend by default

This commit disables one of the backends for the persistent storage driver
pstore in the Linux kernel, in particular the backend which allows it to save
data to EFI variables storage in UEFI NVRAM, such as error log "dump" files.

This reduces writes to UEFI to reduce the chances of it wearing out or
malfunctioning for other reasons, as well as prevents situations when the efivar
is full and cannot take new variables, which is known to cause "Could not
prepare Boot variable: No space left on device" errors on computers with some
UEFI implementations which are susceptible to such problems, typically on
relatively older machines. The user is confronted by the issue at the later
stages of guix system reconfiguration when the new boot entry is created. It may
be difficult to recover from because the exact cause depends on UEFI. Sometimes
it is enough to remove dumps from efivars. Disabling the EFI pstore backend is
expected to reduce the chances of unaware users running into issues with UEFI
and failing to boot their Guix Systems.

Sophisticated users may still enable the backend by changing the option via the
kernel arguments, either in the system configuration or in GRUB.

The above is my summary of what was previously discussed in guix-help mailing
list: <https://lists.gnu.org/archive/html/help-guix/2025-01/msg00173.html>.

* gnu/packages/linux.scm (default-extra-linux-options): Enable the kernel
build-time configuration option CONFIG_EFI_VARS_PSTORE_DEFAULT_DISABLE.

Change-Id: Id0294fa90ccbf3bacbb55a22aeb4f0a863efe22c
Co-authored-by: Leo Famulari <[email-masked]>
---
 gnu/packages/linux.scm | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/gnu/packages/linux.scm b/gnu/packages/linux.scm
index f236aefed5..ba735c4921 100644
--- a/gnu/packages/linux.scm
+++ b/gnu/packages/linux.scm
@@ -920,7 +920,11 @@ (define (default-extra-linux-options version)
     ("CONFIG_VIRTIO_MMIO" . m)
     ("CONFIG_FUSE_FS" . m)
     ("CONFIG_CIFS" . m)
-    ("CONFIG_9P_FS" . m)))
+    ("CONFIG_9P_FS" . m)
+    ;; Disable the EFI pstore storage backend to avoid causing
+    ;; unrecoverable failures on some EFI systems:
+    ;; https://lists.gnu.org/archive/html/help-guix/2025-01/msg00173.html
+    ("CONFIG_EFI_VARS_PSTORE_DEFAULT_DISABLE" . #t)))
 
 (define (config->string options)
   (string-join (map (match-lambda

base-commit: 97fb1887ad10000c067168176c504274e29e4430
prerequisite-patch-id: fb8199eb3a9afa9d787a86b2cf7f408992d7e9a1
prerequisite-patch-id: bfa219db9b8e6aa9a58d2f395dd6ef85ff5bc856
prerequisite-patch-id: f9e40dd45ac4ce149a5d41317488a2485514e8ad
-- 
2.47.1