Package: kdump-tools
Version: 1.3.7-2
Starting from 2.6.24 kernel provides vmcoreinfo right in vmcore,
so makedumpfile can produce filtered dumps without vmlinux or slecial
vmcoreinfo.
attached patch drops DEBUG_KERNEL from scripts, configs and documentation.
Also it adds to kdump-config automatical extracting kernel log buffer (dmesg)
from vmcore,
so kdump produce two files in /var/crash dump.XXX and dmesg.XXX with
human-readable log from crashed kernel.
diff -urN makedumpfile-1.3.7.orig/debian/kdump-config makedumpfile-1.3.7/debian/kdump-config
--- makedumpfile-1.3.7.orig/debian/kdump-config 2011-08-22 15:19:01.040953008 +0400
+++ makedumpfile-1.3.7/debian/kdump-config 2011-08-22 16:10:28.039050663 +0400
@@ -44,6 +44,7 @@
# Set up defaults
KDUMP_SYSCTL=${KDUMP_SYSCTL:="kernel.panic_on_oops=1"}
KDUMP_COREDIR=${KDUMP_COREDIR:=/var/crash}
+MAKEDUMP_ARGS=${MAKEDUMP_ARGS:="-c -d 31"}
KDUMP_CMDLINE_APPEND=${KDUMP_CMDLINE_APPEND:="irqpoll maxcpus=1 nousb"}
[ -d $KDUMP_COREDIR ] || mkdir -p $KDUMP_COREDIR ;
@@ -52,9 +53,6 @@
# Constants
vmcore_file=/proc/vmcore
sys_kexec_crash=/sys/kernel/kexec_crash_loaded
-kernel_link=$KDUMP_COREDIR/kernel_link
-systemmap_link=$KDUMP_COREDIR/system.map_link
-kconfig_link=$KDUMP_COREDIR/config_link
kexec_cmd_file=$KDUMP_COREDIR/kexec_cmd
# Utility Functions
@@ -90,9 +88,6 @@
echo "current state: Not ready to kdump";
fi
echo
- echo "kernel link: "
- echo " "`readlink -n -s $kernel_link`
- echo
echo "kexec command:"
echo -n " "
if [ -e $kexec_cmd_file ] ; then
@@ -113,8 +108,6 @@
echo " $KDUMP_KERNEL"
echo "kdump initrd: "
echo " $KDUMP_INITRD"
- echo "debug kernel: "
- echo " $DEBUG_KERNEL"
echo "kexec command to be used:"
echo " $KEXEC_CMD"
}
@@ -161,75 +154,6 @@
fi
}
-# We need to find debug kernel for makedumpfile file to use when
-# processing the vmcore file. This will
-# A) speed up the vmcore copy and
-# B) make it much smaller (see A).
-# When the kdump kernel boots, we have no idea what kernel just
-# dumped, so we should determine this info whenever a normal (non-kdump)
-# kernel boots.
-#
-# Use the following priorites in determining the debug kernel:
-# 1. An explicit Debug kernel in the defaults file overrides all
-# 2. Look for an installed debug kernel matching the current `uname -r`
-# 3. Give up. Note, that a debug kernel is optional.
-#
-# Returns: 0/1 (success/fail)
-# Sets: MAKEDUMP_CONFIG, DEBUG_KERNEL, DEBUG_CONFIG, DEBUG_MAP
-function locate_debug_kernel()
-{
- MAKEDUMP_CONFIG=$KDUMP_COREDIR/makedump-config-$KVER
-
- # 1: Is there an Explicit DEBUG_KERNEL in the defaults file?
- if [ -n "$DEBUG_KERNEL" ] ; then
- if [ ! -e "$DEBUG_KERNEL" ] ; then
- log_failure_msg "$KDUMP_DEFAULTS: DEBUG_KERNEL " \
- "does not exist: $DEBUG_KERNEL"
- logger -t $NAME "$KDUMP_DEFAULTS: DEBUG_KERNEL " \
- "does not exist: $DEBUG_KERNEL"
- return 1;
- fi
-
- # 2: Look for an installed debug kernel
- elif [ -e /usr/lib/debug/boot/vmlinux-$KVER ] ; then
- DEBUG_KERNEL=/usr/lib/debug/boot/vmlinux-$KVER
- DEBUG_CONFIG=/boot/config-$KVER
- DEBUG_MAP=/boot/System.map-$KVER
- elif [ -e /usr/lib/debug/vmlinux-$KVER ] ; then
- DEBUG_KERNEL=/usr/lib/debug/vmlinux-$KVER
- DEBUG_CONFIG=/usr/lib/debug/config-$KVER
- DEBUG_MAP=/usr/lib/debug/System.map-$KVER
-
- # FIXME: Look for a vmcoreinfo file
-
- # 3: give up :)
- else
- echo "Could not find an installed debug vmlinux image and"
- echo "DEBUG_KERNEL is not specified in $KDUMP_DEFAULTS"
- log_warning_msg "makedumpfile may be limited to -d 1"
- return 1;
- fi
-
- if [ $DRY_RUN ] ; then return 0; fi
-
- # Okay, now we know the name of the debug kernel and it exists...
- if [ -e "$DEBUG_KERNEL" ] ; then
-
- rm -f $kernel_link $systemmap_link $kconfig_link
- # Create Links to the stuff to preserve what we found.
- # The kdump kernel won't be able to determine this on its own.
- [ -e "$DEBUG_KERNEL" ] && ln -s $DEBUG_KERNEL $kernel_link
- [ -e "$DEBUG_MAP" ] && ln -s $DEBUG_MAP $systemmap_link
- [ -e "$DEBUG_CONFIG" ] && ln -s $DEBUG_CONFIG $kconfig_link
-
- return 0;
- fi
-
- # This can't actually be reached...
- log_failure_msg "Warning: no debug kernel found"
- return 1;
-}
-
# Find the kexec/kdump kernel and possibly a corresponding initrd.
# A kdump kernel does not need to match the `uname -r` of the booted kernel.
#
@@ -385,32 +309,21 @@
# Sets: KDUMP_STAMPDIR, KDUMP_COREFILE
function kdump_save_core()
{
- KDUMP_STAMPDIR="$KDUMP_COREDIR/"`date +"%Y%m%d%H%M"`
+ KDUMP_STAMP=`date +"%Y%m%d%H%M"`
+ KDUMP_STAMPDIR="$KDUMP_COREDIR/$KDUMP_STAMP"
KDUMP_CORETEMP="$KDUMP_STAMPDIR/dump-incomplete"
- KDUMP_COREFILE="$KDUMP_STAMPDIR/dump."`date +"%Y%m%d%H%M"`
+ KDUMP_COREFILE="$KDUMP_STAMPDIR/dump.$KDUMP_STAMP"
+ KDUMP_DMESGFILE="$KDUMP_STAMPDIR/dmesg.$KDUMP_STAMP"
mkdir -p $KDUMP_STAMPDIR
- DEBUG_KERNEL=`readlink -n -s $kernel_link`
- if [ -e "$DEBUG_KERNEL" ] ; then
- MAKEDUMP_ARGS=${MAKEDUMP_ARGS:="-c -d 31"}
- MAKEDUMP_ARGS="$MAKEDUMP_ARGS -x $DEBUG_KERNEL"
- else
- MAKEDUMP_ARGS=${MAKEDUMP_ARGS:="-c -d 1"}
- fi
-
- # Move previously linked kernel particulars into dump directory.
- [ -e $kernel_link ] && mv $kernel_link $KDUMP_STAMPDIR
- [ -e $kconfig_link ] && mv $kconfig_link $KDUMP_STAMPDIR
- [ -e $systemmap_link ] && mv $systemmap_link $KDUMP_STAMPDIR
-
log_action_msg "running makedumpfile $MAKEDUMP_ARGS $vmcore_file $KDUMP_CORETEMP"
makedumpfile $MAKEDUMP_ARGS $vmcore_file $KDUMP_CORETEMP
if [ $? -ne 0 ] ; then
log_failure_msg "$NAME: makedumpfile failed, falling back to 'cp'"
logger -t $NAME "makedumpfile failed, falling back to 'cp'"
KDUMP_CORETEMP="$KDUMP_STAMPDIR/vmcore-incomplete"
- KDUMP_COREFILE="$KDUMP_STAMPDIR/vmcore."`date +"%Y%m%d%H%M"`
+ KDUMP_COREFILE="$KDUMP_STAMPDIR/vmcore.$KDUMP_STAMP"
cp $vmcore_file $KDUMP_CORETEMP
fi
@@ -419,6 +332,8 @@
mv $KDUMP_CORETEMP $KDUMP_COREFILE
log_success_msg "$NAME: saved vmcore in $KDUMP_STAMPDIR"
logger -t $NAME "saved vmcore in $KDUMP_STAMPDIR"
+ log_action_msg "$NAME: extracting kernel log buffer to $KDUMP_DMESGFILE"
+ makedumpfile --dump-dmesg $KDUMP_COREFILE $KDUMP_DMESGFILE
return 0;
else
log_failure_msg "$NAME: failed to save vmcore in $KDUMP_STAMPDIR"
@@ -433,7 +348,6 @@
test)
DRY_RUN="true"
check_kdump_support;
- locate_debug_kernel;
locate_kdump_kernel;
kdump_load;
kdump_test
@@ -445,7 +359,6 @@
;;
load)
check_kdump_support;
- locate_debug_kernel;
locate_kdump_kernel;
kdump_load;
;;
diff -urN makedumpfile-1.3.7.orig/debian/kdump-config.8 makedumpfile-1.3.7/debian/kdump-config.8
--- makedumpfile-1.3.7.orig/debian/kdump-config.8 2011-08-22 15:19:01.039953021 +0400
+++ makedumpfile-1.3.7/debian/kdump-config.8 2011-08-22 15:39:26.560631904 +0400
@@ -121,19 +121,6 @@
.I /boot/grub/menu.lst
file and reboot, before kdump will work. See installed READMEs for suggestions.
.\"
-
-.RS 0
-.nf
-.B could not find an installed debug vmlinux image and
-.B DEBUG_KERNEL is not specified in /etc/default/kdump-tools
-.B Warning: makedumpfile will be limited to -d 1.
-.fi
-.RS
-A debug version of the currently booted kernel could not be
-found.
-.RE
-.RE
-.\"
.TP
.B KDUMP_KERNEL does not exist: $KDUMP_KERNEL
A KDUMP_KERNEL was specified in
diff -urN makedumpfile-1.3.7.orig/debian/kdump-tools.5 makedumpfile-1.3.7/debian/kdump-tools.5
--- makedumpfile-1.3.7.orig/debian/kdump-tools.5 2011-08-22 15:19:01.040953008 +0400
+++ makedumpfile-1.3.7/debian/kdump-tools.5 2011-08-22 15:41:26.038138229 +0400
@@ -87,12 +87,6 @@
.\"
.\"
.TP
-.B DEBUG_KERNEL
-A debug version of the running kernel. If not set,
-.B kdump-config
-will use /usr/lib/debug/vmlinux-$(uname-r) if it exists. Otherwise, kdump
-will still work, but the dump will take longer and will be much larger.
-.TP
.B MAKEDUMP_ARGS
Extra arguments passed to
.BR makedumpfile (8).
@@ -231,28 +225,6 @@
The kdump kernel must be configured with:
.B CONFIG_CRASH_DUMP=y
.\"
-.\"
-.IP 3.
-.B Debug Kernel
-\- An uncompressed debug kernel
-.I should
-be provided in order for makedumpfile to process the vmcore file.
-Without a debug kernel, the transfer process is reduced to using
-.RI \*(lq "makedumpfile -c -d 1" \*(rq.
-If
-.I /usr/lib/debug/vmlinux-$(uname -r)
-exists,
-.B kdump-tools
-will automatically use that kernel.
-
-Otherwise, A) set
-.B DEBUG_KERNEL
-in
-.I /etc/default/kdump-tools
-to point to a debug version of the currently booted kernel or
-B) do without - makedumpfile will still work, but the dumpfile will be larger
-and take longer to save to disk.
-.\"
.\" # ---------------------------------------------------------------------------
.\"
.SH EXAMPLES
diff -urN makedumpfile-1.3.7.orig/debian/kdump-tools.default makedumpfile-1.3.7/debian/kdump-tools.default
--- makedumpfile-1.3.7.orig/debian/kdump-tools.default 2011-08-22 15:19:01.039953021 +0400
+++ makedumpfile-1.3.7/debian/kdump-tools.default 2011-08-22 15:35:08.346860022 +0400
@@ -40,14 +40,9 @@
# ---------------------------------------------------------------------------
# Makedumpfile options:
-# DEBUG_KERNEL - a debug version of the running kernel. If not set,
-# kdump-config will use /usr/lib/debug/vmlinux-$(uname -r) if it is
-# available. If it is not available, makedumpfile will be limited to
-# dumping all pages in memory.
# MAKEDUMP_ARGS - extra arguments passed to makedumpfile (8). The default,
# if unset, is to pass '-c -d 31' telling makedumpfile to use compression
# and reduce the corefile to in-use kernel pages only.
-#DEBUG_KERNEL=
#MAKEDUMP_ARGS="-c -d 31"
diff -urN makedumpfile-1.3.7.orig/debian/kdump-tools.README.Debian makedumpfile-1.3.7/debian/kdump-tools.README.Debian
--- makedumpfile-1.3.7.orig/debian/kdump-tools.README.Debian 2011-08-22 15:19:01.039953021 +0400
+++ makedumpfile-1.3.7/debian/kdump-tools.README.Debian 2011-08-22 15:37:15.834266207 +0400
@@ -46,23 +46,12 @@
You may also want to add 'nmi_watchdog=1' on certain systems.
-4. Debug Kernel
- You *should* have a debug kernel in order for makedumpfile to process
- the vmcore file. Without a debug kernel, the transfer process is
- reduced to using "makedumpfile -d 1". Options:
- A) If /usr/lib/debug/boot/vmlinux-$(uname -r) exists,
- kdump-tools will use that kernel.
- B) Explicitly set DEBUG_KERNEL in /etc/default/kdump-tools to
- point to your debug kernel.
- C) None of the above. makedumpfile will still work, but your
- dumpfile will be larger and take longer to save to disk.
-
-5. Local Configuration
+4. Local Configuration
The /etc/default/kdump-tools file can be modified to reflect your
setup, if automatic detection fails, or if you need specific
architectural settings.
-6. Architectural considerations
+5. Architectural considerations
A) x86 && PAE && memory > 4 Gigabytes
will need to use KDUMP_KEXEC_ARGS="--elf64-core-headers"