Public bug reported:

Binary package hint: dpkg

dpkg fails for (some, not all) during an upgrade starting with package
version 1.15.3ubuntu1. I tried to debug the problem but the output is
very limited, even with a very thorough --debug when installing via
dpkg:


ke...@csc-kdrake-003:~$ sudo dpkg --debug=3773 -i 
/var/cache/apt/archives/dpkg_1.15.3.1ubuntu1_i386.deb 
[sudo] password for kenny: 
D000010: ensure_pathname_nonexisting `/var/lib/dpkg/tmp.ci'
(Reading database ... 111892 files and directories currently installed.)
Preparing to replace dpkg 1.15.2ubuntu1 (using 
.../dpkg_1.15.3.1ubuntu1_i386.deb) ...
D000200: process_archive conffile `/etc/dpkg/dpkg.cfg' in package dpkg - conff ?
D000020: process_archive conffile `/etc/dpkg/dpkg.cfg' package=dpkg same 
hash=f4413ffb515f8f753624ae3bb365b81b
D000200: process_archive conffile `/etc/alternatives/README' in package dpkg - 
conff ?
D000200: process_archive conffile `/etc/alternatives/README' in package dpkg - 
conff ? not `/etc/dpkg/dpkg.cfg'
D000020: process_archive conffile `/etc/alternatives/README' package=dpkg same 
hash=69c4ba7f08363e998e0f2e244a04f881
D000200: process_archive conffile `/etc/logrotate.d/dpkg' in package dpkg - 
conff ?
D000200: process_archive conffile `/etc/logrotate.d/dpkg' in package dpkg - 
conff ? not `/etc/dpkg/dpkg.cfg'
D000200: process_archive conffile `/etc/logrotate.d/dpkg' in package dpkg - 
conff ? not `/etc/alternatives/README'
D000020: process_archive conffile `/etc/logrotate.d/dpkg' package=dpkg same 
hash=9e25c8505966b5829785f34a548ae11f
D000200: oldconffsetflags `/etc/dpkg/dpkg.cfg' namenode 0x93fa3d0 flags 5
D000200: oldconffsetflags `/etc/alternatives/README' namenode 0x93fa428 flags 5
D000200: oldconffsetflags `/etc/logrotate.d/dpkg' namenode 0x93fa45c flags 5
D000001: process_archive oldversionstatus=installed
D000002: maintainer_script_alternative nonexistent prerm 
`/var/lib/dpkg/info/dpkg.prerm'
D000002: fork/exec /var/lib/dpkg/tmp.ci/preinst ( upgrade 1.15.2ubuntu1 )
dpkg: error processing /var/cache/apt/archives/dpkg_1.15.3.1ubuntu1_i386.deb 
(--install):
 subprocess new pre-installation script returned error exit status 1
D000002: fork/exec /var/lib/dpkg/tmp.ci/postrm ( abort-upgrade 1.15.2ubuntu1 )
D000002: fork/exec /var/lib/dpkg/info/dpkg.postinst ( abort-upgrade 
1.15.3.1ubuntu1 )
D000010: ensure_pathname_nonexisting `/var/lib/dpkg/tmp.ci'
D000010: ensure_pathname_nonexisting running rm -rf
D000010: ensure_pathname_nonexisting `/var/lib/dpkg/reassemble.deb'
Errors were encountered while processing:
 /var/cache/apt/archives/dpkg_1.15.3.1ubuntu1_i386.deb


I believe the offending code was introduced in 1.15.3ubuntu1 in the preinst 
script:

+kill_bad_alternatives () {
+    local IFS=""
+    ALTDIR="/var/lib/dpkg/alternatives"
+    for alt in $ALTDIR/*; do
+        if [ ! -e $alt ]; then
+            # In case it's been removed by the code below
+            continue
+        fi
+        {
+            read mode
+            read mainlink
+            while true; do
+                read slave
+                if [ "$slave" = "" ]; then
+                    break
+                fi
+                if [ -e "$ALTDIR/$slave" ]; then
+                    echo "Removing conflicting master alternative $slave (it 
is slave of $(basename $alt))..."
+                    rm -f "$ALTDIR/$slave"
+                fi
+                read slavelink
+            done
+        } <$alt
+    done
+}

....

+        # Cleanup bad alternatives that would choke with new
+        # update-alternatives (see #530633, #531611, #532739, #521760)
+        if dpkg --compare-versions "$2" lt 1.15.3; then
+            kill_bad_alternatives
+        fi
+


See http://ubuntuforums.org/showthread.php?t=1206792 for additional comments.

** Affects: dpkg (Ubuntu)
     Importance: Undecided
         Status: New

-- 
dpkg crashes during install in "upgrade" section of preinst script
https://bugs.launchpad.net/bugs/398592
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.

-- 
ubuntu-bugs mailing list
ubuntu-bugs@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to