diff --git a/00-default.conf b/00-default.conf index 8a87595..ea4569b 100644 --- a/00-default.conf +++ b/00-default.conf @@ -7,7 +7,7 @@ # # Configuration settings for kdump/pstore. After _any_ change in this # file, it's required to re-create the kdump minimal initramfs by running: -# /usr/lib/kdump/kdump-load.sh create-initrd +# /usr/lib/kdumpst/kdumpst-load.sh create-initrd # # # Pstore-RAM settings @@ -27,7 +27,7 @@ PSTORE_RECORD_SZ=1048576 # be stored, as well as the kdump initrd and some ancillary data. This # directory should be in an accessible filesystem (read/write) and if such # folder doesn't exist, it'll be created. -MOUNT_FOLDER="/var/crash/kdump" +MOUNT_FOLDER="/var/crash/kdumpst" # # # Kdump controlling settings @@ -48,7 +48,7 @@ KDUMP_APPEND_CMDLINE="panic=-1 oops=panic fsck.mode=force fsck.repair=yes nr_cpu # # # GRUB-related settings -# GRUB_AUTOSET determines if the pstore/kdump tooling should try to +# GRUB_AUTOSET determines if the kdumpst loader tool should try to # automatically set grub.cfg in order to reserve memory for kdump (if # needed, i.e., when pstore is not in use) - keep it as '1' for enabling # the mechanism (this is the default). GRUB_BOOT_FILE is the full path of diff --git a/20-panic-sysctls.conf b/20-panic-sysctls.conf index 0d2c0b5..45ef96c 100644 --- a/20-panic-sysctls.conf +++ b/20-panic-sysctls.conf @@ -4,8 +4,8 @@ # Maintainer: Guilherme G. Piccoli # # This file sets the sysctl parameters that are used by the -# kdump package, in order to panic and reboot on severe events, -# like oops or hard lockups. +# kdumpst package, in order to panic and reboot on severe +# events, like oops or hard lockups. # We also set panic_print in order to collect more info. kernel.panic_on_oops = 1 diff --git a/Makefile b/Makefile index 5b22b4a..d03f1d7 100644 --- a/Makefile +++ b/Makefile @@ -10,7 +10,7 @@ sysctldir := $(shell pkg-config --define-variable=prefix=$(prefix) --variable=sy || echo $(libdir)/sysctl.d/) alpmhooksdir := $(shell echo $(sharedir)/libalpm/hooks/) -kdump-load.sh: kdump-load.header common.sh kdump-load.sh.in +kdumpst-load.sh: kdumpst-load.header common.sh kdumpst-load.sh.in cat $^ > $@ save-dumps.sh: save-dumps.header common.sh save-dumps.sh.in @@ -53,28 +53,28 @@ kdump.install: initramfs/initcpio/kdump.install.header common.sh initramfs/initc .PHONY: mkinitcpio mkinitcpio: 99-kdump-mkinitcpio.hook 99-kdump-mkinitcpio-git.hook kdump-mkinitcpio-hook.sh kdump.hook kdump.install -all: kdump-load.sh save-dumps.sh dracut mkinitcpio +all: kdumpst-load.sh save-dumps.sh dracut mkinitcpio install: all - install -D -m0644 kdump-init.service $(DESTDIR)$(systemdunitsdir)/kdump-init.service + install -D -m0644 kdumpst-init.service $(DESTDIR)$(systemdunitsdir)/kdumpst-init.service install -D -m0644 20-panic-sysctls.conf $(DESTDIR)$(sysctldir)/20-panic-sysctls.conf - install -D -m0644 README.md $(DESTDIR)$(libdir)/kdump/README.md - install -D -m0755 kdump-load.sh $(DESTDIR)$(libdir)/kdump/kdump-load.sh - install -D -m0755 save-dumps.sh $(DESTDIR)$(libdir)/kdump/save-dumps.sh - install -D -m0644 00-default.conf $(DESTDIR)$(sharedir)/kdump.d/00-default + install -D -m0644 README.md $(DESTDIR)$(libdir)/kdumpst/README.md + install -D -m0755 kdumpst-load.sh $(DESTDIR)$(libdir)/kdumpst/kdumpst-load.sh + install -D -m0755 save-dumps.sh $(DESTDIR)$(libdir)/kdumpst/save-dumps.sh + install -D -m0644 00-default.conf $(DESTDIR)$(sharedir)/kdumpst.d/00-default install -D -m0644 initramfs/99-kdump-dracut.hook $(DESTDIR)$(alpmhooksdir)/99-kdump-dracut.hook install -D -m0644 initramfs/99-kdump-mkinitcpio.hook $(DESTDIR)$(alpmhooksdir)/99-kdump-mkinitcpio.hook install -D -m0644 initramfs/99-kdump-mkinitcpio-git.hook $(DESTDIR)$(alpmhooksdir)/99-kdump-mkinitcpio-git.hook - install -D -m0755 initramfs/dracut/kdump-dracut-hook.sh $(DESTDIR)$(libdir)/kdump/kdump-dracut-hook.sh - install -D -m0755 initramfs/kdump-collect.sh $(DESTDIR)$(libdir)/kdump/dracut/kdump-collect.sh - install -D -m0755 initramfs/dracut/module-setup.sh $(DESTDIR)$(libdir)/kdump/dracut/module-setup.sh - install -D -m0755 initramfs/initcpio/kdump-mkinitcpio-hook.sh $(DESTDIR)$(libdir)/kdump/kdump-mkinitcpio-hook.sh - install -D -m0755 initramfs/initcpio/kdump-mkinitcpio-hook.sh $(DESTDIR)$(libdir)/kdump/kdump-mkinitcpio-git-hook.sh - install -D -m0644 initramfs/initcpio/kdump.hook $(DESTDIR)$(libdir)/kdump/initcpio/kdump.hook - install -D -m0644 initramfs/initcpio/kdump.install $(DESTDIR)$(libdir)/kdump/initcpio/kdump.install + install -D -m0755 initramfs/dracut/kdump-dracut-hook.sh $(DESTDIR)$(libdir)/kdumpst/kdump-dracut-hook.sh + install -D -m0755 initramfs/kdump-collect.sh $(DESTDIR)$(libdir)/kdumpst/dracut/kdump-collect.sh + install -D -m0755 initramfs/dracut/module-setup.sh $(DESTDIR)$(libdir)/kdumpst/dracut/module-setup.sh + install -D -m0755 initramfs/initcpio/kdump-mkinitcpio-hook.sh $(DESTDIR)$(libdir)/kdumpst/kdump-mkinitcpio-hook.sh + install -D -m0755 initramfs/initcpio/kdump-mkinitcpio-hook.sh $(DESTDIR)$(libdir)/kdumpst/kdump-mkinitcpio-git-hook.sh + install -D -m0644 initramfs/initcpio/kdump.hook $(DESTDIR)$(libdir)/kdumpst/initcpio/kdump.hook + install -D -m0644 initramfs/initcpio/kdump.install $(DESTDIR)$(libdir)/kdumpst/initcpio/kdump.install clean: - rm -f kdump-load.sh save-dumps.sh + rm -f kdumpst-load.sh save-dumps.sh rm -f initramfs/99-kdump-* rm -f initramfs/dracut/{kdump-dracut-hook.sh,module-setup.sh} rm -f initramfs/initcpio/kdump{-mkinitcpio-hook.sh,.hook,.install} diff --git a/common.sh b/common.sh index 6e378b4..b715b33 100644 --- a/common.sh +++ b/common.sh @@ -2,10 +2,10 @@ # This function has the purpose of loading the necessary external # variables, in the form of one (or more) configuration file(s). If the # procedure fails, we must abort - otherwise it'll fail in a later stage. -load_kdump_config() { +load_kdumpst_config() { HAVE_CFG_FILES=0 shopt -s nullglob - for cfg in "/usr/share/kdump.d"/*; do + for cfg in "/usr/share/kdumpst.d"/*; do if [ -f "$cfg" ]; then . "$cfg" HAVE_CFG_FILES=1 @@ -14,7 +14,7 @@ load_kdump_config() { shopt -u nullglob if [ ${HAVE_CFG_FILES} -eq 0 ]; then - logger "kdump: no config files in /usr/share/kdump.d/ - aborting." + logger "kdumpst: no config files in /usr/share/kdumpst.d/ - aborting." exit 1 fi } diff --git a/initramfs/alpm-hook.generic b/initramfs/alpm-hook.generic index e2a8216..11e53e3 100644 --- a/initramfs/alpm-hook.generic +++ b/initramfs/alpm-hook.generic @@ -23,5 +23,5 @@ Target = INITRD Description = Managing kdump minimal initramfs and INITRD hooks... Depends=INITRD When = PostTransaction -Exec = /usr/lib/kdump/kdump-INITRD-hook.sh +Exec = /usr/lib/kdumpst/kdump-INITRD-hook.sh NeedsTargets diff --git a/initramfs/alpm-script.header b/initramfs/alpm-script.header index c68c337..6cdffc0 100644 --- a/initramfs/alpm-script.header +++ b/initramfs/alpm-script.header @@ -7,7 +7,7 @@ set -eo pipefail # exclude -u on purpose to avoid issues with param checking # Maintainer: Guilherme G. Piccoli # # This is the generic alpm-hook script that handles kernel/package -# installation for INITRD users, on behalf of kdump. Covers both manual +# installation for INITRD users, on behalf of kdumpst. Covers both manual # invocation (to create the initramfs image for a given kernel) as # well as kernel package installation/removal trigger. It also handles # the event of installing the package INITRD, which requires the diff --git a/initramfs/alpm-script.sh.in b/initramfs/alpm-script.sh.in index b27af77..36cf647 100644 --- a/initramfs/alpm-script.sh.in +++ b/initramfs/alpm-script.sh.in @@ -1,4 +1,4 @@ -load_kdump_config +load_kdumpst_config # General comment of a caveat here: INITRD_installation() must be # reentrant and only install the INITRD handlers if they're not diff --git a/initramfs/dracut/dracut-common.sh b/initramfs/dracut/dracut-common.sh index 03996d5..960009b 100644 --- a/initramfs/dracut/dracut-common.sh +++ b/initramfs/dracut/dracut-common.sh @@ -2,7 +2,7 @@ # the initramfs for dracut users, but also with regards to # installing dracut specific hooks/scripts. # -# IMPORTANT: it is assumed that kdump configuration was loaded +# IMPORTANT: it is assumed that kdumpst configuration was loaded # before running any of these functions! # create_initramfs_dracut() { @@ -22,12 +22,12 @@ create_initramfs_dracut() { --kver "$1" "${MOUNT_FOLDER}/kdump-initrd-$1.img" if [ -s "${MOUNT_FOLDER}/kdump-initrd-$1.img" ]; then - logger "kdump: created dracut minimal initramfs" + logger "kdumpst: created dracut minimal initramfs" fi } dracut_installation() { - HOOKS_DIR="/usr/lib/kdump/dracut/" + HOOKS_DIR="/usr/lib/kdumpst/dracut/" DRACUT_DIR="$(pkg-config --variable=dracutmodulesdir dracut 2>/dev/null)" if [ -z "${DRACUT_DIR}" ]; then @@ -37,7 +37,7 @@ dracut_installation() { if [ ! -d "${DRACUT_DIR}"/55kdump/ ]; then install -D -m0755 "${HOOKS_DIR}"/kdump-collect.sh "${DRACUT_DIR}"/55kdump/kdump-collect.sh install -D -m0755 "${HOOKS_DIR}"/module-setup.sh "${DRACUT_DIR}"/55kdump/module-setup.sh - logger "kdump: dracut hooks/scripts installed" + logger "kdumpst: dracut hooks/scripts installed" fi } diff --git a/initramfs/dracut/module-setup.header b/initramfs/dracut/module-setup.header index bfc5c28..89222af 100644 --- a/initramfs/dracut/module-setup.header +++ b/initramfs/dracut/module-setup.header @@ -6,5 +6,5 @@ # Maintainer: Guilherme G. Piccoli # # Kdump-initrd module construction/inclusion script for -# Dracut-based initramfs. +# Dracut-based initramfs - part of the kdumpst tooling. # diff --git a/initramfs/dracut/module-setup.sh.in b/initramfs/dracut/module-setup.sh.in index ed7c78f..74261e0 100644 --- a/initramfs/dracut/module-setup.sh.in +++ b/initramfs/dracut/module-setup.sh.in @@ -4,7 +4,7 @@ check() { } installkernel() { - load_kdump_config + load_kdumpst_config # First clear all unnecessary firmwares/drivers added by drm in order # to reduce the size of the minimal initramfs being created - kdump @@ -16,7 +16,7 @@ installkernel() { FSMOD="$(findmnt -n -o FSTYPE --target "${MOUNT_FOLDER}")" if [ -z "${FSMOD}" ]; then - logger "kdump: error on filesystem discovery" + logger "kdumpst: error on filesystem discovery" exit 1 fi @@ -39,38 +39,38 @@ installkernel() { install() { # A valid makedumpfile is essential for the kdump initrd creation. if ! command -v makedumpfile 1>/dev/null; then - logger "kdump: failed to create dracut initrd, makedumpfile is missing" + logger "kdumpst: failed to create dracut initrd, makedumpfile is missing" exit 1 fi - load_kdump_config + load_kdumpst_config # Install necessary binaries inst date inst sync inst makedumpfile - # Copying kdump config/lib files is essential for a functional kdump. - cp -LR --preserve=all /usr/share/kdump.d/ "$initdir"/usr/share/ - cp -LR --preserve=all /usr/lib/kdump/ "$initdir"/usr/lib/ + # Copying kdumpst config/lib files is essential for a functional kdump. + cp -LR --preserve=all /usr/share/kdumpst.d/ "$initdir"/usr/share/ + cp -LR --preserve=all /usr/lib/kdumpst/ "$initdir"/usr/lib/ # Finally, we need to derive the proper place to save the dump from the # config files, in a way that makes possible to mount it in early boot. DEVNODE="$(findmnt -n -o SOURCE --target "${MOUNT_FOLDER}")" if [ -z "${DEVNODE}" ]; then - logger "kdump: error on devnode discovery" + logger "kdumpst: error on devnode discovery" exit 1 fi - echo "${DEVNODE}" > "$initdir"/usr/lib/kdump/kdump.mnt + echo "${DEVNODE}" > "$initdir"/usr/lib/kdumpst/kdump.mnt TGT="$(findmnt -n -o TARGET --target "${MOUNT_FOLDER}")" if [ -z "${TGT}" ]; then - logger "kdump: error on base folder discovery" + logger "kdumpst: error on base folder discovery" exit 1 fi BASE_FLD="${MOUNT_FOLDER#*$TGT}" - echo "${BASE_FLD}" > "$initdir"/usr/lib/kdump/kdump.dir + echo "${BASE_FLD}" > "$initdir"/usr/lib/kdumpst/kdump.dir inst_hook pre-mount 01 "$moddir/kdump-collect.sh" } diff --git a/initramfs/initcpio/initcpio-common.sh b/initramfs/initcpio/initcpio-common.sh index 20dac4d..cb87c7b 100644 --- a/initramfs/initcpio/initcpio-common.sh +++ b/initramfs/initcpio/initcpio-common.sh @@ -2,7 +2,7 @@ # the initramfs for mkinitcpio users, but also with regards to # installing its specific hooks. # -# IMPORTANT: it is assumed that kdump configuration was loaded +# IMPORTANT: it is assumed that kdumpst configuration was loaded # before running any of these functions! # create_initramfs_mkinitcpio() { @@ -11,19 +11,19 @@ create_initramfs_mkinitcpio() { mkinitcpio -A kdump -g "${MOUNT_FOLDER}/kdump-initrd-$1.img" "$1" 1>/dev/null if [ -s "${MOUNT_FOLDER}/kdump-initrd-$1.img" ]; then - logger "kdump: created initcpio minimal initramfs" + logger "kdumpst: created initcpio minimal initramfs" fi } mkinitcpio_installation() { - KDUMP_HOOKS_DIR="/usr/lib/kdump/initcpio/" + KDUMP_HOOKS_DIR="/usr/lib/kdumpst/initcpio/" INITCPIO_HOOKS="/usr/lib/initcpio/hooks" INITCPIO_INST="/usr/lib/initcpio/install" if [ ! -e "${INITCPIO_HOOKS}"/kdump ] || [ ! -e "${INITCPIO_INST}"/kdump ]; then install -D -m0644 "${KDUMP_HOOKS_DIR}"/kdump.hook "${INITCPIO_HOOKS}"/kdump install -D -m0644 "${KDUMP_HOOKS_DIR}"/kdump.install "${INITCPIO_INST}"/kdump - logger "kdump: initcpio hooks installed" + logger "kdumpst: initcpio hooks installed" fi } diff --git a/initramfs/initcpio/kdump.install.header b/initramfs/initcpio/kdump.install.header index 983d8a7..330b4a6 100644 --- a/initramfs/initcpio/kdump.install.header +++ b/initramfs/initcpio/kdump.install.header @@ -5,5 +5,5 @@ # Maintainer: Guilherme G. Piccoli # # Kdump-initrd module construction/inclusion script for -# initcpio-based initramfs. +# initcpio-based initramfs - part of the kdumpst tooling. # diff --git a/initramfs/initcpio/kdump.install.in b/initramfs/initcpio/kdump.install.in index 7fcb181..950125e 100644 --- a/initramfs/initcpio/kdump.install.in +++ b/initramfs/initcpio/kdump.install.in @@ -1,9 +1,9 @@ build() { - load_kdump_config + load_kdumpst_config # A valid makedumpfile is essential for the kdump initrd creation. if ! command -v makedumpfile 1>/dev/null; then - logger "kdump: failed to create minimal initrd, makedumpfile is missing" + logger "kdumpst: failed to create minimal initrd, makedumpfile is missing" exit 1 fi @@ -12,26 +12,26 @@ build() { add_binary "$(command -v makedumpfile)" # Copying kdump config/lib files is essential for a functional kdump. - add_full_dir /usr/share/kdump.d/ - add_full_dir /usr/lib/kdump/ + add_full_dir /usr/share/kdumpst.d/ + add_full_dir /usr/lib/kdumpst/ # We need to derive the proper place to save the dump from the # config files, in a way that makes possible to mount it in early boot. DEVNODE="$(findmnt -n -o SOURCE --target "${MOUNT_FOLDER}")" if [ -z "${DEVNODE}" ]; then - logger "kdump: error on devnode discovery" + logger "kdumpst: error on devnode discovery" exit 1 fi - echo "${DEVNODE}" > "${BUILDROOT}"/usr/lib/kdump/kdump.mnt + echo "${DEVNODE}" > "${BUILDROOT}"/usr/lib/kdumpst/kdump.mnt TGT="$(findmnt -n -o TARGET --target "${MOUNT_FOLDER}")" if [ -z "${TGT}" ]; then - logger "kdump: error on base folder discovery" + logger "kdumpst: error on base folder discovery" exit 1 fi BASE_FLD="${MOUNT_FOLDER#*$TGT}" - echo "${BASE_FLD}" > "${BUILDROOT}"/usr/lib/kdump/kdump.dir + echo "${BASE_FLD}" > "${BUILDROOT}"/usr/lib/kdumpst/kdump.dir # Finally, we shouldn't have DRM/GPU drivers and firmwares here, # but...just in case, let's remove all of that nevertheless. @@ -44,7 +44,7 @@ build() { help() { cat < # # Script for effectively collecting the core dump/dmesg from -# within a minimal initrd - part of the kdump/pstore tooling. +# within a minimal initrd - part of the kdumpst tooling. # The most fail-prone operations are guarded with conditionals to # bail in case we indeed fail - worst thing here would be to have # a bad condition and get stuck in this minimal initrd with no @@ -26,13 +26,13 @@ # files here, since we manually added them in the initrd and # the validation also happened there, during such addition, # hence not requiring checks here. - for cfg in "/usr/share/kdump.d"/*; do + for cfg in "/usr/share/kdumpst.d"/*; do . "$cfg" done KDUMP_TIMESTAMP=$(date -u +"%Y%m%d%H%M") - MOUNT_POINT="$(cat /usr/lib/kdump/kdump.mnt)" - BASE_FOLDER="$(cat /usr/lib/kdump/kdump.dir)" + MOUNT_POINT="$(cat /usr/lib/kdumpst/kdump.mnt)" + BASE_FOLDER="$(cat /usr/lib/kdumpst/kdump.dir)" KDUMP_FOLDER="/kdump_path/${BASE_FOLDER}/crash/${KDUMP_TIMESTAMP}" # Check if the device node exists - or else, just bails-out. diff --git a/kdump-init.service b/kdumpst-init.service similarity index 63% rename from kdump-init.service rename to kdumpst-init.service index c8f84ac..2eed56d 100644 --- a/kdump-init.service +++ b/kdumpst-init.service @@ -5,13 +5,13 @@ # [Unit] -Description=pstore/kdump loader boot-time service +Description=kdumpst loader boot-time service [Service] Type=oneshot StandardOutput=journal -ExecStartPre=/usr/lib/kdump/kdump-load.sh load -ExecStart=/usr/lib/kdump/save-dumps.sh +ExecStartPre=/usr/lib/kdumpst/kdumpst-load.sh load +ExecStart=/usr/lib/kdumpst/save-dumps.sh RemainAfterExit=yes [Install] diff --git a/kdump-load.header b/kdumpst-load.header similarity index 100% rename from kdump-load.header rename to kdumpst-load.header diff --git a/kdump-load.sh.in b/kdumpst-load.sh.in similarity index 87% rename from kdump-load.sh.in rename to kdumpst-load.sh.in index 67896d0..cec33c6 100644 --- a/kdump-load.sh.in +++ b/kdumpst-load.sh.in @@ -15,13 +15,13 @@ grub_update() { sed -i "${SED_ADD}" "${GRUB_CFG_FILE}" if ! grub-mkconfig -o "${GRUB_BOOT_FILE}" 1>/dev/null; then - logger "kdump: failed to execute command \"${GRUB_CMD}\"" + logger "kdumpst: failed to execute command \"${GRUB_CMD}\"" exit 1 fi sync "${GRUB_BOOT_FILE}" 2>/dev/null - logger "kdump: kexec won't succeed, no reserved memory in this boot..." - logger "kdump: but we automatically set crashkernel for next boot." + logger "kdumpst: kexec won't succeed, no reserved memory in this boot..." + logger "kdumpst: but we automatically set crashkernel for next boot." exit 0 # this is considered a successful run fi @@ -29,12 +29,12 @@ grub_update() { sed -i "s/\"${GRUB_CMDLINE}/\"/g" "${GRUB_CFG_FILE}" if ! grub-mkconfig -o "${GRUB_BOOT_FILE}" 1>/dev/null; then - logger "kdump: failed to execute command \"${GRUB_CMD}\"" + logger "kdumpst: failed to execute command \"${GRUB_CMD}\"" exit 1 fi sync "${GRUB_BOOT_FILE}" 2>/dev/null - logger "kdump: cleared crashkernel memory previously set." + logger "kdumpst: cleared crashkernel memory previously set." fi fi } @@ -43,8 +43,8 @@ grub_update() { # via command-line call or in case initrd doesn't exist during kdump load. # It accounts for both mkinitcpio and dracut users. create_initrd() { - /usr/lib/kdump/kdump-mkinitcpio-hook.sh "$(uname -r)" - /usr/lib/kdump/kdump-dracut-hook.sh "$(uname -r)" + /usr/lib/kdumpst/kdump-mkinitcpio-hook.sh "$(uname -r)" + /usr/lib/kdumpst/kdump-dracut-hook.sh "$(uname -r)" } # This routine performs a clean-up by deleting the old/useless remaining @@ -62,7 +62,7 @@ cleanup_unused_initrd() { KVER="${FNAME#kdump-initrd-}" if ! grep -q "${KVER}" "${INSTALLED_KERNELS}" ; then rm -f "${MOUNT_FOLDER}/${FNAME}.img" - logger "kdump: removed unused file \"${FNAME}.img\"" + logger "kdumpst: removed unused file \"${FNAME}.img\"" fi done @@ -99,7 +99,7 @@ parse_ram_buffers() { usage() { cat < -Kdump/Pstore loader. +kdumpst loader. Options: load @@ -114,9 +114,9 @@ EOF } preamble() { - load_kdump_config + load_kdumpst_config - # In case the kdump main folder doesn't exist, create it + # In case the kdumpst main folder doesn't exist, create it # here, as soon as possible. mkdir -p "${MOUNT_FOLDER}" } @@ -160,12 +160,12 @@ if [ "${USE_PSTORE_RAM}" -eq 1 ]; then if [ "${MEM_SIZE}" -gt 0 ]; then if modprobe ramoops mem_address=0x"${MEM_START}" mem_size="${MEM_REQUIRED}" record_size="${RECORD_SIZE}"; then # If Pstore is set, update grub.cfg to avoid reserving crashkernel memory. - logger "kdump: pstore-RAM was loaded successfully" + logger "kdumpst: pstore-RAM was loaded successfully" cleanup_unused_initrd grub_update pstore exit 0 fi - logger "kdump: pstore-RAM load failed...will try kdump" + logger "kdumpst: pstore-RAM load failed...will try kdump" fi # Fallback to kdump load - if we fail when configuring pstore, better # trying kdump; in case we have crashkernel memory reserved, lucky us. @@ -191,7 +191,7 @@ VMLINUX="${VMLINUX#*BOOT_IMAGE=}" if [ ! -s "${VMLINUX}" ]; then VMLINUX="/boot/${VMLINUX}" if [ ! -s "${VMLINUX}" ]; then - logger "kdump: couldn't find the kernel image" + logger "kdumpst: couldn't find the kernel image" exit 1 fi fi @@ -204,7 +204,7 @@ if [ ! -s "${INITRD_FNAME}" ]; then fi if ! kexec -s -p "${VMLINUX}" --initrd "${INITRD_FNAME}" --append="${KDUMP_CMDLINE}"; then - logger "kdump: kexec load failed" + logger "kdumpst: kexec load failed" exit 1 fi -logger "kdump: panic kexec loaded successfully" +logger "kdumpst: panic kexec loaded successfully" diff --git a/save-dumps.header b/save-dumps.header index ea0191a..384592b 100644 --- a/save-dumps.header +++ b/save-dumps.header @@ -6,6 +6,7 @@ set -uo pipefail # Copyright (c) 2021 Valve. # Maintainer: Guilherme G. Piccoli # -# This is the kdump/pstore log collector; this script prepares the -# collected data and save it in the local disk, in the next successful boot. +# This is the kdumpst log collector; this script prepares the +# collected data and save it in the local disk, in the first +# successful boot after the panic. # diff --git a/save-dumps.sh.in b/save-dumps.sh.in index 84f2082..c4b4e0f 100644 --- a/save-dumps.sh.in +++ b/save-dumps.sh.in @@ -1,20 +1,19 @@ -load_kdump_config +load_kdumpst_config MAIN_FOLDER="${MOUNT_FOLDER}" - if [ ! -d "${MAIN_FOLDER}" ]; then - logger "kdump: invalid folder (${MAIN_FOLDER}) - aborting..." + logger "kdumpst: invalid folder (${MAIN_FOLDER}) - aborting..." exit 1 fi # Use UTC timezone to match kdump collection CURRENT_TSTAMP=$(date -u +"%Y%m%d%H%M") -KDUMP_TMP_FOLDER="${MAIN_FOLDER}/.tmp" +KDUMPST_TMP_FOLDER="${MAIN_FOLDER}/.tmp" # By default, pstore is mounted in this location; if it isn't, we move on. # Notice we currently only support the logs generated by the ramoops backend. LOGS_FOUND=0 -PSTORE_FOLDER="${KDUMP_TMP_FOLDER}/pstore" +PSTORE_FOLDER="${KDUMPST_TMP_FOLDER}/pstore" while IFS= read -r log do @@ -31,7 +30,7 @@ done <<< "$(find /sys/fs/pstore/ -type f 2>/dev/null)" if [ "${LOGS_FOUND}" -gt 0 ]; then # Logs should live on <...>/.tmp folder, due to the zip compression. - mv "${PSTORE_FOLDER}"/* "${KDUMP_TMP_FOLDER}/" 2>/dev/null + mv "${PSTORE_FOLDER}"/* "${KDUMPST_TMP_FOLDER}/" 2>/dev/null rm -rf "${PSTORE_FOLDER}" fi @@ -48,7 +47,7 @@ do continue fi - KD_FOLDER="${KDUMP_TMP_FOLDER}/kdump" + KD_FOLDER="${KDUMPST_TMP_FOLDER}/kdump" mkdir -p "${KD_FOLDER}" if [ -s "${crash}/dmesg.txt" ]; then @@ -71,7 +70,7 @@ done <<< "$(find "${KDUMP_CRASH_FOLDER}"/ -mindepth 1 -type d 2>/dev/null)" if [ "${CRASHES_FOUND}" -gt 0 ]; then # Logs should live on .tmp folder, due to the zip compression. - mv "${KD_FOLDER}"/* "${KDUMP_TMP_FOLDER}/" 2>/dev/null + mv "${KD_FOLDER}"/* "${KDUMPST_TMP_FOLDER}/" 2>/dev/null rm -rf "${KD_FOLDER}" LOGS_FOUND=$((LOGS_FOUND + CRASHES_FOUND)) fi @@ -84,30 +83,30 @@ if [ "${LOGS_FOUND}" -ne 0 ]; then mkdir -p "${LOGS_FOLDER}" # First we collect some more info, like DMI data, os-release, etc; - DMI_FNAME="${KDUMP_TMP_FOLDER}/dmidecode.${CURRENT_TSTAMP}" + DMI_FNAME="${KDUMPST_TMP_FOLDER}/dmidecode.${CURRENT_TSTAMP}" dmidecode > "${DMI_FNAME}" - BUILD_FNAME="${KDUMP_TMP_FOLDER}/build.${CURRENT_TSTAMP}" + BUILD_FNAME="${KDUMPST_TMP_FOLDER}/build.${CURRENT_TSTAMP}" cp "/etc/os-release" "${BUILD_FNAME}" - VERSION_FNAME="${KDUMP_TMP_FOLDER}/version.${CURRENT_TSTAMP}" + VERSION_FNAME="${KDUMPST_TMP_FOLDER}/version.${CURRENT_TSTAMP}" uname -r > "${VERSION_FNAME}" sync "${DMI_FNAME}" "${BUILD_FNAME}" "${VERSION_FNAME}" # Create the dump compressed pack. - LOG_FNAME="kdump-${CURRENT_TSTAMP}.zip" + LOG_FNAME="kdumpst-${CURRENT_TSTAMP}.zip" LOG_FNAME="${LOGS_FOLDER}/${LOG_FNAME}" - zip -9 -jq "${LOG_FNAME}" "${KDUMP_TMP_FOLDER}"/* 1>/dev/null + zip -9 -jq "${LOG_FNAME}" "${KDUMPST_TMP_FOLDER}"/* 1>/dev/null sync "${LOG_FNAME}" 2>/dev/null if [ ! -s "${LOG_FNAME}" ]; then - logger "kdump: couldn't create the compressed log archive" - logger "kdump: check folder \"${KDUMP_TMP_FOLDER}\" for logs" + logger "kdumpst: couldn't create the compressed log archive" + logger "kdumpst: check folder \"${KDUMPST_TMP_FOLDER}\" for logs" exit 0 else - logger "kdump: logs saved in \"${LOGS_FOLDER}\"" + logger "kdumpst: logs saved in \"${LOGS_FOLDER}\"" fi fi -rm -rf "${KDUMP_TMP_FOLDER}" +rm -rf "${KDUMPST_TMP_FOLDER}"