Bug#771852: package not installable due to postinst syntax error

Stefan Lippers-Hollmann s.L-H at gmx.de
Tue Dec 2 21:23:14 UTC 2014


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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.alioth.debian.org/pipermail/pkg-mdadm-devel/attachments/20141202/aab888b1/attachment.sig>


More information about the pkg-mdadm-devel mailing list