Bug 463878 - [5.3] mkdumprd Not Robust Enough
Summary: [5.3] mkdumprd Not Robust Enough
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 5
Classification: Red Hat
Component: kexec-tools
Version: 5.3
Hardware: All
OS: Linux
medium
medium
Target Milestone: rc
: ---
Assignee: Neil Horman
QA Contact: Martin Jenner
URL:
Whiteboard:
: 467483 468114 (view as bug list)
Depends On:
Blocks: 468087
TreeView+ depends on / blocked
 
Reported: 2008-09-25 03:29 UTC by Qian Cai
Modified: 2018-10-20 02:53 UTC (History)
5 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
: 600611 (view as bug list)
Environment:
Last Closed: 2009-01-20 20:59:59 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)
patch to properly quote delimit LABELS (736 bytes, patch)
2008-09-25 19:14 UTC, Neil Horman
no flags Details | Diff
new version of patch (2.71 KB, patch)
2008-09-26 18:14 UTC, Neil Horman
no flags Details | Diff


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2009:0105 0 normal SHIPPED_LIVE kexec-tools bug fix and enhancement update 2009-01-20 16:04:36 UTC

Description Qian Cai 2008-09-25 03:29:15 UTC
Description of problem:
mkdumprd is unable to copy with various of seems valid Kdump targets. The first one is a disk label which includes white spaces,

# /sbin/e2label /dev/mapper/VolGroup00-LogVol00 "KDUMP TEST"
Then, add the following line to kdump.conf
  ext3 LABEL="KDUMP TEST"
or
  ext3 "LABEL=KDUMP TEST"
or
  ext3 LABEL=KDUMP\ TEST

As the result, Kdump failed to start,
# service kdump start
Detected change(s) the following file(s):
  
  /etc/kdump.conf
Rebuilding /boot/efi/efi/redhat/initrd-2.6.18-116.el5kdump.img
error: quote mismatch for LABEL=KDUMP

usage: find [-type type] [path [-name file]]
/sbin/mkdumprd: line 1716: test: LABEL=KDUMP: binary operator expected
/etc/kdump.conf: Need a location for ext3
Failed to run mkdumprd
Starting kdump:[FAILED]

The other problem is two similar configurations behaved totally different,

ext3 /dev/mapper/VolGroup00-LogVol00

ext3 "/dev/mapper/VolGroup00-LogVol00"

The former is working as expected, but the later never works. It hung forever in Kdump Kernel here,

Waiting for required block device discovery
Waiting for sda...Found
Waiting for "mapper/VolGroup-LogVol00"...

From its initramfs, the content of /etc/critical_disks is the as the following,

sda
"mapper/VolGroup-LogVol00"

From the mkdumprd command traces, the problem is here,

-+ handlelvordev '"/dev/mapper/VolGroup00-LogVol00"'
-++ lvs --noheadings -o vg_name '"/dev/mapper/VolGroup00-LogVol00"'
-+ local vg=
-+ '[' -z '' ']'
-+++ echo '"/dev/mapper/VolGroup00-LogVol00"'
-+++ sed -e 's#^/dev/mapper/\([^-]*\)-\(.*\)$#/dev/\1/\2#'
-++ lvs --noheadings -o vg_name '"/dev/mapper/VolGroup00-LogVol00"'
-+ vg=
-+ '[' -n '' ']'
-+ findstoragedriver '"/dev/mapper/VolGroup00-LogVol00"'

Looks like "lvs" failed to find the correct VG name. If I run the command manually, I got,

# lvs --noheadings -o vg_name '"/dev/mapper/VolGroup00-LogVol00"'
  ""/dev/mapper/VolGroup00-LogVol00"": Invalid path for Logical Volume

Version-Release number of selected component (if applicable):
kexec-tools-1.102pre-40.el5

How reproducible:
always

Comment 1 Qian Cai 2008-09-25 04:57:19 UTC
Actually, the second issue is a regression against RHEL 5.2 introduced by the critical_disks changes. Therefore, previous working Kdump configuration files are not going to work correctly in RHEL 5.3.

Comment 2 Neil Horman 2008-09-25 19:14:23 UTC
Created attachment 317719 [details]
patch to properly quote delimit LABELS

you shouldn't ever need to quote delimit something without spaces in the config file.  As for the label with spaces, I'm not sure this will fix all the problems, but if you could, please give this patch a test and let me know the results.  Thanks!

Comment 3 Qian Cai 2008-09-26 06:20:59 UTC
I am afraid it won't work for me.

First test,
- config file:
ext3 LABEL="KDUMP TEST"

- start Kdump:
No kdump initial ramdisk found.[WARNING]^M
Rebuilding /boot/efi/efi/redhat/initrd-2.6.18-116.el5kdump.img
Usage: findfs LABEL=<label>|UUID=<uuid>
Starting kdump:[  OK  ]

- mkdumprd snip:
+ USING_METHOD=filesystem
+ echo 'LABEL="KDUMP' 'TEST"'
+ egrep -q '^(LABEL|UUID)='
++ findfs 'LABEL="KDUMP' 'TEST"'
Usage: findfs LABEL=<label>|UUID=<uuid>
+ config_val=
+ handlelvordev

- run Sysrq-C:
...
Scanning logical volumes
  Reading all physical volumes.  This may take a while...
  Found volume group "VolGroup00" using metadata type lvm2
Activating logical volumes
  2 logical volume(s) in volume group "VolGroup00" now active
hwclock: Could not access RTC: No such file or directory
Saving to the local filesystem LABEL=KDUMP TEST
BusyBox v1.2.0 (2008.01.04-12:33+0000) multi-call binary

No help available.

BusyBox v1.2.0 (2008.01.04-12:33+0000) multi-call binary

No help available.

mount: Cannot read /etc/fstab: No such file or directory
umount: Couldn't umount /mnt: Invalid argument
[: 0: unknown operand
Attempting to enter user-space to capture vmcore
Creating root device.
Checking root filesystem.
fsck 1.38 (30-Jun-2005)
...

- init from initramfs snip:
...
echo Saving to the local filesystem LABEL="KDUMP TEST"
DUMPDEV=LABEL="KDUMP TEST"
IS_LABEL=`echo $DUMPDEV | grep LABEL`
IS_UUID=`echo $DUMPDEV | grep UUID`
if [ -n "$IS_LABEL" -o -n "$IS_UUID" ]
then
  DUMPDEV=`findfs $DUMPDEV`
fi
fsck.ext3 $DUMPDEV 
mount -t ext3 $DUMPDEV /mnt
if [ $? == 0 ]
then
  mkdir -p /mnt//var/crash/127.0.0.1-$DATE
  VMCORE=/mnt//var/crash/127.0.0.1-$DATE/vmcore
  export VMCORE
  monitor_cp_progress $VMCORE-incomplete &
  cp /proc/vmcore $VMCORE-incomplete >/dev/null
  exitcode=$?
  if [ $exitcode == 0 ]
  then 
      mv $VMCORE-incomplete $VMCORE
      echo -e "\\033[0JSaving core complete"
  fi 
fi
umount /mnt
[ $exitcode == 0 ] && reboot -f
echo Attempting to enter user-space to capture vmcore
...

Comment 4 Qian Cai 2008-09-26 06:26:29 UTC
Second test,
- config file
ext3 "LABEL=KDUMP TEST"

- start Kdump:
No kdump initial ramdisk found.[WARNING]
Rebuilding /boot/efi/efi/redhat/initrd-2.6.18-116.el5kdump.img

error: quote mismatch for LABEL=KDUMP

usage: find [-type type] [path [-name file]]
Starting kdump:[  OK  ]

- mkdumprd snip:
...
+ case "$config_opt" in
++ echo '#options'
++ grep '^#.*$'
+ IS_COMMENT='#options'
+ '[' -n '#options' -o -z 'modulename options' ']'
+ continue
+ read config_opt config_val
+ case "$config_opt" in
++ echo '#default'
++ grep '^#.*$'
+ IS_COMMENT='#default'
+ '[' -n '#default' -o -z shell ']'
+ continue
+ read config_opt config_val
+ case "$config_opt" in
++ echo ext3
++ grep '^#.*$'
+ IS_COMMENT=
+ '[' -n '' -o -z '"LABEL=KDUMP TEST"' ']'
+ USING_METHOD=filesystem
+ echo '"LABEL=KDUMP' 'TEST"'
+ egrep -q '^(LABEL|UUID)='
+ handlelvordev '"LABEL=KDUMP' 'TEST"'
++ lvs --noheadings -o vg_name '"LABEL=KDUMP'
+ local vg=
+ '[' -z '' ']'
+++ echo '"LABEL=KDUMP'
+++ sed -e 's#^/dev/mapper/\([^-]*\)-\(.*\)$#/dev/\1/\2#'
++ lvs --noheadings -o vg_name '"LABEL=KDUMP'
+ vg=
+ '[' -n '' ']'
+ findstoragedriver '"LABEL=KDUMP'
+ for device in '$@'
+ echo '"LABEL=KDUMP'
+ sed '-es/\/dev\///' '-es/[0-9]\+//'
+ case " $handleddevices " in
+ handleddevices=' cciss/c0d0p2 "LABEL=KDUMP'
...

- init from the initramfs snip:
...
echo Saving to the local filesystem "LABEL=KDUMP TEST"
DUMPDEV="LABEL=KDUMP TEST"
IS_LABEL=`echo $DUMPDEV | grep LABEL`
IS_UUID=`echo $DUMPDEV | grep UUID`
if [ -n "$IS_LABEL" -o -n "$IS_UUID" ]
then
  DUMPDEV=`findfs $DUMPDEV`
fi
fsck.ext3 $DUMPDEV
mount -t ext3 $DUMPDEV /mnt
if [ $? == 0 ]
then
  mkdir -p /mnt//var/crash/127.0.0.1-$DATE
  VMCORE=/mnt//var/crash/127.0.0.1-$DATE/vmcore
  export VMCORE
  monitor_cp_progress $VMCORE-incomplete &
  cp /proc/vmcore $VMCORE-incomplete >/dev/null
  exitcode=$?
  if [ $exitcode == 0 ]
  then
      mv $VMCORE-incomplete $VMCORE
      echo -e "\\033[0JSaving core complete"
  fi
fi
umount /mnt
[ $exitcode == 0 ] && reboot -f
echo Attempting to enter user-space to capture vmcore
echo Creating root device.
...

Comment 5 Qian Cai 2008-09-26 06:35:01 UTC
The working example,
- config file:
ext3 LABEL=KDUMP-TEST

- start Kdump:
Detected change(s) the following file(s):
  
  /etc/kdump.conf
Rebuilding /boot/efi/efi/redhat/initrd-2.6.18-116.el5kdump.img
Starting kdump:[  OK  ]

- mkdumprd snip:
...
+ case "$config_opt" in
++ echo '#default'
++ grep '^#.*$'
+ IS_COMMENT='#default'
+ '[' -n '#default' -o -z shell ']'
+ continue
+ read config_opt config_val
+ case "$config_opt" in
++ echo ext3
++ grep '^#.*$'
+ IS_COMMENT=
+ '[' -n '' -o -z LABEL=KDUMP-TEST ']'
+ USING_METHOD=filesystem
+ echo LABEL=KDUMP-TEST
+ egrep -q '^(LABEL|UUID)='
++ findfs LABEL=KDUMP-TEST
+ config_val=/dev/mapper/VolGroup00-LogVol00
+ handlelvordev /dev/mapper/VolGroup00-LogVol00
++ lvs --noheadings -o vg_name /dev/mapper/VolGroup00-LogVol00
+ local 'vg=  VolGroup00'
+ '[' -z '  VolGroup00' ']'
+ '[' -n '  VolGroup00' ']'
++ echo VolGroup00
+ vg=VolGroup00
+ case " $vg_list " in
+ read config_opt config_val
+ case "$config_opt" in
++ echo '#ext3'
++ grep '^#.*$'
+ IS_COMMENT='#ext3'
+ '[' -n '#ext3' -o -z /dev/mapper/VolGroup00-LogVol00 ']'
+ continue
+ read config_opt config_val
+ '[' -n '' -a '!' -e /sys/kernel/vmcoreinfo ']'
...

- init from the initramfs snip:
...
echo Saving to the local filesystem LABEL=KDUMP-TEST
DUMPDEV=LABEL=KDUMP-TEST
IS_LABEL=`echo $DUMPDEV | grep LABEL`
IS_UUID=`echo $DUMPDEV | grep UUID`
if [ -n "$IS_LABEL" -o -n "$IS_UUID" ]
then
  DUMPDEV=`findfs $DUMPDEV`
fi
fsck.ext3 $DUMPDEV
mount -t ext3 $DUMPDEV /mnt
if [ $? == 0 ]
then
  mkdir -p /mnt//var/crash/127.0.0.1-$DATE
  VMCORE=/mnt//var/crash/127.0.0.1-$DATE/vmcore
  export VMCORE
  monitor_cp_progress $VMCORE-incomplete &
  cp /proc/vmcore $VMCORE-incomplete >/dev/null
  exitcode=$?
  if [ $exitcode == 0 ]
  then
      mv $VMCORE-incomplete $VMCORE
      echo -e "\\033[0JSaving core complete"
  fi
fi
umount /mnt
[ $exitcode == 0 ] && reboot -f
echo Attempting to enter user-space to capture vmcore
echo Creating root device.
...

Comment 6 Neil Horman 2008-09-26 18:14:08 UTC
Created attachment 317822 [details]
new version of patch

Here you go.  I tested this one out and it fixed the problem for me.  Please confirm and I'll check it in ASAP.  Thanks!

Comment 7 Qian Cai 2008-09-27 03:25:25 UTC
Great! ext3 LABEL="KDUMP TEST" works. Thank you!

Comment 8 Neil Horman 2008-09-28 01:11:34 UTC
Great!  Thank Cai, I'll drum up the pm ack and get this checked in monday ASAP.

Comment 9 Neil Horman 2008-09-29 15:34:35 UTC
fixed in -42.el5.

Comment 12 Neil Horman 2008-10-07 15:51:47 UTC
You know, that kdump_chk value is just looking to verify the presence of binaries, we really don't need it.  I'm removing it entirely, its not worth the effort to keep around.  Fixed in -46

Comment 13 Neil Horman 2008-10-17 19:49:11 UTC
*** Bug 467483 has been marked as a duplicate of this bug. ***

Comment 16 Neil Horman 2008-10-23 14:54:41 UTC
*** Bug 468114 has been marked as a duplicate of this bug. ***

Comment 17 Larry Troan 2008-11-04 14:03:03 UTC
>Comment #14 From  Issue Tracker (tao) 2008-10-19 21:53:23 EDT [edited]
>---
>I confirmed this problem is fixed by using kexec-tools-1.102pre-46.el5.

Comment 20 errata-xmlrpc 2009-01-20 20:59:59 UTC
An advisory has been issued which should help the problem
described in this bug report. This report is therefore being
closed with a resolution of ERRATA. For more information
on therefore solution and/or where to find the updated files,
please follow the link below. You may reopen this bug report
if the solution does not work for you.

http://rhn.redhat.com/errata/RHBA-2009-0105.html


Note You need to log in before you can comment on or make changes to this bug.