Search code examples
postgresqldebianaptsnoopy

Errors trying to install PostgreSQL on Debian 11


Fail to install PostgreSQL on Debian 11

First time to install package: 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)

Look that package postgresql-client-13 appears with "iF" state (configuration failed) and other failed packages with "iU" state

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

Second letter -> current package state:

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

Get packages states table at: https://askubuntu.com/questions/18804/what-do-the-various-dpkg-flags-like-ii-rc-mean

I removed all PostgreSQL packages and all files with: sudo apt purge postgresql

After that I tried again to install postgresql-client-13, which returned the error above. 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)

Solution

  • The problem is related to the existence of the previously installed snoopy package.

    Uninstall snoopy with sudo apt remove snoopy and, after that install PostgreSQL or postgresql-client-13.