apt-get upgrade stuck on postgresql dependency
Solution 1
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.
Solution 2
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:
- Package: libpq-dev
- Package: libreoffice-core
- Package: rsyslog
Related videos on Youtube
Peter Mellett
Full-stack web developer with experience of rich web applications in PHP, JavaScript and Ruby.
Updated on September 18, 2022Comments
-
Peter Mellett almost 2 years
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/-
Eric Carvalho over 11 yearsDid you run
apt-get update
beforeapt-get upgrade
? If not, do it. Ifapt-get update
gives any error message, include it in your post. Also, did you make any change to/etc/apt/sources.list
? -
Peter Mellett over 11 yearsI did indeed,
sudo apt-get update && sudo apt-get upgrade
to be exact. I have not made any changes to sources.list -
Eric Carvalho over 11 yearsIt 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. Runapt-get update
again and report any error. -
Peter Mellett over 11 yearsPlease see edited question. No errors from apt-get update.
-
Eric Carvalho over 11 yearsCan you post your
/etc/apt/sources.list
and the contents of all files inside/etc/apt/sources.list.d/
? The output ofapt-cache policy postgresql-9.1 postgresql-client-9.1
will be helpful too. -
Jason Galvin over 11 years
apt-get dist upgrade
did the trick for me.
-
-
Peter Mellett over 11 yearsThank you so much, pinning will stop that from being a problem for the near future too.
-
Pete over 11 yearsNot 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