Re: [PATCH 0/2] Debian mkinitrd: Integrate kdump
On Tue, Aug 30, 2005 at 02:59:15AM -0400, Andres Salomon wrote: On Tue, 2005-08-30 at 12:23 +0530, Rachita Kothiyal wrote: [...] I had sent the patch to Jeff Bailey, Bastian Blank, Steve Langasek and the debian-kernel list. But have not received any comments from them so far. We have been considering porting this solution to the initramfs approach also, but since initrd is more widely used thought it to be a better platform. When in the future do you think this switch to initramfs will happen? Now that 2.6.13 is out (with its dropped devfs support, which initrd-tools requires atm), one of two things will happen; we'll either port initrd-tools to support non-devfs (unlikely), re-add devfs to 2.6.13, or switch to initramfs. I'm going to be playing around w/ it soon, so I have a better idea which would be the best solution. Thanks Andres for the info. kexec/kdump kernel code has been merged with 2.6 mainline since 2.6.13-rc1. I was wondering whom shall I contact for kdump integration on Debian. Having initrd/initramfs support for kdump is just one of things needed for kdump integration. Other stuffs like including the user space kexec-tools with kdump support with Debian distribution, enabling CONFIG_KEXEC in Debian kernel, and packaging dump capture kernel etc. Thanks Rachita PS: Putting debian-kernel again on CC. -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of unsubscribe. Trouble? Contact [EMAIL PROTECTED]
Re: [PATCH 0/2] Debian mkinitrd: Integrate kdump
On Tue, Aug 30, 2005 at 11:08:59AM -0600, dann frazier wrote: On Tue, 2005-08-30 at 15:18 +0530, Rachita Kothiyal wrote: On Tue, Aug 30, 2005 at 02:59:15AM -0400, Andres Salomon wrote: On Tue, 2005-08-30 at 12:23 +0530, Rachita Kothiyal wrote: [...] I had sent the patch to Jeff Bailey, Bastian Blank, Steve Langasek and the debian-kernel list. But have not received any comments from them so far. We have been considering porting this solution to the initramfs approach also, but since initrd is more widely used thought it to be a better platform. When in the future do you think this switch to initramfs will happen? Now that 2.6.13 is out (with its dropped devfs support, which initrd-tools requires atm), one of two things will happen; we'll either port initrd-tools to support non-devfs (unlikely), re-add devfs to 2.6.13, or switch to initramfs. I'm going to be playing around w/ it soon, so I have a better idea which would be the best solution. Thanks Andres for the info. kexec/kdump kernel code has been merged with 2.6 mainline since 2.6.13-rc1. I was wondering whom shall I contact for kdump integration on Debian. Having initrd/initramfs support for kdump is just one of things needed for kdump integration. Other stuffs like including the user space kexec-tools with kdump support with Debian distribution, enabling CONFIG_KEXEC in Debian kernel, and packaging dump capture kernel etc. fyi, Khalid Aziz has packaged kexec-tools and will be uploading it RSN. Hi Khalid, I was wondering if you have picked up the kdump patches to kexec-tools also. As the kexec-tools-1.101 doesnot support kdump. There is a consolidated patch to kexec-tools-1.101 to support kdump at this link http://lse.sf.net/kdump/patches/kexec-tools-1.101-kdump.patch Please let us know if that works out for you. Thanks Rachita -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of unsubscribe. Trouble? Contact [EMAIL PROTECTED]
Error while using mkinitrd of the initrd-tools (0.1.82) package
Hi Following the change in the 'module_exists()' in the latest version of mkinitrd, I encounter the following error when I use mkinitrd to build an initrd. find: /lib/modules/2.6.13-rc5/kernel/drivers/ide: No such file or directory My kernel has ide built in the kernel. The problem, I suspect, lies in the print_ide_modules() call which assigns none to $IDE_CORE and further calls print_module with 'drivers/ide/ide-disk'. The module_exists() then complains as it does not find any /lib/modules/2.6.13-rc5/kernel/drivers/ide directory. Could probably have a check to see whether the required directory exists before calling print_module() as follows: --- mkinitrd.orig 2005-08-24 13:35:57.0 +0530 +++ mkinitrd2005-08-24 13:39:58.0 +0530 @@ -469,7 +469,9 @@ print_ide_modules() { ;; *) IDE_CORE=none - print_module drivers/ide/ide-disk + if [ -d $MODULEDIR/kernel/drivers/ide ]; then + print_module drivers/ide/ide-disk + fi return ;; esac Thanks Rachita. -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of unsubscribe. Trouble? Contact [EMAIL PROTECTED]
[PATCH 0/2] Debian mkinitrd: Integrate kdump
Hi The following set of patches made on mkinitrd (from initrd-tools package:version 0.1.82), would enable the integration of kdump with Debian. For more details about the kexec based kdump solution please refer to Documentation/kdump/kdump.txt in the kernel source tree. This first patch (to be applied on the mkinitrd), would enable the generation of the initrd for the dump capture kernel. Usage: mkinitrd -c dump_dev -f file_system -o out-file kernel-version The second patch would enable the user to generate the initrd for the first or the regular kernel. This initrd will package the second kernel or the dump capture kernel along with its initrd, the kexec-tools user space application (needed to load the dump capture kernel). Usage: mkinitrd -i capture_initrd -v capture_kernel -o out_file kernel-version The user would then need to boot to the first kernel with this initrd. Incase of a panic/crash, the system will automatically boot to the capture kernel. The capture kernel's initrd will copy the dump and reboot the system back to regular kernel. This is a series patch set. Pls apply as follows on the mkinitrd: 1. capture_initrd.patch 2. first_initrd.patch Please let me know your comments. Thanks Rachita -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of unsubscribe. Trouble? Contact [EMAIL PROTECTED]
[PATCH 1/2] Debian mkinitrd: initrd for automatically saving kdump
The following patch implements the feature to generate a special initrd to automatically save the kdump. --- mkinitrd.orig 2005-08-24 18:21:04.0 +0530 +++ mkinitrd2005-08-24 18:22:17.0 +0530 @@ -99,6 +99,8 @@ Options: -m command Set the command to make an initrd image. -o outfile Write to outfile. -r root Override ROOT setting in mkinitrd.conf. + -c dump_device Copy dump to this device + -f dump_dev_fs Filesystem on the dump device See mkinitrd(8) for further details. EOF @@ -1121,8 +1123,11 @@ gendir() { echo 'unix 2 /dev/null' echo '. swsusp 2 /dev/null' 7 } 3 - [ -z $ROOT ] || probe + [ -z $ROOT -o $kdump_capture -eq 1 ] || probe + if [ $kdump_capture -eq 1 ]; then + getroot $dump_dev + fi exec 3- 4- 5- 6- mkdir initrd @@ -1207,6 +1212,7 @@ gendir() { /bin/mount /bin/umount \ /sbin/pivot_root /bin/cat /bin/mknod \ /usr/sbin/chroot /bin/uname \ + $([ $kdump_capture -eq 1 ] find /bin /sbin -name dd find /bin /sbin -name reboot) \ `command -v stat` $readlink \ `cat $@ exe` do @@ -1279,10 +1285,17 @@ gendir() { esac cd initrd - mkdir -p dev2 devfs etc keyscripts mnt proc scripts sys tmp var + mkdir -p dev2 devfs etc keyscripts mnt proc scripts sys tmp var `[ $kdump_capture -eq 1 ] echo 'dump'` etc/mtab + if [ $kdump_capture -eq 1 -a ! -b ${dump_dev#/} ]; then +dump_maj=$(ls -l $dump_dev | cut -d -f 6 | cut -d , -f 1) +dump_min=$(ls -l $dump_dev | cut -d-f 7) + dev_type=$(ls -l $dump_dev | cut -c 1) + mknod ${dump_dev#/} $dev_type $dump_maj $dump_min + DEVLINKS=$DEVLINKS ${dump_dev#/dev/} + fi devices= for i in \ cciss ida ide scsi md mapper $DEVLINKS @@ -1301,15 +1314,28 @@ gendir() { fi INITRDDIR=$dir/initrd MODULEDIR=$MODULEDIR VERSION=$VERSION \ run-parts $CONFDIR/scripts + + if [ $kdump_capture -eq 1 ]; then + echo mount -t $dump_fs $dump_dev /dump +echo Copying the dump +dd if=/proc/vmcore of=/dump/dumpfile +umount /dump +echo Rebooting the system +reboot -f script + fi } ORIGDIR=`pwd` PROG=$0 +dump_dev= +dump_fs= +kdump_capture=0 + CONFDIR=/etc/mkinitrd unset keep croot cmkimage out || : -while getopts d:km:o:r: flag; do +while getopts d:km:o:r:c:f: flag; do case $flag in d) CONFDIR=$OPTARG @@ -1332,6 +1358,12 @@ while getopts d:km:o:r: flag; do r) croot=$OPTARG ;; + c) + dump_dev=$OPTARG + ;; + f) + dump_fs=$OPTARG + ;; *) usage ;; @@ -1343,6 +1375,20 @@ if ! [ $out ] || [ $# -gt 1 ]; then usage fi +if [ -z $dump_dev -a -z $dump_fs ]; then + kdump_capture=0 +elif [ -z $dump_dev -a ! -z $dump_fs ]; then + echo 'Please specify a dump device' + usage + exit 1 +elif [ ! -z $dump_dev -a -z $dump_fs ]; then + echo 'Please specify a filesystem for the dump device' + usage + exit 1 +else + kdump_capture=1 +fi + VERSION=$1 [ $# -gt 0 ] || unset VERSION case $VERSION in -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of unsubscribe. Trouble? Contact [EMAIL PROTECTED]
[PATCH 2/2] Debian mkinitrd: initrd for automatically loading dump capture kernel
The following patch provides feature to generate special initrd for regular kernel which can load the dump capture kernel while booting. --- mkinitrd.orig 2005-08-24 18:55:49.0 +0530 +++ mkinitrd2005-08-24 18:55:44.0 +0530 @@ -101,6 +101,8 @@ Options: -r root Override ROOT setting in mkinitrd.conf. -c dump_device Copy dump to this device -f dump_dev_fs Filesystem on the dump device + -i initrd Capture kernel's initrd + -v kernel_image Capture kernel (vmlinux only for now) See mkinitrd(8) for further details. EOF @@ -1213,6 +1215,9 @@ gendir() { /sbin/pivot_root /bin/cat /bin/mknod \ /usr/sbin/chroot /bin/uname \ $([ $kdump_capture -eq 1 ] find /bin /sbin -name dd find /bin /sbin -name reboot) \ + $([ $auto_kdump -eq 1 ] for i in `find / -noleaf -type f -name kexec`; do + echo $i; break; + done ) \ `command -v stat` $readlink \ `cat $@ exe` do @@ -1289,6 +1294,12 @@ gendir() { etc/mtab + if [ $auto_kdump -eq 1 ]; then + cp $capture_initrd capture_initrd + cp $capture_kernel capture_kernel + fi + + if [ $kdump_capture -eq 1 -a ! -b ${dump_dev#/} ]; then dump_maj=$(ls -l $dump_dev | cut -d -f 6 | cut -d , -f 1) dump_min=$(ls -l $dump_dev | cut -d-f 7) @@ -1323,6 +1334,13 @@ umount /dump echo Rebooting the system reboot -f script fi + + if [ $auto_kdump -eq 1 ]; then + echo mount -t sysfs sys /sys +echo Kexec loading the capture kernel +`find . -name kexec` -p capture_kernel --args-linux --crash-dump --initrd=capture_initrd --append='root=$device init 1' +echo Kexec loading done script + fi } ORIGDIR=`pwd` @@ -1331,11 +1349,12 @@ PROG=$0 dump_dev= dump_fs= kdump_capture=0 +auto_kdump=0 CONFDIR=/etc/mkinitrd unset keep croot cmkimage out || : -while getopts d:km:o:r:c:f: flag; do +while getopts d:km:o:r:c:f:i:v: flag; do case $flag in d) CONFDIR=$OPTARG @@ -1364,6 +1383,12 @@ while getopts d:km:o:r:c:f: flag; do f) dump_fs=$OPTARG ;; + i) + capture_initrd=$OPTARG + ;; + v) + capture_kernel=$OPTARG + ;; *) usage ;; @@ -1389,6 +1414,36 @@ else kdump_capture=1 fi +if [ $kdump_capture -eq 0 ]; then + if [ -z $capture_initrd -a -z $capture_kernel ]; then + auto_kdump=0 + elif [ ! -z $capture_initrd -a -z $capture_kernel ]; then + echo 'Please specify the capture kernel' + usage + exit 1 + elif [ -z $capture_initrd -a ! -z $capture_kernel ]; then + echo Please specify the capture kernel's initrd + usage + exit 1 + else + if [ ! -e $capture_initrd ]; then + echo Capture kernel initrd $capture_initrd does not exist...Aborting + exit 1 + fi + if [ ! -e $capture_kernel ]; then + echo Capture kernel image $capture_kernel does not exist...Aborting + exit 1 + else + if [ $(file $capture_kernel | cut -d -f 2) != ELF ]; then + echo Capture kernel image $capture_kernel is not an ELF \ + executable...Aborting + exit 1 + fi + fi + auto_kdump=1 + fi +fi + VERSION=$1 [ $# -gt 0 ] || unset VERSION case $VERSION in -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of unsubscribe. Trouble? Contact [EMAIL PROTECTED]
Re: [RFC] Debian mkinitrd patch for saving kdump - take2
On Wed, Aug 17, 2005 at 03:56:09PM +0530, Rachita Kothiyal wrote: Hi Jeff, As Vivek discussed with you in OLS regarding saving dump images from initrd, I have come up with an initial patch to mkinitrd on Debian unstable. This modifies the mkinitrd script to generate a custom initrd for dump capture kernel aka second kernel. This can help in saving the kdump memory image to the specified device and filesystem before mounting root filesystem. This is quite a crude patch just to convey the approach and has some things in the todo list. As of now it assumes that the dump device (disk partition) uses the same modules as the root device. ToDo: 1. Refine the script by providing better error handling 2. Automatically detecting filesystem for the dump device, if possible. 3. Finding required modules for accessing the dump device. 4. Network based dump device Usage: mkinitrd -k -o destination -c dump_dev -f dump_dev_fs kernel_version Example: mkinitrd -k -o /boot/initrd-capture-kernel.img -c /dev/hda7 -f ext2 2.6.13-rc5 In this attempt, I have tried to provide better error handling and also handle the module loading required for accessing the dump device. Please let me know your comments. Thanks Rachita --- ../../mkinitrd-orig 2005-08-16 16:13:34.0 +0530 +++ ../../mkinitrd-mod/mkinitrd-8.182005-08-22 19:35:27.0 +0530 @@ -99,6 +99,8 @@ Options: -m command Set the command to make an initrd image. -o outfile Write to outfile. -r root Override ROOT setting in mkinitrd.conf. + -c dump_device Copy dump to this device + -f dump_dev_fs Filesystem on the dump device See mkinitrd(8) for further details. EOF @@ -1122,6 +1124,15 @@ gendir() { } 3 [ -z $ROOT ] || probe + if [ $dump_enable -eq 1 ]; then + root_maj=$(ls -l $device | cut -d -f 6 | cut -d , -f 1) + dump_maj=$(ls -l $dump_dev | cut -d -f 6 | cut -d , -f 1) + dump_min=$(ls -l $dump_dev | cut -d-f 7) + + if [ $root_maj -ne $dump_maj ]; then + getroot $dump_dev + fi + fi exec 3- 4- 5- 6- mkdir initrd @@ -1206,6 +1217,7 @@ gendir() { /bin/mount /bin/umount \ /sbin/pivot_root /bin/cat /bin/mknod \ /usr/sbin/chroot /bin/uname \ + $([ $dump_enable -eq 1 ] find /bin /sbin -name dd find /bin /sbin -name reboot) \ `command -v stat` $readlink \ `cat $@ exe` do @@ -1277,10 +1289,15 @@ gendir() { esac cd initrd - mkdir -p dev2 devfs etc keyscripts mnt proc scripts sys tmp var + mkdir -p dev2 devfs etc keyscripts mnt proc scripts sys tmp var `[ $dump_enable -eq 1 ] echo 'dump'` etc/mtab + if [ $dump_enable -eq 1 -a ! -b ${dump_dev#/} ]; then + dev_type=$(ls -l $dump_dev | cut -c 1) + mknod ${dump_dev#/} $dev_type $dump_maj $dump_min + DEVLINKS=$DEVLINKS ${dump_dev#/dev/} + fi devices= for i in \ cciss ida ide scsi md mapper $DEVLINKS @@ -1299,15 +1316,28 @@ gendir() { fi INITRDDIR=$dir/initrd MODULEDIR=$MODULEDIR VERSION=$VERSION \ run-parts $CONFDIR/scripts + + if [ $dump_enable -eq 1 ]; then + echo mount -t $dump_fs $dump_dev /dump +echo Copying the dump +dd if=/proc/vmcore of=/dump/dumpfile +umount /dump +echo Rebooting the system +reboot -f script + fi } ORIGDIR=`pwd` PROG=$0 +dump_dev= +dump_fs= +dump_enable=0 + CONFDIR=/etc/mkinitrd unset keep croot cmkimage out || : -while getopts d:km:o:r: flag; do +while getopts d:km:o:r:c:f: flag; do case $flag in d) CONFDIR=$OPTARG @@ -1330,6 +1360,12 @@ while getopts d:km:o:r: flag; do r) croot=$OPTARG ;; + c) + dump_dev=$OPTARG + ;; + f) + dump_fs=$OPTARG + ;; *) usage ;; @@ -1341,6 +1377,20 @@ if ! [ $out ] || [ $# -gt 1 ]; then usage fi +if [ -z $dump_dev -a -z $dump_fs ]; then + dump_enable=0 +elif [ -z $dump_dev -a ! -z $dump_fs ]; then + echo 'Please specify a dump device' + usage + exit 1 +elif [ ! -z $dump_dev -a -z $dump_fs ]; then + echo 'Please specify a filesystem for the dump device' + usage + exit 1 +else + dump_enable=1 +fi + VERSION=$1 [ $# -gt 0 ] || unset VERSION case $VERSION in -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of unsubscribe. Trouble? Contact [EMAIL PROTECTED]