Compare commits
11 Commits
c81f4e5596
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
|
84d682ea8c
|
|||
| 782d912471 | |||
| 9c22feadfa | |||
| 92afdc48d6 | |||
| 585f92b30e | |||
| 4767b8095f | |||
| 6141e3c4cb | |||
| 462eef9828 | |||
| 512cd8ff4a | |||
| c83ad9a83e | |||
| b19a940fbd |
@ -14,8 +14,8 @@
|
||||
# If USE_PSTORE_RAM is set to 1, Kdump won't be loaded. Instead, the Pstore
|
||||
# RAM backend will be configured. In order to have success, this operation
|
||||
# relies in having an available RAM buffer on /proc/iomem with at least
|
||||
# PSTORE_MEM_AMOUNT (decimal, in MB) in size. Also, kernel must be able to
|
||||
# allocate a contiguous memory amount of PSTORE_RECORD_SZ (decimal, MB).
|
||||
# PSTORE_MEM_AMOUNT (decimal, bytes) in size. Also, kernel must be able to
|
||||
# allocate a contiguous memory amount of PSTORE_RECORD_SZ (decimal, bytes).
|
||||
# If there is no such RAM buffer, there is a possibility to make use of
|
||||
# the crash kernel area for that. There are risks: such memory area could
|
||||
# have its address mapped differently across kernel updates; also if both
|
||||
@ -50,7 +50,7 @@ MOUNT_FOLDER="/var/crash/kdumpst"
|
||||
FULL_COREDUMP=1
|
||||
MAKEDUMPFILE_COREDUMP_CMD="-z -d 31"
|
||||
MAKEDUMPFILE_DMESG_CMD="--dump-dmesg"
|
||||
KDUMP_APPEND_CMDLINE="panic=-1 oops=panic fsck.mode=force fsck.repair=yes nr_cpus=1 reset_devices"
|
||||
KDUMP_APPEND_CMDLINE="panic=-1 oops=panic fsck.mode=force fsck.repair=yes nr_cpus=1 reset_devices initcall_blacklist=drm_core_init module_blacklist=amdgpu,i915,nouveau"
|
||||
#
|
||||
#
|
||||
# GRUB-related settings
|
||||
@ -68,3 +68,7 @@ GRUB_AUTOSET=1
|
||||
GRUB_BOOT_FILE="/boot/grub/grub.cfg"
|
||||
GRUB_CFG_FILE="/etc/default/grub"
|
||||
GRUB_CMDLINE="crashkernel=256M "
|
||||
# If the BOOT_IMAGE kernel command line parameter begins with this, it will be
|
||||
# removed. For example, if you use btrfs and have a root sub-volume called "@",
|
||||
# set this to "/@"
|
||||
GRUB_BOOT_IMAGE_PREFIX=""
|
||||
|
||||
14
Makefile
14
Makefile
@ -16,7 +16,7 @@ kdumpst-load.sh: kdumpst-load.header common.sh kdumpst-load.sh.in
|
||||
save-dumps.sh: save-dumps.header common.sh save-dumps.sh.in
|
||||
cat $^ > $@
|
||||
|
||||
99-kdump-dracut.hook: initramfs/alpm-hook.generic
|
||||
99-kdump-dracut.hook: initramfs/alpm-hook.INITRD
|
||||
sed 's/INITRD/dracut/g' $^ > initramfs/$@
|
||||
|
||||
kdump-dracut-hook.sh: common.sh initramfs/dracut/dracut-common.sh
|
||||
@ -31,12 +31,9 @@ module-setup.sh: initramfs/dracut/module-setup.header common.sh initramfs/dracut
|
||||
.PHONY: dracut
|
||||
dracut: 99-kdump-dracut.hook kdump-dracut-hook.sh module-setup.sh
|
||||
|
||||
99-kdump-mkinitcpio.hook: initramfs/alpm-hook.generic
|
||||
99-kdump-mkinitcpio.hook: initramfs/alpm-hook.INITRD
|
||||
sed 's/INITRD/mkinitcpio/g' $^ > initramfs/$@
|
||||
|
||||
99-kdump-mkinitcpio-git.hook: initramfs/alpm-hook.generic
|
||||
sed 's/INITRD/mkinitcpio-git/g' $^ > initramfs/$@
|
||||
|
||||
kdump-mkinitcpio-hook.sh: common.sh initramfs/initcpio/initcpio-common.sh
|
||||
sed 's/INITRD/mkinitcpio/g' initramfs/alpm-script.header > initramfs/alpm-header-initcpio
|
||||
sed 's/INITRD/mkinitcpio/g' initramfs/alpm-script.sh.in > initramfs/alpm-script.sh.in-initcpio
|
||||
@ -51,7 +48,7 @@ kdump.install: initramfs/initcpio/kdump.install.header common.sh initramfs/initc
|
||||
cat $^ > initramfs/initcpio/$@
|
||||
|
||||
.PHONY: mkinitcpio
|
||||
mkinitcpio: 99-kdump-mkinitcpio.hook 99-kdump-mkinitcpio-git.hook kdump-mkinitcpio-hook.sh kdump.hook kdump.install
|
||||
mkinitcpio: 99-kdump-mkinitcpio.hook kdump-mkinitcpio-hook.sh kdump.hook kdump.install
|
||||
|
||||
all: kdumpst-load.sh save-dumps.sh dracut mkinitcpio
|
||||
|
||||
@ -64,17 +61,16 @@ install: all
|
||||
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 -m0644 initramfs/99-kdump-kernel.hook $(DESTDIR)$(alpmhooksdir)/99-kdump-kernel.hook
|
||||
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 kdumpst-load.sh save-dumps.sh
|
||||
rm -f initramfs/99-kdump-*
|
||||
rm -f initramfs/99-kdump-{mkinitcpio,dracut}.hook
|
||||
rm -f initramfs/dracut/{kdump-dracut-hook.sh,module-setup.sh}
|
||||
rm -f initramfs/initcpio/kdump{-mkinitcpio-hook.sh,.hook,.install}
|
||||
|
||||
@ -17,8 +17,8 @@
|
||||
#
|
||||
# 1. Install the package with pacman if not available in your system; to check
|
||||
# if it's already installed look the pacman installed package list. Also, be
|
||||
# sure the systemd service was properly loaded by checking
|
||||
# 'systemctl status kdumpst-init.service'.
|
||||
# sure to properly enable/load the systemd service, since the services on Arch
|
||||
# Linux do not autoload - for that, just run 'systemctl enable --now kdumpst-init.service'.
|
||||
#
|
||||
# 2. In a crash event, the dmesg log is collected, and by default this happens
|
||||
# via the pstore mechanism, i.e., no crashkernel memory needs to be reserved
|
||||
|
||||
@ -4,8 +4,8 @@
|
||||
# Maintainer: Guilherme G. Piccoli <gpiccoli@igalia.com>
|
||||
#
|
||||
# alpm hook to deal with the kdump initramfs creation/deletion
|
||||
# for INITRD users. This hook would act upon kernel installation,
|
||||
# upgrade and removal, also on INITRD package installation.
|
||||
# for initcpio or dracut. This hook would act upon kernel
|
||||
# installation, upgrade and removal.
|
||||
#
|
||||
[Trigger]
|
||||
Type = Path
|
||||
@ -14,14 +14,8 @@ Operation = Remove
|
||||
Operation = Upgrade
|
||||
Target = usr/lib/modules/*/vmlinuz
|
||||
|
||||
[Trigger]
|
||||
Type = Package
|
||||
Operation = Install
|
||||
Target = INITRD
|
||||
|
||||
[Action]
|
||||
Description = Managing kdump minimal initramfs and INITRD hooks...
|
||||
Depends=INITRD
|
||||
Description = Managing kdump minimal initramfs
|
||||
When = PostTransaction
|
||||
Exec = /usr/lib/kdumpst/kdump-INITRD-hook.sh
|
||||
Exec =/bin/bash -s -c 'if command -v mkinitcpio > /dev/null; then /usr/lib/kdumpst/kdump-mkinitcpio-hook.sh; fi && if command -v dracut > /dev/null; then /usr/lib/kdumpst/kdump-dracut-hook.sh; fi'
|
||||
NeedsTargets
|
||||
18
initramfs/alpm-hook.INITRD
Normal file
18
initramfs/alpm-hook.INITRD
Normal file
@ -0,0 +1,18 @@
|
||||
# SPDX-License-Identifier: LGPL-2.1-or-later
|
||||
#
|
||||
# Copyright (c) 2022 Valve.
|
||||
# Maintainer: Guilherme G. Piccoli <gpiccoli@igalia.com>
|
||||
#
|
||||
# alpm hook to deal with the kdump initramfs creation/deletion
|
||||
# for INITRD. This hook would act upon INITRD package installation.
|
||||
#
|
||||
[Trigger]
|
||||
Type = Path
|
||||
Operation = Install
|
||||
Target = usr/bin/INITRD
|
||||
|
||||
[Action]
|
||||
Description = Managing kdump minimal initramfs for INITRD installation
|
||||
When = PostTransaction
|
||||
Exec = /usr/lib/kdumpst/kdump-INITRD-hook.sh
|
||||
NeedsTargets
|
||||
@ -15,6 +15,19 @@ if [ -n "$1" ]; then
|
||||
|
||||
if command -v INITRD 1>/dev/null; then
|
||||
INITRD_installation
|
||||
|
||||
# Worth noticing that it is possible (though unlikely) that during
|
||||
# the kdumpst package installation, users are running a previously
|
||||
# uninstalled kernel. Imagine if the user upgrades the kernel, and
|
||||
# then install kdumpst before rebooting. With that, creating an
|
||||
# initrd fails here since it relies on "uname -r". To prevent such
|
||||
# unhandled error, check if this kernel's modules directory exists.
|
||||
|
||||
if [ ! -d "/lib/modules/$1" ]; then
|
||||
logger "kdumpst: no kernel modules dir; defer initrd creation to next boot"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
create_initramfs_INITRD "$1"
|
||||
fi
|
||||
exit 0
|
||||
|
||||
@ -10,9 +10,10 @@ installkernel() {
|
||||
# to reduce the size of the minimal initramfs being created - kdump
|
||||
# is an non-graphical environment. This should have been already done
|
||||
# via dracut cmdline arguments, but play safe and delete here as well.
|
||||
# Our list includes the most common FWs/drivers (amd, i915, nvidia).
|
||||
rm -rf "$initdir"/usr/lib/firmware/{amdgpu,i915,nvidia,radeon}
|
||||
rm -rf "$initdir"/usr/lib/modules/*/kernel/drivers/gpu/drm/{amd,i915,nouveau,radeon}
|
||||
# Our list includes the most common GFX FW blobs (AMD, i915, Nvidia)
|
||||
# and all GPU/DRM drivers.
|
||||
rm -rf "$initdir"/usr/lib/firmware/{amdgpu,i915,nvidia,radeon}/
|
||||
rm -rf "$initdir"/usr/lib/modules/*/kernel/drivers/gpu/drm/*
|
||||
|
||||
FSMOD="$(findmnt -n -o FSTYPE --target "${MOUNT_FOLDER}")"
|
||||
if [ -z "${FSMOD}" ]; then
|
||||
|
||||
@ -6,9 +6,10 @@
|
||||
# before running any of these functions!
|
||||
#
|
||||
create_initramfs_mkinitcpio() {
|
||||
mkdir -p "${MOUNT_FOLDER}"
|
||||
rm -f "${MOUNT_FOLDER}/kdump-initrd-$1.img"
|
||||
|
||||
mkinitcpio -A kdump -g "${MOUNT_FOLDER}/kdump-initrd-$1.img" "$1" 1>/dev/null
|
||||
mkinitcpio -A kdump -S microcode,kms,plymouth -g "${MOUNT_FOLDER}/kdump-initrd-$1.img" -k "$1" 1>/dev/null
|
||||
|
||||
if [ -s "${MOUNT_FOLDER}/kdump-initrd-$1.img" ]; then
|
||||
logger "kdumpst: created initcpio minimal initramfs"
|
||||
|
||||
@ -33,12 +33,6 @@ build() {
|
||||
BASE_FLD="${MOUNT_FOLDER#*$TGT}"
|
||||
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.
|
||||
# Our list includes the most common FWs/drivers (amd, i915, nvidia).
|
||||
rm -rf "${BUILDROOT}"/usr/lib/firmware/{amdgpu,i915,nvidia,radeon}
|
||||
rm -rf "${BUILDROOT}"/usr/lib/modules/*/kernel/drivers/gpu/drm/{amd,i915,nouveau,radeon}
|
||||
|
||||
add_runscript
|
||||
}
|
||||
|
||||
|
||||
@ -200,7 +200,7 @@ KDUMP_CMDLINE="${KDUMP_CMDLINE} ${KDUMP_APPEND_CMDLINE}"
|
||||
# information. If it fails, then attempt prepending /boot into that (faced
|
||||
# both situations in the field so far).
|
||||
VMLINUX="$(grep -o 'BOOT_IMAGE=[^ ]*' /proc/cmdline)"
|
||||
VMLINUX="${VMLINUX#*BOOT_IMAGE=}"
|
||||
VMLINUX="${VMLINUX#*BOOT_IMAGE=${GRUB_BOOT_IMAGE_PREFIX}}"
|
||||
if [ ! -s "${VMLINUX}" ]; then
|
||||
VMLINUX="/boot/${VMLINUX}"
|
||||
if [ ! -s "${VMLINUX}" ]; then
|
||||
@ -214,6 +214,12 @@ fi
|
||||
INITRD_FNAME="${MOUNT_FOLDER}/kdump-initrd-$(uname -r).img"
|
||||
if [ ! -s "${INITRD_FNAME}" ]; then
|
||||
create_initrd
|
||||
|
||||
# Check if create_initrd() succeeded.
|
||||
if [ ! -s "${INITRD_FNAME}" ]; then
|
||||
logger "kdumpst: failure on initrd creation - aborting."
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
if ! kexec -s -p "${VMLINUX}" --initrd "${INITRD_FNAME}" --append="${KDUMP_CMDLINE}"; then
|
||||
@ -221,3 +227,7 @@ if ! kexec -s -p "${VMLINUX}" --initrd "${INITRD_FNAME}" --append="${KDUMP_CMDLI
|
||||
exit 1
|
||||
fi
|
||||
logger "kdumpst: panic kexec loaded successfully"
|
||||
|
||||
# Local Variables:
|
||||
# indent-tabs-mode: t
|
||||
# End:
|
||||
|
||||
Reference in New Issue
Block a user