7

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:
 postgresql-9.1
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.

Edit:

As requested, the output of apt-get update: http://paste.ubuntu.com/1469631/

6
  • 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? Dec 26, 2012 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 Dec 26, 2012 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. Dec 27, 2012 at 0:27
  • Please see edited question. No errors from apt-get update. Dec 27, 2012 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. Dec 27, 2012 at 12:35

2 Answers 2

9

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.

2
  • Thank you so much, pinning will stop that from being a problem for the near future too. Dec 27, 2012 at 16:18
  • 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, 2013 at 3:28
3

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

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .