Bug#422624: postinst failure starting mdadm-raid

Laurent Bonnaud Laurent.Bonnaud at inpg.fr
Mon May 7 18:42:32 UTC 2007


On Mon, 2007-05-07 at 14:44 +0200, martin f krafft wrote:
> 
> You have no ARRAY lines in mdadm.conf. On purpose?

mdadm did not give me a chance to create an array before this postinst
failure.

> Please paste the output of /usr/share/mdadm/mkconf as root.

See below.

> Please also paste the output of
> 
>   sh -x /etc/init.d/mdadm-raid start

Here it is:

# sh -x /etc/init.d/mdadm-raid start
+ set -eu
+ MDADM=/sbin/mdadm
+ CONFIG=/etc/mdadm/mdadm.conf
+ ALTCONFIG=/etc/mdadm.conf
+ DEBIANCONFIG=/etc/default/mdadm
+ test -x /sbin/mdadm
+ AUTOSTART=true
+ test -f /etc/default/mdadm
+ . /etc/default/mdadm
++ INITRDSTART=all
++ AUTOSTART=true
++ AUTOCHECK=true
++ START_DAEMON=true
++ DAEMON_OPTIONS=--syslog
++ VERBOSE=false
++ USE_DEPRECATED_MDRUN=false
+ . /lib/lsb/init-functions
++ FANCYTTY=
++ '[' -e /etc/lsb-base-logging.sh ']'
++ . /etc/lsb-base-logging.sh
+ for dir in /lib/init/rw /dev/shm /dev
+ statedir=/lib/init/rw/.mdadm
+ test -d /lib/init/rw/.mdadm
+ STATEDIR=/lib/init/rw/.mdadm
+ break
+ case "${1:-}" in
+ PREFIX='Assembling MD array'
+ is_true true
+ case "${1:-}" in
+ return 0
+ '[' '!' -f /proc/mdstat ']'
+ '[' '!' -f /proc/mdstat ']'
+ '[' -f /etc/mdadm/mdadm.conf ']'
+ mkdir --parent /dev/md
+ IFSOLD='
'
+ IFS='
'
++ /sbin/mdadm --assemble --scan --auto=yes --symlink=no
+ for line in '$($MDADM --assemble --scan --auto=yes --symlink=no 2>&1)'
+ IFS='
'
+ set -- mdadm: No arrays found in config file or automatically
+ shift
+ case "$@" in
+ shift
+ log_problem 'no arrays found in config file or automatically'
+ log 1 'Assembling MD arrays' 'no arrays found in config file or
automatically'
+ case "$1" in
+ success=1
+ shift
+ log_action_begin_msg 'Assembling MD arrays'
+ log_daemon_msg 'Assembling MD arrays...'
+ '[' -z 'Assembling MD arrays...' ']'
+ log_use_usplash
+ type usplash_write
+ usplash_write 'TEXT Assembling MD arrays...'
+ log_use_fancy_output
+ TPUT=/usr/bin/tput
+ EXPR=/usr/bin/expr
+ '[' xxterm '!=' xdumb ']'
+ '[' -x /usr/bin/tput ']'
+ '[' -x /usr/bin/expr ']'
+ /usr/bin/tput hpa 60
+ /usr/bin/tput setaf 1
+ '[' -z ']'
+ FANCYTTY=1
+ case "$FANCYTTY" in
+ true
+ /usr/bin/tput xenl
++ /usr/bin/tput cols
+ COLS=112
+ '[' 112 ']'
++ /usr/bin/expr 112 - 7
+ COL=105
+ printf ' * Assembling MD arrays...       '
 * Assembling MD arrays...       ++ /usr/bin/expr 112 - 1
+ /usr/bin/tput hpa 111

+ printf ' '
 + shift
+ log_action_end_msg 1 'no arrays found in config file or automatically'
+ log_end_msg 1
+ '[' -z 1 ']'
+ log_use_usplash
+ type usplash_write
+ '[' 1 -eq 0 ']'
+ usplash_write 'FAILURE failed'
+ '[' 105 ']'
+ '[' -x /usr/bin/tput ']'
+ printf '\r'
+ /usr/bin/tput hpa 105

+ '[' 1 -eq 0 ']'
+ printf '['
[+ /usr/bin/tput setaf 1
+ printf fail
fail+ /usr/bin/tput op
+ echo ']'
]
+ return 1


-- 
Laurent Bonnaud.
http://www.lis.inpg.fr/pages_perso/bonnaud/


#!/bin/sh
#
# mkconf -- outputs valid mdadm.conf contents for the local system
#
# Copyright © martin f. krafft <madduck at madduck.net>
# distributed under the terms of the Artistic Licence 2.0
#
# $Id: mkconf 324 2007-05-05 18:49:44Z madduck $
#

set -eu

ME="${0##*/}"
MDADM=/sbin/mdadm
DEBIANCONFIG=/etc/default/mdadm
CONFIG=/etc/mdadm/mdadm.conf

test -r $DEBIANCONFIG && . $DEBIANCONFIG

if [ -n "${MDADM_MAILADDR__:-}" ]; then
  # honour MAILADDR from the environment (from postinst)
  MAILADDR="$MDADM_MAILADDR__"
else
  # preserve existing MAILADDR
  MAILADDR="$(sed -ne 's/^MAILADDR //p' $CONFIG 2>/dev/null)" || :
fi

# save existing values as defaults
if [ -r "$CONFIG" ]; then
  DEVICE="$(sed -ne 's/^DEVICE //p' $CONFIG)"
  CREATE="$(sed -ne 's/^CREATE //p' $CONFIG)"
  HOMEHOST="$(sed -ne 's/^HOMEHOST //p' $CONFIG)"
  PROGRAM="$(sed -ne 's/^PROGRAM //p' $CONFIG)"
fi

generate=0
[ "${1:-}" = force-generate ] && rm -f $CONFIG
case "${1:-}" in
  generate|force-generate)
    [ -n "${2:-}" ] && CONFIG=$2
    # only barf if the config file specifies anything else than MAILADDR
    if egrep -qv '^(MAILADDR.*|#.*|)$' $CONFIG 2>/dev/null; then
      echo "E: $ME: $CONFIG already exists." >&2
      exit 255
    fi

    mkdir --parent ${CONFIG%/*}
    exec >$CONFIG
    generate=1
    ;;
esac

cat <<_eof
# mdadm.conf
#
# Please refer to mdadm.conf(5) for information about this file.
#

# by default, scan all partitions (/proc/partitions) for MD superblocks.
# alternatively, specify devices to scan, using wildcards if desired.
DEVICE ${DEVICE:-partitions}

# auto-create devices with Debian standard permissions
CREATE ${CREATE:-owner=root group=disk mode=0660 auto=yes}

# automatically tag new arrays as belonging to the local system
HOMEHOST ${HOMEHOST:-<system>}

# instruct the monitoring daemon where to send mail alerts
MAILADDR ${MAILADDR:-root}

_eof

if [ -n "$PROGRAM" ]; then
  cat <<-_eof
        # program to run when mdadm monitor detects potentially interesting events
        PROGRAM ${PROGRAM}

        _eof
fi

error=0
if [ ! -r /proc/mdstat ]; then
  echo W: $ME: MD subsystem is not loaded, thus I cannot scan for arrays. >&2
  error=1
elif [ ! -r /proc/partitions ]; then
  echo W: $ME: /proc/partitions cannot be read, thus I cannot scan for arrays. >&2
  error=2
else
  echo "# definitions of existing MD arrays"
  if ! $MDADM --examine --scan --config=partitions; then
    error=$(($? + 128))
    echo W: $ME: failed to scan for partitions. >&2
    echo "### WARNING: scan failed."
  else
    echo
  fi
fi

if [ $generate -eq 1 ]; then
  cat <<_eof
# This file was auto-generated on $(date -R)
# by mkconf \$Id: mkconf 324 2007-05-05 18:49:44Z madduck $
_eof

  mkdir -p /var/lib/mdadm
  md5sum $CONFIG > /var/lib/mdadm/mdadm.conf-generated
fi

exit $error






More information about the pkg-mdadm-devel mailing list