diff -u kexec-tools-2.0.1/debian/rules kexec-tools-2.0.1/debian/rules --- kexec-tools-2.0.1/debian/rules +++ kexec-tools-2.0.1/debian/rules @@ -20,6 +20,8 @@ CFLAGS += -O2 endif +DEB_HOST_ARCH := $(shell dpkg-architecture -qDEB_HOST_ARCH) + configure: patch configure-stamp configure-stamp: dh_testdir @@ -64,8 +66,10 @@ # Add here commands to install the package into debian/tmp. $(MAKE) install DESTDIR=$(CURDIR)/debian/kexec-tools +ifneq (,$(filter $(DEB_HOST_ARCH),i386 amd64 powerpc ia64)) install -D -m755 debian/kdump.initramfs \ debian/kexec-tools/usr/share/initramfs-tools/scripts/init-bottom/0_kdump +endif ifeq (,$(findstring nostrip,$(DEB_BUILD_OPTIONS))) [ ! -f $(CURDIR)/debian/kexec-tools/usr/lib/kexec-tools-testing/kexec_test.static ] || strip $(CURDIR)/debian/kexec-tools/usr/lib/kexec-tools-testing/kexec_test.static endif diff -u kexec-tools-2.0.1/debian/changelog kexec-tools-2.0.1/debian/changelog --- kexec-tools-2.0.1/debian/changelog +++ kexec-tools-2.0.1/debian/changelog @@ -1,3 +1,20 @@ +kexec-tools (1:2.0.1-2ubuntu5) natty-proposed; urgency=low + + * Backport changes to fix kdump functionality. LP: #828731. + - debian/kdump.initramfs: call /usr/bin/makedumpfile via a chroot command, + so that if makedumpfile is statically linked, we get proper library + resolution. Thanks to Louis Bouchard for + the patch. LP: #785425. + - debian/kdump.initramfs: handle the possibility that /usr, /boot, or + /var is on a separate filesystem and needs to be manually mounted before + calling makedumpfile. LP: #828731. + - Depend on makedumpfile, without which the initramfs script doesn't work. + - Fix an unnecessary bashism. + - Only install the kdump initramfs script and depend on makedumpfile on + architectures that makedumpfile supports. + + -- Chris J Arges Wed, 18 Jan 2012 17:05:10 -0600 + kexec-tools (1:2.0.1-2ubuntu4) natty; urgency=low * --no-undefined is a linker option, not a gcc option. diff -u kexec-tools-2.0.1/debian/control kexec-tools-2.0.1/debian/control --- kexec-tools-2.0.1/debian/control +++ kexec-tools-2.0.1/debian/control @@ -8,7 +8,7 @@ Package: kexec-tools Architecture: i386 amd64 ppc64 powerpc ia64 s390 arm armel -Depends: ${shlibs:Depends}, ${misc:Depends}, debconf, initramfs-tools +Depends: ${shlibs:Depends}, ${misc:Depends}, debconf, initramfs-tools, makedumpfile [i386 amd64 powerpc ia64] Description: kexec tool for kexec reboots This tool is used to load a kernel in memory and reboot into the kernel loaded in memory using the kexec system call. diff -u kexec-tools-2.0.1/debian/kdump.initramfs kexec-tools-2.0.1/debian/kdump.initramfs --- kexec-tools-2.0.1/debian/kdump.initramfs +++ kexec-tools-2.0.1/debian/kdump.initramfs @@ -14,9 +14,9 @@ esac KVER="`uname -r`" -INFO="$rootmnt/boot/vmcoreinfo-$KVER" -CRASHFILE="$rootmnt/var/crash/vmcore" -MAKEDUMPFILE="$rootmnt/usr/bin/makedumpfile" +INFO="/boot/vmcoreinfo-$KVER" +CRASHFILE="/var/crash/vmcore" +MAKEDUMPFILE="/usr/bin/makedumpfile" LOG="$rootmnt/var/crash/vmcore.log" VMCORE="/proc/vmcore" @@ -28,25 +28,54 @@ . ./scripts/functions +# Unconditionally mount /dev in the target, in case it's needed. +mount -n --bind /dev ${rootmnt}/dev + +# Check if any additional filesystems need to be mounted in order to run +# makedumpfile +# We assume that the system rootfs is now mounted on ${rootmnt} +for target in /usr /boot /var +do + # We write to /var; everything else should be mounted ro + if [ "$target" = /var ]; then + opts= + else + opts=-oro + fi + if [ -n "$(awk '$2 == "'$target'" { print $2 }' ${rootmnt}/etc/fstab)" ] + then + chroot ${rootmnt} mount -n $opts $target + mounted="$target $mounted" + fi +done + # Make sure makedumpfile assumptions are satisfied. -while ! test -e "$INFO"; do +while ! test -e "$rootmnt/$INFO"; do panic "kdump: Missing $INFO" done -while ! test -x "$MAKEDUMPFILE"; do - panic "kdump: Missing $MAKEDUMPFILE" + +while ! test -x "$rootmnt/$MAKEDUMPFILE"; do + panic "kdump: Missing $rootmnt/$MAKEDUMPFILE" done log_begin_msg "Saving vmcore from kernel crash" mount $rootmnt -o remount,rw +mount -n --bind /proc $rootmnt/proc + # Delete it if the copy fails, mainly to keep from filling up filesystems # by accident. # -$MAKEDUMPFILE -E -d 31 -i $INFO $VMCORE $CRASHFILE > $LOG 2>&1 || \ - rm -f $CRASHFILE +chroot $rootmnt $MAKEDUMPFILE -E -d 31 -i $INFO $VMCORE $CRASHFILE > $LOG 2>&1 || \ + rm -f $rootmnt/$CRASHFILE + +chmod 400 $rootmnt/$CRASHFILE -chmod 400 $CRASHFILE +# Unmount any extra filesystems we had to mount +for target in $mounted; do + umount -n ${rootmnt}$target +done mount $rootmnt -o remount,ro reboot