apt-get upgrade stuck on postgresql dependency

I experienced this same problem with this postgresql update.

The newest version of postgres is 9.1.7, for some reason 9.1.6 is not in the repository, so here is how I downgraded to 9.1.5:

sudo apt-get -V install postgresql-client-9.1=9.1.5-0ubuntu12.04 
sudo apt-get -V install postgresql-9.1=9.1.5-0ubuntu12.04

Note that I downgraded to client first. It appears there is a bug in the latest update, which causes a dependency error between the client and the server.

edit: If you want to prevent postgresql from upgrading in the future see this page: https://help.ubuntu.com/community/PinningHowto. Be sure to apply this method to both the client and the server.


Here's another solution (AgDude's solution didn't work on my system, though I believe I have the same problem. I also have plpython installed. I believe that's complicating things.)

Remove the postgres package information from /var/lib/dpkg/status (back up the file first, of course). I believe this means apt won't realize postgres is installed, and therefore won't get stuck when it can't find 9.1.6 in the repository.

This solution will allow you to update the rest of your system as usual, and once again install/remove software. It of course won't update postgres anymore.

I did leave some packages with references to postgres. Here they are, so you know you don't have to take these out:

  1. Package: libpq-dev
  2. Package: libreoffice-core
  3. Package: rsyslog