0

Whenever I try to install anything with apt-get, I get error messages:

apt-get install abinit
Reading package lists... Done
Building dependency tree       
Reading state information... Done
You might want to run 'apt-get -f install' to correct these:
The following packages have unmet dependencies:
 libpng12-0 : Breaks: libpng12-0:i386 (!= 1.2.54-1ubuntu1) but 1.2.54-1ubuntu1.1 is to be installed
 libpng12-0:i386 : Breaks: libpng12-0 (!= 1.2.54-1ubuntu1.1) but 1.2.54-1ubuntu1 is to be installed
 libpng12-dev : Depends: libpng12-0 (= 1.2.54-1ubuntu1.1) but 1.2.54-1ubuntu1 is to be installed
E: Unmet dependencies. Try 'apt-get -f install' with no packages (or specify a solution).

How can I fix this? If I try the suggested apt-get -f install command, it complains:

Preparing to unpack .../libpng12-0_1.2.54-1ubuntu1.1_amd64.deb ...
Unpacking libpng12-0:amd64 (1.2.54-1ubuntu1.1) over (1.2.54-1ubuntu1) ...
dpkg: error processing archive /var/cache/apt/archives/libpng12-0_1.2.54-1ubuntu1.1_amd64.deb (--unpack):
 trying to overwrite shared '/usr/share/doc/libpng12-0/changelog.Debian.gz', which is different from other instances of package libpng12-0:amd64
Processing triggers for libc-bin (2.23-0ubuntu11.2) ...
Errors were encountered while processing:
 /var/cache/apt/archives/libpng12-0_1.2.54-1ubuntu1.1_amd64.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)

What would a smart person do?

Amanda
  • 9,723
JB_User
  • 393

2 Answers2

4

This line seems significant:

trying to overwrite shared '/usr/share/doc/libpng12-0/changelog.Debian.gz'

An older post (What is changelog.Debian.gz file during packaging?) suggests that you can safely remove changelog.Debian.gz (and you can certainly back it up with sudo cp /usr/share/doc/libpng12-0/changelog.Debian.gz ~/Desktop/changelog.Debian.gz)

So in this case I would start by removing the changelog, and then updating.

Usually, when I'm getting errors with apt or apt-get I also just run sudo apt-get clean to do some basic tidying.

Amanda
  • 9,723
-1

Reconfigure the package database with sudo dpkg --configure -a. Then try again. If this still doesn't work, try removing libpng.

jitter
  • 119