Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I ran sudo apt-get upgrade on my 12.04 server, and I have become stuck with a PostgreSQL dependency.

The console output (of sudo apt-get -f install) is below:

dpkg: dependency problems prevent configuration of postgresql-9.1:
  postgresql-client-9.1 (9.1.7-0ubuntu12.04) breaks postgresql-9.1 (<< 9.1.7-0ubuntu12.04) and is installed.
  Version of postgresql-9.1 to be configured is 9.1.6-1~precise2.
dpkg: error processing postgresql-9.1 (--configure):
  dependency problems - leaving unconfigured
No apport report written because the error message indicates its a followup error from a previous failure.
 Errors were encountered while processing:
E: Sub-process /usr/bin/dpkg returned an error code (1)

How do I resolve this issue?

nb. I have a production database running on this server, so purge/reinstall of postgres is a last resort.


As requested, the output of apt-get update:

share|improve this question
Did you run apt-get update before apt-get upgrade? If not, do it. If apt-get update gives any error message, include it in your post. Also, did you make any change to /etc/apt/sources.list? – Eric Carvalho Dec 26 '12 at 23:40
I did indeed, sudo apt-get update && sudo apt-get upgrade to be exact. I have not made any changes to sources.list – Peter Mellett Dec 26 '12 at 23:50
It seems postgresql-client-9.1 is being upgraded but postgresql-9.1 is not, thus the dependency problem. It happens when apt-get update is not successfully done. Run apt-get update again and report any error. – Eric Carvalho Dec 27 '12 at 0:27
Please see edited question. No errors from apt-get update. – Peter Mellett Dec 27 '12 at 12:09
Can you post your /etc/apt/sources.list and the contents of all files inside /etc/apt/sources.list.d/? The output of apt-cache policy postgresql-9.1 postgresql-client-9.1 will be helpful too. – Eric Carvalho Dec 27 '12 at 12:35
up vote 8 down vote accepted

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: Be sure to apply this method to both the client and the server.

share|improve this answer
Thank you so much, pinning will stop that from being a problem for the near future too. – Peter Mellett Dec 27 '12 at 16:18
Fixed my problem. Thank you. – Ash Dec 31 '12 at 16:12
Not working for me-- getting the same dependency errors on plpython. If I add postgresql-plpython-9.1 to the suggested commands I get: postgresql-9.1 : Breaks: postgresql-plpython-9.1 (< 9.1.6-1~precise2) but 9.1.5-0ubuntu12.04 is to be installed postgresql-client-9.1 : Breaks: postgresql-9.1 (< 9.1.7-0ubuntu12.04) but 9.1.6-1~precise2 is to be installed postgresql-plpython-9.1 : Depends: postgresql-9.1 (= 9.1.5-0ubuntu12.04) but 9.1.6-1~precise2 is to be installed – Pete Jan 2 '13 at 3:28

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
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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