On Debian the /usr/lib/tmpfiles.d/systemd-pstore.conf
file can modified to enable pstore log saving on panic and shutdown.
w- /sys/module/printk/parameters/always_kmsg_dump - - - - Y
w- /sys/module/kernel/parameters/crash_kexec_post_notifiers - - - - Y
The systemd-pstore service is already configured to read from /sys/fs/pstore
on the next boot and add these log fragment to the journal log and directly copy to /var/lib/systemd/pstore/
.
- https://manpages.debian.org/testing/systemd/systemd-pstore.service.8.en.html
- https://manpages.debian.org/testing/systemd/pstore.conf.5.en.html
Note: I have seen some inconsistencies in both sides of this mechanism. After a clean shutdown, the systemd-pstore service usually always reports the /sys/fs/pstore dir is empty. Also, the logs captured by pstore don't seem to be fully appended/merged with the journal log.