If failure action is set to "shell", user will need more debug info available in kdump kernel. Especially when serial console is not available, manually retrieve the log from journalctl is very useful for debugging kdump issue.
Else, we can still drop journalctl content to save memory assuming nothing will use it.
Kairui Song (2): dracut-module-install: Move systemd conf install code to a function Don't drop journalctl content if failure action is "shell"
dracut-module-setup.sh | 44 +++++++++++++++++++++++++----------------- 1 file changed, 26 insertions(+), 18 deletions(-)
No feature change.
Signed-off-by: Kairui Song kasong@redhat.com --- dracut-module-setup.sh | 42 ++++++++++++++++++++++++------------------ 1 file changed, 24 insertions(+), 18 deletions(-)
diff --git a/dracut-module-setup.sh b/dracut-module-setup.sh index fbbd21a..3c35aa2 100755 --- a/dracut-module-setup.sh +++ b/dracut-module-setup.sh @@ -787,6 +787,27 @@ kdump_install_random_seed() { bs=$poolsize count=1 2> /dev/null }
+kdump_install_systemd_conf() { + # Kdump turns out to require longer default systemd mount timeout + # than 1st kernel(90s by default), we use default 300s for kdump. + grep -r "^[[:space:]]*DefaultTimeoutStartSec=" ${initdir}/etc/systemd/system.conf* &>/dev/null + if [ $? -ne 0 ]; then + mkdir -p ${initdir}/etc/systemd/system.conf.d + echo "[Manager]" > ${initdir}/etc/systemd/system.conf.d/kdump.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. + # Only do so for non fadump image. + 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 "ForwardToConsole=yes" >> ${initdir}/etc/systemd/journald.conf.d/kdump.conf + fi +} + install() { kdump_install_conf overwrite_sysctl_conf @@ -826,6 +847,8 @@ install() { # at some point of time. kdump_check_iscsi_targets
+ kdump_install_systemd_conf + # nfs/ssh dump will need to get host ip in second kernel and need to call 'ip' tool, see get_host_ip for more detail if is_nfs_dump_target || is_ssh_dump_target; then inst "ip" @@ -840,25 +863,8 @@ install() { 's/(^[[:space:]]*reserved_memory[[:space:]]*=)[[:space:]]*[[:digit:]]*/\1 1024/' \ ${initdir}/etc/lvm/lvm.conf &>/dev/null
- # Kdump turns out to require longer default systemd mount timeout - # than 1st kernel(90s by default), we use default 300s for kdump. - grep -r "^[[:space:]]*DefaultTimeoutStartSec=" ${initdir}/etc/systemd/system.conf* &>/dev/null - if [ $? -ne 0 ]; then - mkdir -p ${initdir}/etc/systemd/system.conf.d - echo "[Manager]" > ${initdir}/etc/systemd/system.conf.d/kdump.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. - # Only do so for non fadump image. + # Save more memory by dropping switch root capability 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 "ForwardToConsole=yes" >> ${initdir}/etc/systemd/journald.conf.d/kdump.conf - - # Save more memory by dropping switch root capability dracut_no_switch_root fi }
If failure action is set to "shell", user will need more debug info available in kdump kernel. Especially when serial console is not available, manually retrieve the log from journalctl is very useful for debugging kdump issue.
Else, we can still drop journalctl content to save memory assuming nothing will use it.
Signed-off-by: Kairui Song kasong@redhat.com --- dracut-module-setup.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/dracut-module-setup.sh b/dracut-module-setup.sh index 3c35aa2..a186570 100755 --- a/dracut-module-setup.sh +++ b/dracut-module-setup.sh @@ -788,6 +788,8 @@ kdump_install_random_seed() { }
kdump_install_systemd_conf() { + local failure_action=$(get_option_value "failure_action") + # Kdump turns out to require longer default systemd mount timeout # than 1st kernel(90s by default), we use default 300s for kdump. grep -r "^[[:space:]]*DefaultTimeoutStartSec=" ${initdir}/etc/systemd/system.conf* &>/dev/null @@ -800,7 +802,7 @@ kdump_install_systemd_conf() { # Forward logs to console directly, this avoids unneccessary memory # consumption and make console output more useful. # Only do so for non fadump image. - if ! is_fadump_capable; then + if ! is_fadump_capable && [ "$failure_action" != "shell" ]; 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
在 2020年08月11日 17:50, Kairui Song 写道:
If failure action is set to "shell", user will need more debug info available in kdump kernel. Especially when serial console is not available, manually retrieve the log from journalctl is very useful for debugging kdump issue.
Else, we can still drop journalctl content to save memory assuming nothing will use it.
Kairui Song (2): dracut-module-install: Move systemd conf install code to a function Don't drop journalctl content if failure action is "shell"
dracut-module-setup.sh | 44 +++++++++++++++++++++++++----------------- 1 file changed, 26 insertions(+), 18 deletions(-)
This series looks good to me. Thanks for the patches.
Acked-by: Lianbo Jiang lijiang@redhat.com