问题
在我的 Ubuntu 12.04 LTS 服务器上执行任何会更改已安装软件包的操作(删除、安装、清除等)都会失败,并出现以下错误:
Reading package lists...
Building dependency tree...
Reading state information...
Correcting dependencies... Done
The following extra packages will be installed:
libpq-dev libssl-dev postgresql-9.1 postgresql-contrib-9.1
Suggested packages:
oidentd ident-server locales-all libdbd-pg-perl
The following packages will be upgraded:
libpq-dev libssl-dev postgresql-9.1 postgresql-contrib-9.1
4 to upgrade, 0 to newly install, 0 to remove and 4 not to upgrade.
7 not fully installed or removed.
Need to get 0 B/6,577 kB of archives.
After this operation, 6,144 B of additional disk space will be used.
dpkg: dependency problems prevent configuration of libssl-dev:
libssl-dev depends on libssl1.0.0 (= 1.0.1-4ubuntu5.27); however:
Version of libssl1.0.0 on system is 1.0.1-4ubuntu5.31.
dpkg: error processing libssl-dev (--configure):
dependency problems - leaving unconfigured
dpkg: dependency problems prevent configuration of libpq-dev:
libpq-dev depends on libpq5 (= 9.1.16-0ubuntu0.12.04); however:
Version of libpq5 on system is 9.1.18-0ubuntu0.12.04.
libpq-dev depends on libssl-dev; however:
Package libssl-dev is not configured yet.
dpkg: error processing libpq-dev (--configure):
dependency problems - leaving unconfigured
dpkg: dependency problems prevent configuration of postgresql-9.1:
postgresql-client-9.1 (9.1.18-0ubuntu0.12.04) breaks postgresql-9.1 (<< 9.1.18-0ubuntu0.12.04) and is installed.
Version of postgresql-9.1 to be configured is 9.1.16-0ubuntu0.12.04.
dpkg: error processing postgresql-9.1 (--configure):
dependency problems - leaving unconfigured
dpkg: dependency problems prevent configuration of postgresql-contrib-9.1:
postgresql-contrib-9.1 depends on postgresql-9.1 (= 9.1.16-0ubuntu0.12.04); however:
Package postgresql-9.1 is not configured yet.
dpkg: error processing postgresql-contrib-9.1 (--configure):
dependency problems - leaving unconfigured
dpkg: dependency problems prevent configuration of postgresql-server-dev-9.1:
postgresql-server-dev-9.1 depends on libpq-dev (>= 9.1~); however:
Package libpq-dev is not configured yet.
dpkg: error processing postgresql-server-dev-9.1 (--configure):
dependency problems - leaving unconfigured
dpkg: dependency problems prevent configuration of python2.7-dev:
python2.7-dev depends on libssl-dev; however:
Package libssl-dev is not configured yet.
dpkg: error processing python2.7-dev (--configure):
dependency problems - leaving unconfigured
dpkg: dependency problems prevent configuration of python3.2-dev:
python3.2-dev depends on libssl-dev; however:
Package libssl-dev is not configured yet.
dpkg: error processing python3.2-dev (--configure):
dependency problems - leaving unconfigured
Errors were encountered while processing:
libssl-dev
libpq-dev
postgresql-9.1
postgresql-contrib-9.1
postgresql-server-dev-9.1
python2.7-dev
python3.2-dev
可能的原因
我几乎可以肯定,最初的原因是启动分区已满。但是现在我通过dpkg -r
运行一些旧内核解决了这个问题。在apt-get removing
运行它们失败并出现与上述类似的堆栈跟踪后,我使用了这种方法。
问题的另一个潜在根源(尽管我认为不太可能,因为我看不出有任何关系)是一个 Fsync 错误在 postgres 更新中,我通过删除证书的符号链接并按照该链接上的说明直接复制证书来解决这个问题。这个错误与 apt-get 问题同时出现,所以我提到它是为了完整性,但正如我所说的,我看不出它会如何破坏 apt-get。
我尝试过的方法
如上所述,我已经在启动时清除了一些空间。我试过了apt-get install -f
,结果出现了我上面发布的堆栈跟踪。我还尝试编辑 dpkg 状态文件并删除 initramfs同样没有成功。我现在已恢复到原始状态文件。有人知道我该如何解决这个问题吗?
答案1
您可以尝试使用 dpkg 手动安装单个软件包(例如 dpkg -i /path/to/package.deb)。.debs 应该位于 /var/cache/apt/archives/ 中。从 lib 软件包开始,尤其是 libssl-dev 和 libpq-dev。
每次安装完之后,再次尝试 apt-get -f install 看看是否能将其解开。