Subject: [PATCH] [PATCH] gnu: system: Disable EFI pstore backend by default

From: Roman Riabenko <[email-masked]>
Date: Fri, 24 Jan 2025 18:01:54 +0200

* gnu/system.scm (%default-kernel-arguments): Add efi_pstore.pstore_disable=1.

Change-Id: Id0294fa90ccbf3bacbb55a22aeb4f0a863efe22c
---

This patch 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 removing the option from 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>.

Disclosure: I have ran into this issue recently. I am a guix user who researched
the topic but not a developer.

To be sure, I reconfigured the system with this patch and it worked as expected
by adding the kernel argument.

 gnu/system.scm | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/gnu/system.scm b/gnu/system.scm
index 8df871f255..5785cfdd9a 100644
--- a/gnu/system.scm
+++ b/gnu/system.scm
@@ -761,6 +761,9 @@ (define %default-kernel-arguments
   ;; Default arguments passed to the kernel.
   (list (string-append "modprobe.blacklist="
                        (string-join %default-modprobe-blacklist ","))
+        ;; Avoiding susceptible UEFIs failures from efivars used for pstore, see
+        ;; <https://lists.gnu.org/archive/html/help-guix/2025-01/msg00173.html>.
+        "efi_pstore.pstore_disable=1"
         "quiet"))
 
 (define* (operating-system-directory-base-entries os)

base-commit: 13367c6c47f5a4962dde6fab480ea14cd0ac536c
-- 
2.47.1