每次我尝试安装包时,APT 都会尝试配置 PostgreSQL

每次我尝试安装包时,APT 都会尝试配置 PostgreSQL

最近,每当我尝试使用 apt-get 安装任何东西时,都会遇到一些奇怪的错误。以下是尝试安装 fluidsynth 的示例。

$ sudo apt-get install libfluidsynth1
Reading package lists... Done
Building dependency tree       
Reading state information... Done
libfluidsynth1 is already the newest version.
libfluidsynth1 set to manually installed.
0 upgraded, 0 newly installed, 0 to remove and 1 not upgraded.
2 not fully installed or removed.
After this operation, 0 B of additional disk space will be used.
Do you want to continue [Y/n]? y
Setting up postgresql-9.1 (9.1.10-0ubuntu12.04) ...
 * Starting PostgreSQL 9.1 database server                                                                                                                     * The PostgreSQL server failed to start. Please check the log output:
2013-11-03 14:21:42 EST FATAL:  could not access private key file "server.key": No such file or directory
                                                                                                                                                       [fail]
invoke-rc.d: initscript postgresql, action "start" failed.
dpkg: error processing postgresql-9.1 (--configure):
 subprocess installed post-installation script returned error exit status 1
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.
                                                                                                          Errors were encountered while processing:
 postgresql-9.1
 postgresql
E: Sub-process /usr/bin/dpkg returned an error code (1)

我运行的是 12.04。这是什么原因造成的?我该如何解决?安装很多东西时都会发生这种情况,似乎表明我需要初始化 postgresql 或类似的东西。我不记得摆弄过 postgres,所以我不确定为什么这突然变成了问题。

答案1

删除/清除postgresql-9.1并重新安装它们:

sudo apt-get --purge autoremove postgresql-9.1 postgresql

如果你确实使用postgresql,或者另一个包依赖于它,你可以再次安装它

sudo apt-get install postgresql the-other-program-that-got-removed

顺便说一句,libfluidsynth1已经安装了,您不需要再次安装它。

答案2

还有一个更简单的解决方案:Postgresql 需要“snakeoil”证书才能运行:/etc/ssl/private/ssl-cert-snakeoil.key 如果该证书以某种方式从您的系统中删除,您可以使用以下命令生成一个新的证书

# make-ssl-cert generate-default-snakeoil

相关内容