From 46cc7f46b2840399fe653049c4893f16285f7c81 Mon Sep 17 00:00:00 2001 From: Kairui Song Date: Tue, 27 Oct 2020 15:00:45 +0800 Subject: [PATCH] module-setup.sh: Instead of drop journalctl log, just don't read kmsg Previously journalctl logs are directly dropped to save memory, but this make journalctl unusable in kdump kernel and diffcult to debug. So instead just don't let it read kmsg but keep other logs stored as volatile. Kernel message are already stored in the kernel log ring buffer, no need to let journalctl make a copy, especially when in kdump kernel, ususlly there won't be too much kernel log overlapping the old ring buffer. Signed-off-by: Kairui Song Acked-by: Lianbo Jiang --- dracut-module-setup.sh | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/dracut-module-setup.sh b/dracut-module-setup.sh index b0b30af..911a8b8 100755 --- a/dracut-module-setup.sh +++ b/dracut-module-setup.sh @@ -799,13 +799,14 @@ kdump_install_systemd_conf() { echo "DefaultTimeoutStartSec=300s" >> ${initdir}/etc/systemd/system.conf.d/kdump.conf fi - # Forward logs to console directly, this avoids unneccessary memory - # consumption and make console output more useful. + # Forward logs to console directly, and don't read Kmsg, this avoids + # unneccessary memory consumption and make console output more useful. # Only do so for non fadump image. - if ! is_fadump_capable && [ "$failure_action" != "shell" ]; then + if ! is_fadump_capable; then mkdir -p ${initdir}/etc/systemd/journald.conf.d echo "[Journal]" > ${initdir}/etc/systemd/journald.conf.d/kdump.conf - echo "Storage=none" >> ${initdir}/etc/systemd/journald.conf.d/kdump.conf + echo "Storage=volatile" >> ${initdir}/etc/systemd/journald.conf.d/kdump.conf + echo "ReadKMsg=no" >> ${initdir}/etc/systemd/journald.conf.d/kdump.conf echo "ForwardToConsole=yes" >> ${initdir}/etc/systemd/journald.conf.d/kdump.conf fi }