我正在尝试修复 Ubuntu 服务器中的 APT 设置,该服务器只有 SSH 访问权限,但无法找出依赖性错误。
我已经运行sudo apt-get install -f
,并得到以下结果:
Reading package lists... Done
Building dependency tree
Reading state information... Done
0 upgraded, 0 newly installed, 0 to remove and 1 not upgraded.
4 not fully installed or removed.
After this operation, 0 B of additional disk space will be used.
Setting up ssl-cert (1.0.23ubuntu2) ...
dpkg: error processing ssl-cert (--configure):
subprocess installed post-installation script returned error exit status 1
dpkg: dependency problems prevent configuration of postgresql-common:
postgresql-common depends on ssl-cert (>= 1.0.11); however:
Package ssl-cert is not configured yet.
dpkg: error processing postgresql-common (--configure):
dependency problems - leaving unconfigured
No apport report written because the error message indicates its a followup error from a previous failure.
dpkg: dependency problems prevent configuration of postgresql-8.4:
postgresql-8.4 depends on postgresql-common (>= 104~); however:
Package postgresql-common is not configured yet.
postgresql-8.4 depends on ssl-cert; however:
Package ssl-cert is not configured yet.
dpkg: error processing postgresql-8.4 (--configure):
dependency problems - leaving unconfigured
No apport report written because MaxReports is reached already
dpkg: dependency problems prevent configuration of postgresql:
postgresql depends on postgresql-8.4; however:
Package postgresql-8.4 is not configured yet.
dpkg: error processing postgresql (--configure):
dependency problems - leaving unconfigured
No apport report written because MaxReports is reached already
Errors were encountered while processing:
ssl-cert
postgresql-common
postgresql-8.4
postgresql
E: Sub-process /usr/bin/dpkg returned an error code (1)
这到底是什么意思?是否存在循环依赖?
我尝试安装所需的依赖项ssl-cert
,但它也不起作用。
我也不能dpkg
直接使用。
有什么方法可以解决这个问题吗?或者有人能帮我更好地理解这个问题吗?我还需要提供其他信息吗?
===
编辑:
运行sudo sh -x /path/to/config.postinst configure
产生以下输出:
+ . /usr/share/debconf/confmodule
+ [ ! ]
+ PERL_DL_NONLAZY=1
+ export PERL_DL_NONLAZY
+ [ ]
+ exec /usr/share/debconf/frontend /var/lib/dpkg/info/ssl-cert.postinst configure
这是否意味着脚本无法执行最后一行?
运行sudo /usr/share/debconf/frontend /var/lib/dpkg/info/ssl-cert.postinst configure
悄无声息地完成,但随后echo $?
出现1
,表明确实发生了错误。
当我添加set -x
到文件顶部,然后运行命令时sudo ... frontend ... configure
,它会失败:
make-ssl-cert generate-default-snakeoil
set -x
此文件也失败了:
openssl req -config /tmp/tmp.wPl6nkzKYm -new -x509 -days 3650 -nodes -out /etc/ssl/certs/ssl-cert-snakeoil.pem -keyout /etc/ssl/private/ssl-cert-snakeoil.key
运行此命令可得到sudo
:
Generating a 1024 bit RSA private key
.....................++++++
.......................++++++
writing new private key to '/etc/ssl/private/ssl-cert-snakeoil.key'
-----
problems making Certificate Request
53829:error:0D07A097:asn1 encoding routines:ASN1_mbstring_ncopy:string too long:a_mbstr.c:154:maxsize=64
我不熟悉 OpenSSL;这里发生了什么事?
(此外,我应该将其分叉为一个新问题吗?这个问题的范围是否已经超出?)
答案1
答案2
输出中的关键摘录是运行ssl-cert
包的安装后脚本时出现的此错误:
Setting up ssl-cert (1.0.23ubuntu2) ... dpkg: error processing ssl-cert (--configure): subprocess installed post-installation script returned error exit status 1
所有后续错误均是由于未能完成安装而导致的ssl-cert
。
为了确切地postinst 脚本如何失败, 跑步
sudo sh -x /var/lib/dpkg/info/ssl-cert.postinst configure
一旦您成功调试了根本原因,请sudo apt-get install -f
再次运行。