Comment 14 for bug 785425

Revision history for this message
Steve Langasek (vorlon) wrote : Re: [Bug 785425] Re: 0_kdump uses dynamic makedumpfile(8) binary, which fails horribly

On Wed, Nov 23, 2011 at 01:39:47PM -0000, Louis Bouchard wrote:
> So I've ran a new test by revoking both proposed patches and using the
> following syntax in /usr/share/initramfs-tools/scripts/init-
> bottom/0_kdump :

> --- 0_kdump.orig 2011-11-23 14:32:29.113580047 +0100
> +++ 0_kdump 2011-11-23 14:22:35.232067873 +0100
> @@ -19,6 +19,7 @@
> MAKEDUMPFILE="$rootmnt/usr/bin/makedumpfile"
> LOG="$rootmnt/var/crash/vmcore.log"
> VMCORE="/proc/vmcore"
> +export LD_LIBRARY_PATH="/root/lib:/root/usr/lib:/root/lib/x86_64-linux-gnu"

> # Check that this is a kexec kernel.
> grep -q kdump_needed /proc/cmdline || exit 0

> Using the LD_LIBRARY_PATH here does allow for the dynamically-linked
> makedumpfile to work adequately.

> So this confirms Colin's statement. I have yet to verify if this is the
> best place to make use of the LD_LIBRARY_PATH and to make it more
> generic.

> So I will remove the previous patches and post the new one once ready.

It's somewhat unusual to call programs from the root filesystem via the
initramfs; instead of setting an LD_LIBRARY_PATH, I would suggest modifying
this script to chroot into the root mount point and running directly from
there.

(I would normally suggest copying the binary and its libraries into the
initramfs, but that may not be worthwhile here simply because the script
needs to write to the rootfs.)

If that's not practical for whatever reason, please at least use the
$rootmnt variable instead of hard-coding the /root path.

BTW, this is not very safe either:

  mount $rootmnt -o remount,rw

because there's no fsck before mounting, which is always done in the normal
boot case.

And there's no guarantee at all that /var/crash will be on the root
filesystem at all, as opposed to a submount for /var, which could make it
very difficult to find this data after reboot. But I suppose these are
comparatively minor bugs.

--
Steve Langasek Give me a lever long enough and a Free OS
Debian Developer to set it on, and I can move the world.
Ubuntu Developer http://www.debian.org/
<email address hidden> <email address hidden>