Package: mdadm
Version: 3.3.2-3
Severity: serious
Tags: patch

Hi

Installing mdadm 3.3.2-3 fails with the following error

Setting up mdadm (3.3.2-3) ...
W: mdadm: failed to load MD subsystem.
Generating mdadm.conf... done (failed to scan arrays; /proc probably not 
mounted).
rm: unrecognized option '--ignore-fail-on-non-empty'
Try 'rm --help' for more information.
dpkg: error processing package mdadm (--configure):
 subprocess installed post-installation script returned error exit status 1

as rm(1) doesn't support --ignore-fail-on-non-empty as parameter. 
However simply switching this to "rmdir --ignore-fail-on-non-empty" is
not successful either, as /var/lib/mdadm doesn't exist on systems where
mdadm hasn't been installed before (and "rmdir 
--ignore-fail-on-non-empty" does exit with an error code, if the 
directoy which it is supposed to remove doesn't exist). There are two
alternatives to fix this, either by ignoring all bugs from rmdir, e.g.

        rmdir --ignore-fail-on-non-empty /var/lib/mdadm || :

or by checking if the directory in question exists beforehand.

--- mdadm-3.3.2/debian/mdadm.postinst
+++ mdadm-3.3.2/debian/mdadm.postinst
@@ -100,7 +100,9 @@
 
     if dpkg --compare-versions "$2" le 3.3.2-1; then
       rm -f /var/lib/mdadm/CONF-UNCHECKED /var/lib/mdadm/mdadm.conf-generated
-      rm --ignore-fail-on-non-empty /var/lib/mdadm
+      if [ -d /var/lib/mdadm ]; then
+        rmdir --ignore-fail-on-non-empty /var/lib/mdadm
+      fi
     fi
     ;;
 esac

Regards
        Stefan Lippers-Hollmann

-- System Information:
Debian Release: 8.0
  APT prefers unstable
  APT policy: (500, 'unstable')
Architecture: amd64 (x86_64)

Kernel: Linux 3.18.0-rc7-aptosid-amd64 (SMP w/8 CPU cores; PREEMPT)
Locale: LANG=de_DE.UTF-8, LC_CTYPE=de_DE.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash

Attachment: signature.asc
Description: This is a digitally signed message part.

Reply via email to