This suddenly happened to me today after I upgraded my Unity (Ubuntu 14.04 LTS) via Software Updater. I got a warning telling me that I have installed packages that unmet dependencies.

I used Synaptic and use 'Fix Broken Package' but I get this error (I used apt-get -f install on terminal and get the same result):

E: /var/cache/apt/archives/liblwgeom-2.1.8_2.1.8+dfsg-1.pgdg14.04+1_amd64.deb: trying to overwrite '/usr/lib/liblwgeom-2.1.8.so', which is also in package liblwgeom-2.1.7 2.1.8+dfsg-1~95.git18216c0.pgdg14.04+1

I installed my postgres and postgis package from ppa http://apt.postgresql.org/pub/repos/apt . Never had any problem until today.

I've searched on the internet and tried the recommendations I found: apt-get clean, apt-get autoclean, apt-get update and apt-get upgrade, also dpkg --configure -a but none works for me.

I'm new in using Ubuntu and would very appreciate of your help here.

  • The two packages conflict because they contain the same file. You should contact the owner of the PPA to report the issue to them, and have them fix their packaging to support upgradeability within their own PPA. Alternatively, as an immediate fix, you can purge the old package with sudo apt-get remove --purge liblwgeom-2.1.7, and then install the new version. – dobey Sep 17 '15 at 20:26
  • 1
    Possible duplicate of dpkg error: "trying to overwrite file, which is also in..." – karel Mar 14 '19 at 11:37
sudo dpkg -i --force-overwrite /var/cache/apt/archives/liblwgeom-2.1.8_2.1.8+dfsg-1.pgdg14.04+1_amd64.deb


 sudo apt-get install -f

solve my problem.

More information: http://www.webupd8.org/2011/02/fix-dpkg-error-trying-to-overwrite-x.html

| improve this answer | |

I can confirm the bug for Ubuntu 12.04 LTS with the same PPA.

The following worked for me on Precise (mainly using "dpkg -r" to remove liblwgeom-2.1.7):

sudo service postgresql stop
sudo dpkg -r liblwgeom-2.1.7
sudo apt-get -f install
sudo service postgresql start
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.