Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package kdump for openSUSE:Factory checked in at 2023-07-28 22:19:52 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/kdump (Old) and /work/SRC/openSUSE:Factory/.kdump.new.32662 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "kdump" Fri Jul 28 22:19:52 2023 rev:137 rq:1101210 version:1.9.5 Changes: -------- --- /work/SRC/openSUSE:Factory/kdump/kdump.changes 2023-07-04 15:22:07.666114702 +0200 +++ /work/SRC/openSUSE:Factory/.kdump.new.32662/kdump.changes 2023-07-28 22:19:56.345043651 +0200 @@ -1,0 +2,16 @@ +Fri Jul 28 14:39:14 UTC 2023 - Jiri Bohac <jbo...@suse.com> + +upgrade to version 1.9.5 + * SELinux: temporary hack for bsc#1213721 + +------------------------------------------------------------------- +Thu Jul 27 17:59:54 UTC 2023 - Jiri Bohac <jbo...@suse.com> + +- upgrade to version 1.9.4 + * fix FADUMP initramfs when not created by mkdumprd + * FADUMP: let dracut de-duplicate initrd by preserving modification times + * mkdumprd: only regenerate FADUMP initrds when needed + * mkdumprd: exit when destination not writable (transactional updates) + * mkdumprd: don't call update-bootloader + +------------------------------------------------------------------- Old: ---- kdump-1.9.3.tar.xz New: ---- kdump-1.9.5.tar.xz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ kdump.spec ++++++ --- /var/tmp/diff_new_pack.zccFLf/_old 2023-07-28 22:19:57.113048320 +0200 +++ /var/tmp/diff_new_pack.zccFLf/_new 2023-07-28 22:19:57.117048344 +0200 @@ -53,7 +53,7 @@ %define dracutlibdir %{_prefix}/lib/dracut Name: kdump -Version: 1.9.3 +Version: 1.9.5 Release: 0 Summary: Kernel crash dump scripts and utilities License: GPL-2.0-or-later ++++++ kdump-1.9.3.tar.xz -> kdump-1.9.5.tar.xz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kdump-1.9.3/NEWS new/kdump-1.9.5/NEWS --- old/kdump-1.9.3/NEWS 2023-06-28 11:58:24.000000000 +0200 +++ new/kdump-1.9.5/NEWS 2023-07-28 16:37:45.000000000 +0200 @@ -1,3 +1,15 @@ +1.9.5 +----- + * SELinux: temporary hack for bsc#1213721 + +1.9.4 +----- + * fix FADUMP initramfs when not created by mkdumprd + * FADUMP: let dracut de-duplicate initrd by preserving modification times + * mkdumprd: only regenerate FADUMP initrds when needed + * mkdumprd: exit when destination not writable (transactional updates) + * mkdumprd: don't call update-bootloader + 1.9.3 ----- * fix calibrate diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kdump-1.9.3/calibrate/dummy-net.conf new/kdump-1.9.5/calibrate/dummy-net.conf --- old/kdump-1.9.3/calibrate/dummy-net.conf 2023-06-28 11:58:24.000000000 +0200 +++ new/kdump-1.9.5/calibrate/dummy-net.conf 2023-07-28 16:37:45.000000000 +0200 @@ -3,3 +3,4 @@ KDUMP_POSTSCRIPT="poweroff" KDUMP_COMMANDLINE_APPEND="ip=eth0:dhcp" KDUMP_NET_TIMEOUT=1 +KDUMP_HOST_KEY="*" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kdump-1.9.3/dracut/fadump-module-setup.sh new/kdump-1.9.5/dracut/fadump-module-setup.sh --- old/kdump-1.9.3/dracut/fadump-module-setup.sh 2023-06-28 11:58:24.000000000 +0200 +++ new/kdump-1.9.5/dracut/fadump-module-setup.sh 2023-07-28 16:37:45.000000000 +0200 @@ -1,5 +1,10 @@ #!/bin/bash +# this module is part of kdump +# for FADUMP, the kdump initrd is embedded in every system initrd +# A modified /init program determines whether to run the standard init +# or the one from the embedded kdump initrd + test -n "$KDUMP_LIBDIR" || KDUMP_LIBDIR=/usr/lib/kdump . "$KDUMP_LIBDIR"/kdump-read-config.sh || return 1 @@ -21,24 +26,11 @@ mkdir -p "$_fadumpdir" || return 1 dinfo "****** Generating FADUMP initrd *******" - local _initrd="$_fadumpdir/initrd" - local -a _dracut_args=( - "--force" - "--hostonly" - "--add" "kdump" - "--omit" "plymouth resume usrmount zz-fadumpinit" - "--no-compress" - "--no-early-microcode" - ) - - [[ -n "${KDUMP_DRACUT_MOUNT_OPTION}" ]] && _dracut_args+=("--mount" "${KDUMP_DRACUT_MOUNT_OPTION}") - - local _dracut="${dracut_cmd:-dracut}" - "$_dracut" "${_dracut_args[@]}" "$_initrd" "$kernel" || return 1 + mkdumprd -F -I "$_fadumpdir/initrd" -K "$kernel" || return 1 pushd "$_fadumpdir" || return 1 - lsinitrd --unpack "$_initrd" || return 1 + cpio -id --preserve-modification-time --quiet < initrd || return 1 + rm -f initrd popd - rm -f "$_initrd" dinfo "****** Generating FADUMP initrd done *******" mv -f "$initdir/init" "$initdir/init.dracut" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kdump-1.9.3/init/load.sh new/kdump-1.9.5/init/load.sh --- old/kdump-1.9.3/init/load.sh 2023-06-28 11:58:24.000000000 +0200 +++ new/kdump-1.9.5/init/load.sh 2023-07-28 16:37:45.000000000 +0200 @@ -370,8 +370,15 @@ # check if initrd and the kernel it was built for exist # return 6 if not, which is treated as success by # the kdump-early service -[[ -f "${kdump_initrd}" ]] || exit 6 -[[ -f "${kdump_kernel}" ]] || exit 6 + +# FIXME: This is a fragile SELinux workaround: use /bin/test instead of [[ ]] +# because it runs with a different label which by coincidence +# is allowed to dereference the symlink +# see bsc#1213721 +#[[ -f "${kdump_initrd}" ]] || exit 6 +#[[ -f "${kdump_kernel}" ]] || exit 6 +/bin/test -f "${kdump_initrd}" || exit 6 +/bin/test -f "${kdump_kernel}" || exit 6 if [ "$shrink" = yes ] ; then kdumptool calibrate --shrink > /dev/null diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kdump-1.9.3/init/mkdumprd new/kdump-1.9.5/init/mkdumprd --- old/kdump-1.9.3/init/mkdumprd 2023-06-28 11:58:24.000000000 +0200 +++ new/kdump-1.9.5/init/mkdumprd 2023-07-28 16:37:45.000000000 +0200 @@ -17,95 +17,30 @@ . /usr/lib/kdump/kdump-read-config.sh || exit 1 -KERNELVERSION= FORCE=false -QUIET=0 +QUIET=false DEBUG=false -DRACUT=/usr/bin/dracut -UPDATE_BOOTLOADER=/sbin/update-bootloader INITRD_DEFAULT=/var/lib/kdump/initrd INITRD=$INITRD_DEFAULT -# -# Prints usage. {{{ function usage() { - echo "mkdumprd - Create an initrd for kdump" - echo "" - echo "This script uses dracut(8) internally. Options:" - echo "" - echo " -k <kernel> or" - echo " -K <kernel> Overrides KDUMP_KERNELVER." - echo " -I <initrd> Output file for initrd ($INITRD_DEFAULT by default)" - echo " -f Force regeneration even if the configuration" - echo " did not change." - echo " -q Quiet (don't print status messages)." - echo " -d Output debug information of the initrd build process." - echo " -h Print this help." -} # }}} - -# -# Quiet message {{{ -function status_message() -{ - local msg=$1 - - if (( ! $QUIET )) ; then - echo ">>> $msg" - fi -} # }}} - -# -# Create a new initrd using dracut {{{ -function run_dracut() -{ - DRACUT_ARGS="--force --hostonly --no-hostonly-default-device --omit 'plymouth resume usrmount' $@" - - if [ -z "$KERNELVERSION" ] - then - KERNELVERSION=$(get_kernel_version "$KERNEL") - fi - - DRACUT_ARGS="$DRACUT_ARGS --add 'kdump' $INITRD $KERNELVERSION" - $DEBUG && DRACUT_ARGS="--debug $DRACUT_ARGS" - echo "Regenerating kdump initrd ..." >&2 - eval "bash -$- $DRACUT $DRACUT_ARGS" -} # }}} - -# -# Rebuild all initrds {{{ -function build_fadumprd() -{ - # With fadump, this script has no control over which kernel will - # be booted after a crash, but any installed kernel can be used - # to save the dump. Consequently, let dracut regenerate initrd - # for all installed kernels. - - DRACUT_ARGS="--force --regenerate-all" - $DEBUG && DRACUT_ARGS="--debug $DRACUT_ARGS" - echo "Regenerating all initrds ..." >&2 - eval "bash -$- $DRACUT $DRACUT_ARGS && type -P $UPDATE_BOOTLOADER &> /dev/null && $UPDATE_BOOTLOADER --refresh" - - # create an empty initrd file, the timestamp will be used to determine - # if initrds need to be regenerated - touch $INITRD -} # }}} - -# -# Build $INITRD with dump capture support using dracut {{{ -function build_initrd() -{ - get_mount - if [ "$KDUMP_FADUMP" = "true" ] ; then - build_fadumprd - else - [[ -n "${KDUMP_DRACUT_MOUNT_OPTION}" ]] && KDUMP_DRACUT_MOUNT_OPTION="--mount \"$KDUMP_DRACUT_MOUNT_OPTION\"" - run_dracut --compress \'xz -0 --check=crc32\' ${KDUMP_DRACUT_MOUNT_OPTION} - fi -} # }}} + echo "mkdumprd - Create an initrd for kdump" + echo "" + echo "This script uses dracut(8) internally. Options:" + echo "" + echo " -k <kernel> or" + echo " -K <kernel> Overrides KDUMP_KERNELVER." + echo " -I <initrd> Output file for initrd ($INITRD_DEFAULT by default)" + echo " -f Force regeneration even if the configuration" + echo " did not change." + echo " -q Quiet (don't print status messages)." + echo " -d Output debug information of the initrd build process." + echo " -h Print this help." + echo " -F internal, don't use; build embedded FADUMP initrd" +} -# exports KDUMP_DRACUT_MOUNT_OPTION for targets mounted by dracut -# For FADUMP builds, this will be propagated to zz-fadumpinit module +# sets KDUMP_DRACUT_MOUNT_OPTION for targets mounted by dracut function get_mount() { # dracut needs to mount the target directory for the @@ -120,7 +55,7 @@ read -r SOURCE TARGET FS OPTIONS < <(findmnt -n -v --raw --target "${KDUMP_SAVEDIR_REALPATH}" --output=source,target,fstype,options) || error "Cannot find mount point for ${KDUMP_SAVEDIR#*://}" TARGET="${MOUNTPOINT}${TARGET}" - export KDUMP_DRACUT_MOUNT_OPTION="${SOURCE} ${TARGET} ${FS} ${OPTIONS}" + KDUMP_DRACUT_MOUNT_OPTION="${SOURCE} ${TARGET} ${FS} ${OPTIONS}" ;; cifs) # split URL into host, directory, user and password parts @@ -137,7 +72,7 @@ [[ ${PW} == ${UPW} ]] && PW="" fi - export KDUMP_DRACUT_MOUNT_OPTION="//${HOST}${DIR} ${MOUNTPOINT} cifs user=$USER,password=$PW" + KDUMP_DRACUT_MOUNT_OPTION="//${HOST}${DIR} ${MOUNTPOINT} cifs user=$USER,password=$PW" ;; nfs) # split URL into host, directory, user and password parts @@ -145,14 +80,43 @@ DIR="/${URL#*/}" HOST="${URL%%/*}" - export KDUMP_DRACUT_MOUNT_OPTION="${HOST}:${DIR} ${MOUNTPOINT} nfs nolock" + KDUMP_DRACUT_MOUNT_OPTION="${HOST}:${DIR} ${MOUNTPOINT} nfs nolock" ;; *) - export KDUMP_DRACUT_MOUNT_OPTION="" + KDUMP_DRACUT_MOUNT_OPTION="" ;; esac } +# check if config has changed since a given initrd has been generated +function initrd_up_to_date() +{ + local INITRD=$1 + + # no initrd yet + [[ -f "$INITRD" ]] || return 1 + + # config changed + [[ /etc/sysconfig/kdump -ot "$INITRD" ]] || return 1 + + # network settings changed + if [[ $KDUMP_PROTO != file ]]; then + [[ /etc/hosts -ot "$INITRD" ]] || return 1 + [[ /etc/nsswitch.conf -ot "$INITRD" ]] || return 1 + + # SSH keys changed + if [[ $KDUMP_PROTO == ssh ]] || [[ $KDUMP_PROTO == sftp ]]; then + pushd ~root/.ssh >/dev/null #identity files are relative to this directory + [[ -z "${KDUMP_SSH_IDENTITY}" ]] && KDUMP_SSH_IDENTITY="id_rsa id_dsa id_ecdsa id_ed25519" + for i in ${KDUMP_SSH_IDENTITY}; do + [[ -f "${i}.pub" ]] && [[ "${i}.pub" -ot "$INITRD" ]] || return 1 + done + popd + fi + fi + return 0 +} + function error() { echo "$1" >&2 @@ -161,7 +125,7 @@ # Option parsing {{{ -while getopts "hfqk:K:I:d" name ; do +while getopts "hfqk:K:I:dF" name ; do case $name in f) FORCE=true ;; @@ -170,7 +134,7 @@ exit 0 ;; - q) QUIET=1 + q) QUIET=true ;; k|K) KDUMP_KERNELVER="$OPTARG" @@ -180,16 +144,65 @@ ;; d) DEBUG=true + set -x ;; + F) FADUMP_INTERNAL=true + ;; + ?) usage exit 1 ;; esac done shift $(($OPTIND -1)) - # }}} +# With FADUMP, we don't know which kernel will be booted after a crash. +# Kdump initrd is embedded in all standard initrds by the zz-fadumpinit module +# which calls this script with -F. +# +# If we're called in any other way (i.e. without -F), we +# regenerate all initrds that are not up to date using dracut. +# zz-fadumpinit will call us again with -F to build the kdump part of each initrd. +if [[ "$KDUMP_FADUMP" == "true" ]] && [[ "$FADUMP_INTERNAL" != "true" ]]; then + DEBUG_ARG="" + $DEBUG && DEBUG_ARG="--debug" + + # cycle through all installed kernels + # (based on dracut's handling of --regenerate-all) + cd /lib/modules || exit 1 + RET=0 + for i in *; do + [[ -f $i/modules.dep ]] || [[ -f $i/modules.dep.bin ]] || continue + [[ -d $i/kernel ]] || continue + INITRD="/boot/initrd-$i" + ABS_INITRD=$(readlink -f "$INITRD") && INITRD="$ABS_INITRD" + + UPDATE=$FORCE + # config changed or INITRD does not exist? + $UPDATE || initrd_up_to_date "$INITRD" || UPDATE=true + + if ! $UPDATE; then + # initrd up to date, nothing to do + $QUIET || echo "Not regenerating $INITRD. Use mkdumprd -f to force regeneration." + continue + fi + + if ! [[ -w /boot ]]; then + echo "/boot not writable, not regenerating initrds." + exit 0 + fi + + echo "Regenerating $INITRD ..." >&2 + dracut --force --kver="$i" $DEBUG_ARG + ((RET += $?)) + done + + # remove the kernel symlink and $INITRD_DEFAULT, they are not used for FADUMP + rm -f /var/lib/kdump/kernel "$INITRD_DEFAULT" + + exit "$RET" +fi # KDUMP_KERNELVER may be an absolute path name or a kernel version if [[ ${KDUMP_KERNELVER:0:1} == "/" ]]; then @@ -226,43 +239,65 @@ # check if we need to regenerate the initrd UPDATE=$FORCE -# no initrd yet -[[ -f "$INITRD" ]] || UPDATE=true +# config changed or INITRD does not exist? +$UPDATE || initrd_up_to_date "$INITRD" || UPDATE=true -# kernel changed +# kernel changed? KERNEL_CURRENT=$(realpath -qe /var/lib/kdump/kernel) [[ "$KERNEL_REALPATH" == "$KERNEL_CURRENT" ]] || UPDATE=true -# config changed -[[ /etc/sysconfig/kdump -ot "$INITRD" ]] || UPDATE=true +if ! $UPDATE; then + # initrd is up to date, nothing to do + $QUIET || echo "Not regenerating kdump initrd. Use mkdumprd -f to force regeneration." + exit 0 +fi -# network settings changed -if [[ $KDUMP_PROTO != file ]]; then - [[ /etc/hosts -ot "$INITRD" ]] || UPDATE=true - [[ /etc/nsswitch.conf -ot "$INITRD" ]] || UPDATE=true - - # SSH keys changed - if [[ $KDUMP_PROTO == ssh ]] || [[ $KDUMP_PROTO == sftp ]]; then - pushd ~root/.ssh >/dev/null #identity files are relative to this directory - [[ -z "${KDUMP_SSH_IDENTITY}" ]] && KDUMP_SSH_IDENTITY="id_rsa id_dsa id_ecdsa id_ed25519" - for i in ${KDUMP_SSH_IDENTITY}; do - [[ -f "${i}.pub" ]] && [[ "${i}.pub" -ot "$INITRD" ]] || UPDATE=true - done - popd - fi +INITRD_DIR=$(dirname "$INITRD") +if ! [[ -w "$INITRD_DIR" ]]; then + echo "$INITRD_DIR not writable, not regenerating initrd." + exit 0 +fi + +# transactional update has a fake /var +if [[ -n "$TRANSACTIONAL_UPDATE" ]] && [[ "$FADUMP_INTERNAL" != "true" ]]; then + echo "Cannot update initrd within a transactional update." + exit 0 fi -if $UPDATE; then - build_initrd || exit $? +# build the initrd +get_mount + +KERNELVERSION=$(get_kernel_version "$KERNEL") +declare -a DRACUT_ARGS +# arguments common with FADUMP +DRACUT_ARGS=( + "--force" + "--hostonly" + "--no-hostonly-default-device" + "--add" "kdump" + "--omit" "plymouth resume usrmount zz-fadumpinit" +) + +[[ -n "${KDUMP_DRACUT_MOUNT_OPTION}" ]] && DRACUT_ARGS+=("--mount" "${KDUMP_DRACUT_MOUNT_OPTION}") +$DEBUG && DRACUT_ARGS+=("--debug") + +if [[ "$FADUMP_INTERNAL" == "true" ]]; then + # additional FADUMP arguments + DRACUT_ARGS+=( + "--no-compress" + "--no-early-microcode" + ) else - status_message "Not regenerating kdump initrd. Use mkdumprd -f to force regeneration." - exit 0 + # additional non-FADUMP arguments + DRACUT_ARGS+=( + "--compress" "xz -0 --check=crc32" + ) fi +echo "Regenerating kdump initrd ..." >&2 +dracut "${DRACUT_ARGS[@]}" "$INITRD" "$KERNELVERSION" || exit # if we're rebuilding the default INITRD, update the kernel symlink # to point to the kernel image the initrd was just built for [[ "$INITRD" == "$INITRD_DEFAULT" ]] && ln -sf "$KERNEL_REALPATH" /var/lib/kdump/kernel - - -# vim: set ts=4 sw=4 et fdm=marker: :collapseFolds=1: +exit 0