[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#696943: /etc/initramfs/post-update.d/zz-zipl script invokes zipl unnecessarily at times



Package: s390-tools
Version: 1.16.0-2
Severity: wishlist

The /etc/initramfs/post-update.d/zz-zipl script sometimes invokes zipl
when it doesn't need to do so, resulting in zipl being run twice.
For example, during an "aptitude full-upgrade" or "aptitude safe-upgrade"
command, a kernel image package may be updated.  The hook scripts in
directory /etc/kernel/postinst.d are invoked twice: once during the
pre-configuration phase and once during the configuration phase.
The /etc/kernel/postinst.d/initramfs-tools hook script checks to see
what phase it's in, and returns to its caller with no action taken
during the pre-configuration phase; but during the configuration phase
it invokes update-initramfs.  update-initramfs in turn invokes run-parts
to execute the hooks in /etc/initramfs/post-update.d, which includes
/etc/initramfs/post-update.d/zz-zipl, if s390-tools is installed.
Under these conditions, /etc/initramfs/post-update.d/zz-zipl should not
invoke the zipl command, since /etc/kernel/postinst.d/zz-zipl will be
run shortly thereafter, which will invoke the zipl command.

In short, /etc/initramfs/post-update.d/zz-zipl is not testing for this
condition.  On the other hand, it is testing for pre-configuration vs.
configuration.  This is not necessary, since it will never be called
during pre-configuration (unlike /etc/kernel/postinst.d/zz-zipl).
I suggest something like this for /etc/initramfs/post-update.d/zz-zipl:

-----

#!/bin/sh
#
#  runzipl - postupdate.d script for modern initrd management
#

set -e

# check for maintainer param
PAR=${DPKG_MAINTSCRIPT_PACKAGE:-ever}

case "$PAR" in

  linux-image-*)
    # zipl will be run later by the kernel postinst hook.
    # no need to run it now.
    :
    ;;

  *)
    # Run the boot loader installer
    if [ -f /sbin/zipl ];then
      if [ -f /etc/zipl.conf ];then
        zipl </dev/null >&2
      else
        echo 'Warning: Not updating ZIPL; /etc/zipl.conf not found!' >&2
      fi
    fi
    ;;

esac
  
-----

This is based on /etc/initramfs/post-update.d/runlilo from the lilo package.
(Note that the "zz-" prefix is not required for hook scripts in the
/etc/initramfs/post-update.d directory, as it is for the /etc/kernel/postinst.d
and /etc/kernel/postrm.d directories.)

I have tried the above script on my system, and it works fine.  zipl only gets
invoked once on a kernel update now.  But zipl still gets invoked when the initial
RAM file system is re-built for other reasons.  A machine-readable copy of this
script can be found on my web site at http://users.wowway.com/~zlinuxman/zipl/runzipl

-- 
  .''`.     Stephen Powell    
 : :'  :
 `. `'`
   `-


Reply to: