Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I am trying to upgrade Postgresql on Ubuntu from 9.1 and running into dependency issues.

sudo apt-get install postgresql-9.2 outputs:

Reading package lists... Done
Building dependency tree
Reading state information... Done
You might want to run 'apt-get -f install' to correct these:
The following packages have unmet dependencies:
 postgresql-9.2 : Depends: postgresql-client-9.2 but it is not going to be installed
 postgresql-client-9.1 : Breaks: postgresql-9.1 (< 9.1.9-1.pgdg12.4+1) but 9.1.6-1~precise2 is to be installed
E: Unmet dependencies. Try 'apt-get -f install' with no packages (or specify a solution).

So it needs postgresql-client-9.2, so I run sudo apt-get install postgresql-9.2 postgresql-client-9.2:

Reading package lists... Done
Building dependency tree
Reading state information... Done
You might want to run 'apt-get -f install' to correct these:
The following packages have unmet dependencies:
 postgresql-client-9.1 : Breaks: postgresql-9.1 (< 9.1.9-1.pgdg12.4+1) but 9.1.6-1~precise2 is to be installed
E: Unmet dependencies. Try 'apt-get -f install' with no packages (or specify a solution).

What is this 9.1 dependency? I don't want to install 9.1! Okay, let's try sudo apt-get -f install:

Reading package lists... Done
Building dependency tree
Reading state information... Done
Correcting dependencies... Done
The following packages were automatically installed and are no longer required:
  postgresql-9.1 libkrb5-dev postgresql-common postgresql-client-9.1 postgresql-client-common
Use 'apt-get autoremove' to remove them.
The following extra packages will be installed:
  postgresql-9.1
Suggested packages:
  oidentd ident-server locales-all
The following packages will be upgraded:
  postgresql-9.1
1 upgraded, 0 newly installed, 0 to remove and 9 not upgraded.
1 not fully installed or removed.
Need to get 0 B/3,610 kB of archives.
After this operation, 586 kB of additional disk space will be used.
Do you want to continue [Y/n]? Y
dpkg: dependency problems prevent configuration of postgresql-9.1:
 postgresql-client-9.1 (9.1.9-1.pgdg12.4+1) breaks postgresql-9.1 (<< 9.1.9-1.pgdg12.4+1) 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)

I am now completely lost. Can I uninstall 9.1 so I don't get any conflicts without deleting data in Postgres databases? Is there a sane path to upgrade to 9.2 on Ubuntu?

share|improve this question

migrated from serverfault.com Jun 30 '13 at 13:50

This question came from our site for professional system and network administrators.

    
I'd think you should always perform a proper pg_dump before any upgrade. You can also just rename the data directories, make an empty set with the correct permissions and ownership (and group association, of course). Then install P'gres 9.2; shutdown the server, and move the data back under it. This might work but I'd still suggest pg_dump and restore. –  Jim Dennis Jun 30 '13 at 5:26
    
Please show apt-cache policy postgresql-9.2 and apt-cache policy postgresql-client-9.2 . What's your install source for 9.2? backports.org? apt.postgresql.org? Other? –  Craig Ringer Jun 30 '13 at 12:40

Your Answer

 
discard

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

Browse other questions tagged or ask your own question.