I’ve been getting this error during package install lately:
Preparing to unpack .../openjdk-7-jre-headless_7u65-2.5.1-4ubuntu1~0.14.04.1_amd64.deb ... Unpacking openjdk-7-jre-headless:amd64 (7u65-2.5.1-4ubuntu1~0.14.04.1) over (7u55-2.4.7-1ubuntu1) ... dpkg: error processing archive /var/cache/apt/archives/openjdk-7-jre-headless_7u65-2.5.1-4ubuntu1~0.14.04.1_amd64.deb (--unpack): trying to overwrite shared '/etc/java-7-openjdk/content-types.properties', which is different from other instances of package openjdk-7-jre-headless:amd64 dpkg-deb: error: subprocess paste was killed by signal (Broken pipe) Errors were encountered while processing: /var/cache/apt/archives/openjdk-7-jre-headless_7u65-2.5.1-4ubuntu1~0.14.04.1_amd64.deb E: Sub-process /usr/bin/dpkg returned an error code (1)
I’m running,
Distributor ID: Ubuntu
Description: Ubuntu 14.04.1 LTS
Release: 14.04
Codename: trusty
The main culprit is the emboldened text. I checked the archive against the files it was trying to overwrite and since they’re the same I just omitted them from the install. I thought about blacklisting (see below) the file, but that might not be such a good idea. Anyhow, below is how to get around this, once you check the files you are omitting are the same as the currently installed ones.
Workaround
alan@desktop:/tmp/pkg$ cd /tmp alan@desktop:/tmp/pkg$ mkdir pkg alan@desktop:/tmp/pkg$ cd pkg alan@desktop:/tmp/pkg$ wget https://launchpad.net/~ubuntu-security-proposed/+archive/ubuntu/ppa/+build/6233940/+files/openjdk-7-jre-headless_7u65-2.5.1-4ubuntu1%7E0.14.04.1_amd64.deb alan@desktop:/tmp/pkg$ dpkg-deb -x openjdk-7-jre-headless_7u65-2.5.1-4ubuntu1~0.14.04.1_amd64.deb openjdkdeb alan@desktop:/tmp/pkg$ dpkg-deb --control openjdk-7-jre-headless_7u65-2.5.1-4ubuntu1~0.14.04.1_amd64.deb openjdkdeb/DEBIAN alan@desktop:/tmp/pkg$ vi openjdkdeb/DEBIAN/conffiles
Remove all the lines with files that clash with those in /etc/java-7-openjdk/ ..
!Once you have checked these files: openjdk/etc/ are identical to your current bunch in /etc/java-7-openjdk/ then carry out the following, if not then copy all the properties files contained in /etc/conffiles to another tmp directory, to copy them :
alan@desktop:/tmp$ mkdir newprops && for file in $(cat openjdkdeb/DEBIAN/conffiles); do cp openjdkdeb/DEBIAN/etc/$(echo $file | cut -d/ -f4) newprops/; done
Remove the files from the archive
alan@desktop:/tmp/pkg$ find openjdkdeb/etc/ -name "*.properties" -exec rm '{}' \;
Cont…rebuild package
alan@desktop:/tmp/pkg$ rm openjdk-7-jre-headless_7u65-2.5.1-4ubuntu1~0.14.04.1_amd64.deb && dpkg -b openjdkdeb/ openjdk-7-jre-headless_7u65-2.5.1-4ubuntu1~0.14.04.1_amd64.deb alan@desktop:/tmp/pkg$ sudo dpkg -i openjdk-7-jre-headless_7u65-2.5.1-4ubuntu1~0.14.04.1_amd64.deb
If you made a copy of the .properties files from the extracted .deb archive, then copy them back to /etc/java-7-openjdk/
As always, your mileage may vary – I need to get some things installed and I’ll deal with any issue I’ve caused in opendk as they arise….
alan@desktop:~$ sudo apt-mark hold package_name openjdk-7-jre-headless:amd64 openjdk-7-jre-headless set on hold.