linux/common-config: EFI_VARS_PSTORE=y

This enables the kernel to save crash logs much earlier, rather than
losing any log from before the efi_pstore module is loaded in stage 2.
This commit is contained in:
Will Fancher
2026-03-06 21:09:51 -05:00
parent 3d83292d39
commit 14ea6786cd
3 changed files with 28 additions and 1 deletions

View File

@@ -1,14 +1,39 @@
{
name = "systemd-pstore";
nodes.machine = { };
nodes.machine = {
virtualisation.useEFIBoot = true;
boot.initrd.systemd.enable = true;
testing.initrdBackdoor = true;
};
testScript = ''
machine.switch_root()
with subtest("pstore API fs is mounted"):
machine.succeed("stat /sys/fs/pstore")
with subtest("systemd-pstore.service doesn't run because nothing crashed"):
output = machine.execute("systemctl status systemd-pstore.service", check_return=False)[1]
t.assertIn("condition unmet", output)
machine.fail("stat /var/lib/systemd/pstore/*/*/dmesg.txt")
with subtest("systemd-pstore.service saves dmesg.txt files"):
machine.execute("echo c > /proc/sysrq-trigger", check_return=False, check_output=False)
machine.wait_for_shutdown()
machine.switch_root()
machine.wait_for_unit("systemd-pstore.service")
machine.succeed("stat /var/lib/systemd/pstore/*/*/dmesg.txt")
with subtest("crashes in initrd can be recovered too"):
machine.succeed(
"rm -r /var/lib/systemd/pstore/*",
"sync",
)
machine.shutdown()
machine.execute("echo c > /proc/sysrq-trigger", check_return=False, check_output=False)
machine.wait_for_shutdown()
machine.switch_root()
machine.wait_for_unit("systemd-pstore.service")
machine.succeed("stat /var/lib/systemd/pstore/*/*/dmesg.txt")
'';
}

View File

@@ -1224,6 +1224,7 @@ let
EFI = lib.mkIf stdenv.hostPlatform.isEfi yes;
EFI_STUB = yes; # EFI bootloader in the bzImage itself
EFI_GENERIC_STUB_INITRD_CMDLINE_LOADER = whenOlder "6.2" yes; # initrd kernel parameter for EFI
EFI_VARS_PSTORE = yes;
# Generic compression support for EFI payloads
# Add new platforms only after they have been verified to build and boot.

View File

@@ -930,6 +930,7 @@ stdenv.mkDerivation (finalAttrs: {
systemd-nspawn-configfile
systemd-oomd
systemd-portabled
systemd-pstore
systemd-resolved
systemd-shutdown
systemd-sysupdate