无法在 Ubuntu 上升级 PostgreSQL

无法在 Ubuntu 上升级 PostgreSQL

当我运行时apt-get upgrade,出现以下错误:

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
dpkg: dependency problems prevent configuration of postgresql:
 postgresql depends on postgresql-9.1; however:
  Package postgresql-9.1 is not configured yet.
dpkg: error processing postgresql (--configure):
 dependency problems - leaving unconfigured
No apport report written because the error message indicates its a followup error from a previous failure.
                                                                                                          No apport report written because the error message indicates its a followup error from a previous failure.
                               No apport report written because the error message indicates its a followup error from a previous failure.
                                                                                                                                         No apport report written because MaxReports is reached already
                  dpkg: dependency problems prevent configuration of postgresql-contrib-9.1:
 postgresql-contrib-9.1 depends on postgresql-9.1 (= 9.1.7-0ubuntu12.04); however:
  Version of postgresql-9.1 on system is 9.1.6-1~precise2.
dpkg: error processing postgresql-contrib-9.1 (--configure):
 dependency problems - leaving unconfigured
dpkg: dependency problems prevent configuration of postgresql-contrib:
 postgresql-contrib depends on postgresql-contrib-9.1; however:
  Package postgresql-contrib-9.1 is not configured yet.
dpkg: error processing postgresql-contrib (--configure):
 dependency problems - leaving unconfigured
Errors were encountered while processing:
 postgresql-9.1
 postgresql
 postgresql-contrib-9.1
 postgresql-contrib
E: Sub-process /usr/bin/dpkg returned an error code (1)

我试过了apt-get -f upgrade但出现同样的错误。

我该怎么做才能修复此问题?它彻底搞乱了 APT。

注意:我对 PostgreSQL 使用以下 PPA:https://launchpad.net/~pitti/+archive/postgresql

更新:抱歉格式不对,以下是要点https://gist.github.com/e0752bb50e63ef4b3a4c

答案1

我也遇到了同样的问题。apt-get -f install不起作用。使用 aptitude 就可以了。

aptitude -f install删除了 postgres,但没有删除数据库。之后apt-get install postgres重新安装了 postgres。又开心了 :-)

答案2

前段时间在测试机上遇到过同样的问题。
我刚刚禁用了 pitti,卸载、清理、重新安装、启用 pitti、更新。也许我漏掉了一些步骤,但对我来说这很有帮助。
相关行来自历史

sudo vim /etc/apt/sources.list.d/ubuntugis-ppa-precise.list
sudo vim /etc/apt/sources.list.d/pitti-postgresql-precise.list
sudo apt-get remove postgresql-9.1
sudo apt-get remove postgresql-client-9.1
sudo apt-get clean
sudo apt-get update
sudo apt-get install postgresql-9.1
sudo apt-get install postgresql-9.1-postgis 
sudo apt-get install postgresql-contrib-9.1 
sudo vim /etc/apt/sources.list.d/pitti-postgresql-precise.list
sudo vim /etc/apt/sources.list.d/ubuntugis-ppa-precise.list 
sudo apt-get update
sudo apt-get upgrade

相关内容