在Debian 11上安装PostgreSQL时出现错误

3

在Debian 11上安装PostgreSQL失败

第一次尝试安装软件包:sudo apt install postgresql

...
Unpacking postgresql (13+225) ...
Setting up postgresql-client-common (225) ...
Setting up libpq5:amd64 (13.5-0+deb11u1) ...
Setting up postgresql-client-13 (13.5-0+deb11u1) ...
double free or corruption (!prev)
dpkg: error processing package postgresql-client-13 (--configure):
 installed postgresql-client-13 package post-installation script subprocess was killed by signal (Aborted)
Setting up libz3-4:amd64 (4.8.10-1) ...
Setting up libllvm11:amd64 (1:11.0.1-2) ...
Setting up postgresql-common (225) ...
Adding user postgres to group ssl-cert

Creating config file /etc/postgresql-common/createcluster.conf with new version
Building PostgreSQL dictionaries from installed myspell/hunspell packages...
Removing obsolete dictionary files:
Created symlink /etc/systemd/system/multi-user.target.wants/postgresql.service  /lib/systemd/system/postgresql.service.
dpkg: dependency problems prevent configuration of postgresql-13:
 postgresql-13 depends on postgresql-client-13; however:
  Package postgresql-client-13 is not configured yet.

dpkg: error processing package postgresql-13 (--configure):
 dependency problems - leaving unconfigured
dpkg: dependency problems prevent configuration of postgresql:
 postgresql depends on postgresql-13; however:
  Package postgresql-13 is not configured yet.

dpkg: error processing package postgresql (--configure):
 dependency problems - leaving unconfigured
Processing triggers for man-db (2.9.4-2) ...
Processing triggers for libc-bin (2.31-13+deb11u2) ...
Errors were encountered while processing:
 postgresql-client-13
 postgresql-13
 postgresql
needrestart is being skipped since dpkg has failed
E: Sub-process /usr/bin/dpkg returned an error code (1)

注意到包 postgresql-client-13 出现了“iF”状态(配置失败),其他失败的包则呈“iU”状态

dpkg -l | grep postgres

iU  postgresql                    13+225                         all          object-relational SQL database (supported version)
iU  postgresql-13                 13.5-0+deb11u1                 amd64        The World's Most Advanced Open Source Relational Database
iF  postgresql-client-13          13.5-0+deb11u1                 amd64        front-end programs for PostgreSQL 13
ii  postgresql-client-common      225                            all          manager for multiple PostgreSQL client versions
ii  postgresql-common             225                            all          PostgreSQL database-cluster manager

第二个字母 -> 当前包状态:

i ... installed
U ... unpacked
F ... half-configured (configuration failed for some reason)

在此处获取软件包状态表: https://askubuntu.com/questions/18804/what-do-the-various-dpkg-flags-like-ii-rc-mean

我移除了所有的PostgreSQL软件包和所有文件,使用以下命令: sudo apt purge postgresql

然后我尝试重新安装postgresql-client-13,但是出现了上述错误。使用以下命令:sudo apt install postgresql-client-13

Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
The following packages were automatically installed and are no longer required:
  libllvm11 libz3-4
Use 'sudo apt autoremove' to remove them.
The following additional packages will be installed:
  postgresql-client-common
Suggested packages:
  postgresql-13 postgresql-doc-13
The following NEW packages will be installed:
  postgresql-client-13 postgresql-client-common
0 upgraded, 2 newly installed, 0 to remove and 0 not upgraded.
Need to get 0 B/1,603 kB of archives.
After this operation, 6,789 kB of additional disk space will be used.
Do you want to continue? [Y/n] y
Selecting previously unselected package postgresql-client-common.
(Reading database ... 39655 files and directories currently installed.)
Preparing to unpack .../postgresql-client-common_225_all.deb ...
Unpacking postgresql-client-common (225) ...
Selecting previously unselected package postgresql-client-13.
Preparing to unpack .../postgresql-client-13_13.5-0+deb11u1_amd64.deb ...
Unpacking postgresql-client-13 (13.5-0+deb11u1) ...
Setting up postgresql-client-common (225) ...
Setting up postgresql-client-13 (13.5-0+deb11u1) ...
double free or corruption (!prev)
dpkg: error processing package postgresql-client-13 (--configure):
 installed postgresql-client-13 package post-installation script subprocess was killed by signal (Aborted)
Processing triggers for man-db (2.9.4-2) ...
Errors were encountered while processing:
 postgresql-client-13
needrestart is being skipped since dpkg has failed
E: Sub-process /usr/bin/dpkg returned an error code (1)
1个回答

2

这个问题与之前安装的snoopy包有关。

使用sudo apt remove snoopy卸载snoopy后,安装PostgreSQL或postgresql-client-13。


1
这对我起作用了,不过还是不知道为什么。 - j4eo
如果安装了snoopy软件包,则无法安装postgresql-client-13。但是,在安装完postgresql-client-13之后,您可以安装snoopy(安装不会失败)。 - Rossano Fenner

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接