ryantimwilson / rpms / systemd

Forked from rpms/systemd 2 months ago
Clone
5808e7
From 9cc6ee46e0083bc36b53d19e14fb637f7a1542dd Mon Sep 17 00:00:00 2001
5808e7
From: Alexander Graf <graf@amazon.com>
5808e7
Date: Thu, 9 Jun 2022 16:20:43 +0200
5808e7
Subject: [PATCH] pstore: Run after modules are loaded
5808e7
5808e7
The systemd-pstore service takes pstore files on boot and transfers them
5808e7
to disk. It only does it once on boot and only if it finds any. The typical
5808e7
location of the pstore on modern systems is the UEFI variable store.
5808e7
5808e7
Most distributions ship with CONFIG_EFI_VARS_PSTORE=m. That means, the
5808e7
UEFI variable store is only available on boot after the respective module
5808e7
is loaded.
5808e7
5808e7
In most situations, the pstore service gets loaded before the UEFI pstore,
5808e7
so we don't get to transfer logs. Instead, they accumulate, filling up the
5808e7
pstore over time, potentially breaking the UEFI variable store.
5808e7
5808e7
Let's add a service dependency on any kernel module that can provide a
5808e7
pstore to ensure we only scan for pstate after we can actually see pstate.
5808e7
5808e7
I have seen live occurences of systems breaking because we did not erase
5808e7
the pstates and ran out of UEFI nvram space.
5808e7
5808e7
Fixes https://github.com/systemd/systemd/issues/18540
5808e7
5808e7
(cherry picked from commit 70e74a5997ae2ce7ba72a74ac949c3b2dad1a1d6)
5808e7
5808e7
Related: #2158832
5808e7
---
5808e7
 units/systemd-pstore.service.in | 2 ++
5808e7
 1 file changed, 2 insertions(+)
5808e7
5808e7
diff --git a/units/systemd-pstore.service.in b/units/systemd-pstore.service.in
5808e7
index 8cbf264a99..1983a9738f 100644
5808e7
--- a/units/systemd-pstore.service.in
5808e7
+++ b/units/systemd-pstore.service.in
5808e7
@@ -16,6 +16,8 @@ DefaultDependencies=no
5808e7
 After=systemd-remount-fs.service
5808e7
 Conflicts=shutdown.target
5808e7
 Before=sysinit.target shutdown.target
5808e7
+After=modprobe@efi_pstore.service modprobe@mtdpstore.service modprobe@chromeos_pstore.service modprobe@ramoops.service modprobe@pstore_zone.service modprobe@pstore_blk.service
5808e7
+Wants=modprobe@efi_pstore.service modprobe@mtdpstore.service modprobe@chromeos_pstore.service modprobe@ramoops.service modprobe@pstore_zone.service modprobe@pstore_blk.service
5808e7
 
5808e7
 [Service]
5808e7
 Type=oneshot