diff --git a/README.SUSE b/README.SUSE index bd54401..d9e2299 100644 --- a/README.SUSE +++ b/README.SUSE @@ -124,14 +124,16 @@ The Default Dumper By default, the Kdump script saves the vmcore file to a unique sub-directory consisting of $KDUMP_SAVEDIR and the date string, such as -/var/log/dump/2006-02-21-13:20/vmcore. +/var/log/dump/2006-02-21-13:20/vmcore. This directory can be on the +local machine or on FTP, SSH, NFS or CIFS (see $KDUMP_SAVEDIR below). -Before copying the vmcore file, the default dumper does some system -checks. First, it checks the number of old dump directories and removes -them if there are more than $KDUMP_KEEP_OLD_DUMPS. Then, the dumper -checks the free disk space in the partition of the dump directory. If -the free space is less than the sum of the memory size and the value -given in $KDUMP_FREE_DISK_SIZE, then the dumper will not create a dump. +If a local directory is used, the default dumper does some system checks +before copying the vmcore file. First, it checks the number of old dump +directories and removes them if there are more than +$KDUMP_KEEP_OLD_DUMPS. Then, the dumper checks the free disk space in +the partition of the dump directory. If the free space is less than the +sum of the memory size and the value given in $KDUMP_FREE_DISK_SIZE, +then the dumper will not create a dump. $KDUMP_RUNLEVEL specifies the runlevel of the Kdump (recovery) kernel boot. When $KDUMP_IMMEDIATE_REBOOT is set to yes, then the init script @@ -250,11 +252,87 @@ Options for the Default Dumper - KDUMP_SAVEDIR This option specifies the path to the directory where the dumps are -saved. The default is "/var/log/dump". See also KDUMP_DUMPDEV if you +saved. This can be + + - a local file, for example "file:///var/log/dump" (or, deprecated, + just "/var/log/dump") + - a FTP server, for example "ftp://user:password@host/var/log/dump" + - a SSH server, for example "ssh://user@host/var/log/dump" + please create a user that needs no password or set up public key + authorization for the root user of the system -- or you have to enter + the password on the serial console as the VGA console may not work! + - a NFS share, for example "nfs://server:/export:/var/log/dump" + - a CIFS (SMB) share, for example + "cifs://user:password@host:/share/var/log/dump" + +For the exact URLs, see kdump-url_parser(8) manual page. Or use the +YaST2 kdump module to configure this if you're unsure. + +The default is "/var/log/dump". See also KDUMP_DUMPDEV if you don't want to save the dump at first on a raw device which helps if your root file system is corrupted. +- KDUMP_DUMPLEVEL + +Determines the dump level. If KDUMP_DUMPLEVEL != 0, then makedumpfile +is used to strip pages that may not be necessary for analysing. 0 means +no stripping, and 31 is the maximum dump level, i.e. 0 produces the +largest dump files and 31 the smallest. + +The following table from makedumpfile(8) shows what each dump level +means: + + dump | zero | cache|cache | user | free + level | page | page |private| data | page + -------+------+------+-------+------+------ + 0 | | | | | + 1 | X | | | | + 2 | | X | | | + 3 | X | X | | | + 4 | | X | X | | + 5 | X | X | X | | + 6 | | X | X | | + 7 | X | X | X | | + 8 | | | | X | + 9 | X | | | X | + 10 | | X | | X | + 11 | X | X | | X | + 12 | | X | X | X | + 13 | X | X | X | X | + 14 | | X | X | X | + 15 | X | X | X | X | + 16 | | | | | X + 17 | X | | | | X + 18 | | X | | | X + 19 | X | X | | | X + 20 | | X | X | | X + 21 | X | X | X | | X + 22 | | X | X | | X + 23 | X | X | X | | X + 24 | | | | X | X + 25 | X | | | X | X + 26 | | X | | X | X + 27 | X | X | | X | X + 28 | | X | X | X | X + 29 | X | X | X | X | X + 30 | | X | X | X | X + 31 | X | X | X | X | X + + +- KDUMP_DUMPFORMAT + +This variable specifies the dump format. + +"ELF" has the advantage that it's a standard format and GDB can be used to +analyze the dumps. The disadvantage is that the dump files are larger. + +"compressed" is the kdump compressed format (see makedumpfile(8)) that +produces small dumps. However, only "crash" can analyse the dumps and +you need makedumpfile to have installed (but you need it anyway if you +set KDUMP_DUMPLEVEL != 0 before). + + - KDUMP_DUMPDEV Specifies the dump device that is used for saving the dump with the kdump @@ -302,6 +380,7 @@ Determines if kdump uses verbose output. This value is a bitmask: 2: progress is written to stdout while dumping 4: kdump command line is written so standard output when executing /etc/init.d/kdump + 8: Debugging for kdump transfer script Machine-specific Notes @@ -537,6 +616,7 @@ Where: /boot/vmlinux- -- The matching kernel. vmcore -- The crash dump. + GDB Helper Script ================= diff --git a/kdump b/kdump index 02deea0..ba5139e 100644 --- a/kdump +++ b/kdump @@ -20,6 +20,7 @@ # Required-Stop: # Default-Start: 1 2 3 5 # Default-Stop: +# Short-Description: kdump core saving and boot configuration # Description: kdump core saving and boot configuration ### END INIT INFO @@ -28,99 +29,28 @@ KEXEC=/sbin/kexec KDUMP_HELPER=/usr/sbin/kdump-helper +KDUMP_CLEANUP_DUMPS=/usr/sbin/kdump-cleanup_dumps +KDUMP_SAVE_DUMP=/usr/sbin/kdump-save_dump +KDUMP_IDENTIFY_KERNEL=/usr/sbin/kdump-identify_kernel BOOTDIR="/boot" -# purge old dump directories if the number of directories -# exceeds $KDUMP_KEEP_OLD_DUMPS -purge_old_dumps() -{ - dirs=`ls -d $KDUMP_SAVEDIR/*-*-*-*:* 2>/dev/null | sort` - numdirs=`echo $dirs | wc -w` - for d in $dirs; do - if [ $numdirs -le $KDUMP_KEEP_OLD_DUMPS ]; then - break; - fi - echo " Expiring old dump $d" - rm -rf $d - numdirs=`expr $numdirs - 1` - done -} - -# get the free disk space of the given directory in MB -parse_rest_size() -{ - test -d "$1" || mkdir -p "$1" - hdread="" - df -P "$1" | while read fs bl us av rest; do - test -n "$hdread" && expr $av / 1024 - hdread="$fs" - done -} - -# get vmcore size in MB -get_mem_size() -{ - s=`stat -c '%s' /proc/vmcore` - expr \( $s + 1048575 \) / 1048576 -} - -get_size_mb() -{ - s=`stat -c '%s' $1 2> /dev/null || echo 0` - expr \( $s + 1048575 \) / 1048576 -} - # The default dumper # # Clean up old stuff if necessary, check the free size # and save the vmcore save_core() { - dumpsize=`get_mem_size` - if [ -z "$dumpsize" -o "$dumpsize" = 0 ]; then - echo -n "Null size vmcore" - rc_status -s - rc_failed 6 - return + $KDUMP_CLEANUP_DUMPS + if [ "$?" -ne 0 ] ; then + rc_status -v + return 1 fi - if [ $KDUMP_KEEP_OLD_DUMPS -gt 0 ]; then - purge_old_dumps - fi - - if [ $KDUMP_FREE_DISK_SIZE -gt 0 ]; then - restsize=`parse_rest_size "$KDUMP_SAVEDIR"` - needsize=`expr $dumpsize + $KDUMP_FREE_DISK_SIZE` - if [ $restsize -lt $needsize ]; then - echo -n " No enough space left on dump device ($restsize MB)" - rc_status -s - rc_failed 6 - return - fi - fi - - coredir="${KDUMP_SAVEDIR}/`date +"%Y-%m-%d-%H:%M"`" - mkdir -p $coredir - - echo -n "Saving $dumpsize MB crash dump to $coredir" - if [ $(($KDUMP_VERBOSE & 2)) -gt 0 ] ; then - echo " ..." - /bin/cp --sparse=always /proc/vmcore $coredir/vmcore & - pid=$! - sleep 5 - while true; do - copied=`get_size_mb $coredir/vmcore` - printf "Copied %'10llu (%3d%%) \r" \ - $copied $(($copied * 100 / $dumpsize)) - test -z "$pid" && break - test -d "/proc/$pid" || pid="" - sleep 15 - done - else - /bin/cp --sparse=always /proc/vmcore $coredir/vmcore - fi + $KDUMP_SAVE_DUMP /proc/vmcore rc_status -v + + return 0 } # print the available kdump kernel path @@ -128,6 +58,22 @@ save_core() check_boot_kernel () { local kstr + + # if the kernel is relocatable, try vmlinuz first because + # currently there are bugs with relocatable ELF-Images + # (ET_DYN => GDB doesn't work / ET_EXEC => kexec-tools doesn't + # detect) + case `uname -i` in + x86_64|i386) + kstr="${BOOTDIR}/vmlinuz-$1$2" + if [ -f $kstr ] ; then + if $KDUMP_IDENTIFY_KERNEL -r $kstr &>/dev/null ; then + echo $kstr + return + fi + fi + esac + kstr="${BOOTDIR}/vmlinux-$1$2" if [ -f $kstr ]; then echo $kstr @@ -226,6 +172,11 @@ load_kdump() echo 1 > /proc/sys/kernel/panic_on_oops + # remove `--args-linux' for x86 type kernel files here + if [ $($KDUMP_IDENTIFY_KERNEL -t $kdump_kernel) = "x86" ] ; then + KEXEC_OPTIONS=$(echo $KEXEC_OPTIONS | sed -e 's/--args-linux//g') + fi + KEXEC_CALL="$KEXEC -p $kdump_kernel --append=\"$KDUMP_COMMANDLINE\"" KEXEC_CALL="$KEXEC_CALL --initrd=$kdump_initrd $KEXEC_OPTIONS" @@ -265,47 +216,7 @@ have_valid_dump_in_dumpdev () # invalidate the dump device so that it's not read on next boot invalidate_dumpdev () { - dd if=/dev/zero of=$KDUMP_DUMPDEV bs=512 count=1 -} - -# copy the dump from the dumpdevice to the harddisk -copy_dump_from_dumpdev () -{ - if [ $KDUMP_KEEP_OLD_DUMPS -gt 0 ]; then - purge_old_dumps - fi - - dumpsize=`$KDUMP_HELPER -l "$KDUMP_DUMPDEV" | sed -e 's/Length: //g'` - if [ -z "$dumpsize" -o "$dumpsize" = 0 ] ; then - echo -n " Unable to retrieve the dump size" - rc_status -s - rc_failed - fi - - dumpsize_mb=$(($dumpsize / 1024 / 1024)) - - if [ $KDUMP_FREE_DISK_SIZE -gt 0 ]; then - restsize=`parse_rest_size "$KDUMP_SAVEDIR"` - needsize=`expr $dumpsize_mb + $KDUMP_FREE_DISK_SIZE` - if [ $restsize -lt $needsize ]; then - echo -n " No enough space left on dump device ($restsize MB)" - rc_status -s - rc_failed 6 - return - fi - fi - - coredir="${KDUMP_SAVEDIR}/`date +"%Y-%m-%d-%H:%M"`" - mkdir -p $coredir - echo -n "Saving crash dump to $coredir" - - BS=1024 - dd if=$KDUMP_DUMPDEV of=$coredir/vmcore count=$[$dumpsize/$BS] bs=$BS - if [ $[$dumpsize % $BS] != 0 ] ; then - dd if=$KDUMP_DUMPDEV of=$coredir/vmcore skip=$[$dumpsize/$BS*$BS] \ - seek=$[$dumpsize/$BS*$BS] count=$[$dumpsize%$BS] bs=1 - fi - invalidate_dumpdev + dd if=/dev/zero of=$KDUMP_DUMPDEV bs=512 count=1 &>/dev/null } case "$1" in @@ -325,7 +236,12 @@ case "$1" in fi else if have_valid_dump_in_dumpdev ; then - copy_dump_from_dumpdev + $KDUMP_SAVE_DUMP $KDUMP_DUMPDEV + rc_status -v + if [ "$?" -eq 0 ] ; then + invalidate_dumpdev + rc_status + fi fi load_kdump fi diff --git a/kdump-helper-0.1.2.tar.bz2 b/kdump-helper-0.1.2.tar.bz2 deleted file mode 100644 index d147305..0000000 --- a/kdump-helper-0.1.2.tar.bz2 +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:e342e253e5c0df67aa1f5f9db60007146252d30b835d2bf0665fff0df9da5439 -size 8069 diff --git a/kexec-tools.changes b/kexec-tools.changes index a80fc50..3589a9a 100644 --- a/kexec-tools.changes +++ b/kexec-tools.changes @@ -1,3 +1,11 @@ +------------------------------------------------------------------- +Mon Jun 11 17:06:07 CEST 2007 - bwalle@suse.de + +- moved copying of dump file to an external package + "kdump-helpers" +- moved kdump-helper which is needed to save dump in initrd + also to kdump-helpers package + ------------------------------------------------------------------- Tue Apr 24 17:08:20 CEST 2007 - olh@suse.de diff --git a/kexec-tools.spec b/kexec-tools.spec index 9b9be21..ae7fccc 100644 --- a/kexec-tools.spec +++ b/kexec-tools.spec @@ -11,7 +11,6 @@ # norootforbuild Name: kexec-tools -%define helperversion 0.1.2 %define package_version testing-20070319-rc License: GNU General Public License (GPL) Group: System/Kernel @@ -19,28 +18,28 @@ Requires: %insserv_prereq %fillup_prereq Autoreqprov: on Summary: Tools for fast kernel loading Version: 1.101 -Release: 97 +Release: 108 Source: %{name}-%{package_version}.tar.bz2 Source1: kdump Source2: sysconfig.kdump Source3: gdbinit.kdump Source4: gdb-kdump Source5: README.SUSE -Source6: kdump-helper-%{helperversion}.tar.bz2 -Patch1: kexec-longer-cmdline.diff -URL: http://www.xmission.com/~ebiederm/files/kexec/ +URL: http://www.vergenet.net/linux/kexec/kexec-tools/ BuildRoot: %{_tmppath}/%{name}-%{version}-build BuildRequires: libelf zlib-devel +Requires: kdump-helpers Patch: kexec-tools-testing-20070319-rc.patch +Patch1: kexec-longer-cmdline.diff Patch20: kexec-tools-1.101-align-dtstruct.patch Patch21: kexec-tools-1.101-bootargs-align.patch Patch22: kexec-tools-1.101-ps3-rmo_top-max.patch %description -Kexec is a user space utiltity for loading another kernel and asking -the currently running kernel to do something with it. A currently -running kernel may be asked to start the loaded kernel on reboot, or to -start the loaded kernel after it panics. +Kexec is a user space utility for loading another kernel and asking the +currently running kernel to do something with it. A currently running +kernel may be asked to start the loaded kernel on reboot, or to start +the loaded kernel after it panics. @@ -54,7 +53,7 @@ Authors: Tim Deegan %prep -%setup -q -n kexec-tools-%{package_version} -b 6 +%setup -q -n kexec-tools-%{package_version} %patch %patch1 -p1 # @@ -68,9 +67,6 @@ cp %{SOURCE5} . autoreconf -fi ./configure --prefix=/ --sbindir=/sbin --libdir=/%_lib make CPPFLAGS="$RPM_OPT_FLAGS" -cd ../kdump-helper-%{helperversion} -make CFLAGS="$RPM_OPT_FLAGS" -cd - %install make DESTDIR=$RPM_BUILD_ROOT install @@ -98,9 +94,6 @@ mkdir -p $RPM_BUILD_ROOT%{_datadir} mkdir -p $RPM_BUILD_ROOT%{_bindir} install -c -m 0644 %{SOURCE3} $RPM_BUILD_ROOT%{_datadir} install -c -m 0755 %{SOURCE4} $RPM_BUILD_ROOT%{_bindir} -cd ../kdump-helper-%{helperversion} -make DESTDIR=$RPM_BUILD_ROOT install -cd - %post %{fillup_and_insserv -n kdump kdump} @@ -130,9 +123,13 @@ true # ignore errors %endif /etc/init.d/kdump /var/adm/fillup-templates/sysconfig.kdump -%{_sbindir}/kdump-helper %changelog +* Mon Jun 11 2007 - bwalle@suse.de +- moved copying of dump file to an external package + "kdump-helpers" +- moved kdump-helper which is needed to save dump in initrd + also to kdump-helpers package * Tue Apr 24 2007 - olh@suse.de - update to current kexec-tools-testing add PS3 patches diff --git a/sysconfig.kdump b/sysconfig.kdump index d353902..04ab2c0 100644 --- a/sysconfig.kdump +++ b/sysconfig.kdump @@ -79,11 +79,25 @@ KDUMP_IMMEDIATE_REBOOT="yes" KDUMP_TRANSFER="" ## Type: string -## Default: "/var/log/dump" +## Default: "file:///var/log/dump" # # Which directory should the dumps be saved in by the default dumper? +# This can be: # -KDUMP_SAVEDIR="/var/log/dump" +# - a local file, for example "file:///var/log/dump" (or, deprecated, +# just "/var/log/dump") +# - a FTP server, for example "ftp://user:password@host/var/log/dump" +# - a SSH server, for example "ssh://user@host/var/log/dump" +# please create a user that needs no password or set up public key +# authorization for the root user of the system -- or you have to enter +# the password on the serial console as the VGA console may not work! +# - a NFS share, for example "nfs://server:/export:/var/log/dump" +# - a CIFS (SMB) share, for example +# "cifs://user:password@host:/share/var/log/dump" +# +# For the exact URLs, see kdump-url_parser(8) manual page. Or use the +# YaST2 kdump module to configure this if you're unsure. +KDUMP_SAVEDIR="file:///var/log/dump" ## Type: integer ## Default: 5 @@ -112,6 +126,7 @@ KDUMP_FREE_DISK_SIZE=64 ## Type: string ## Default: "" # +# # Specifies the dump device that is used for saving the dump with the kdump # kernel. The dump device normally is a disk partition. You don't need to # specify a dump device here. Then the dump is written to KDUMP_SAVEDIR when @@ -141,4 +156,67 @@ KDUMP_DUMPDEV="" # 2: progress is written to stdout while dumping # 4: kdump command line is written so standard output when executing # /etc/init.d/kdump +# 8: Debugging for kdump transfer script KDUMP_VERBOSE=3 + +## Type: integer +## Default: 0 +# +# Determines the dump level. If KDUMP_DUMPLEVEL != 0, then makedumpfile +# is used to strip pages that may not be necessary for analysing. 0 means +# no stripping, and 31 is the maximum dump level, i.e. 0 produces the +# largest dump files and 31 the smallest. +# +# The following table from makedumpfile(8) shows what each dump level +# means: +# dump | zero | cache|cache | user | free +# level | page | page |private| data | page +# -------+------+------+-------+------+------ +# 0 | | | | | +# 1 | X | | | | +# 2 | | X | | | +# 3 | X | X | | | +# 4 | | X | X | | +# 5 | X | X | X | | +# 6 | | X | X | | +# 7 | X | X | X | | +# 8 | | | | X | +# 9 | X | | | X | +# 10 | | X | | X | +# 11 | X | X | | X | +# 12 | | X | X | X | +# 13 | X | X | X | X | +# 14 | | X | X | X | +# 15 | X | X | X | X | +# 16 | | | | | X +# 17 | X | | | | X +# 18 | | X | | | X +# 19 | X | X | | | X +# 20 | | X | X | | X +# 21 | X | X | X | | X +# 22 | | X | X | | X +# 23 | X | X | X | | X +# 24 | | | | X | X +# 25 | X | | | X | X +# 26 | | X | | X | X +# 27 | X | X | | X | X +# 28 | | X | X | X | X +# 29 | X | X | X | X | X +# 30 | | X | X | X | X +# 31 | X | X | X | X | X +KDUMP_DUMPLEVEL=0 + +## Type: string +## Default: "ELF" +# +# This variable specifies the dump format. +# +# "ELF" has the advantage that it's a standard format and GDB can be used to +# analyse the dumps. The disadvantage is that the dump files are larger. +# +# "compressed" is the kdump compressed format (see makedumpfile(8)) that +# produces small dumps. However, only "crash" can analyse the dumps and +# you need makedumpfile to have installed (but you need it anyway if you +# set KDUMP_DUMPLEVEL != 0 before). +KDUMP_DUMPFORMAT="ELF" +