When I’m trying to use the postgresql-14 package from the Ubuntu Jammy OS repo, the postinst for the postgresql-14 package fails with the following error:
/var/lib/dpkg/info/postgresql-14.postinst: 104: db_stop: not found
dpkg: error processing package postgresql-14 (--configure):
installed postgresql-14 package post-installation script subprocess returned error exit status 127
That postinst script is simple:
#!/bin/sh
set -e
VERSION=${DPKG_MAINTSCRIPT_PACKAGE##*-}
if [ "$1" = configure ]; then
. /usr/share/postgresql-common/maintscripts-functions
configure_version $VERSION "$2"
fi
db_stop
is from /usr/share/debconf/confmodule
… I’ve figured out that that does not get loaded, due to /usr/share/postgresql-common/maintscripts-functions
containing this at the bottom: (where it should be sourcing that file)
# start debconf if we are in the server's postinst (can't run from a function)
if [ "${DPKG_MAINTSCRIPT_NAME:-}" = "postinst" ] && [ "$1" = "configure" ]; then
case $DPKG_MAINTSCRIPT_PACKAGE in
percona-postgresql-[89].?|percona-postgresql-[1-9]?)
. /usr/share/debconf/confmodule
;;
esac
fi
That matches the one from the Debian package, after this Percona patch has been applied.
I’ve managed to track down the reason for that - apt prefers installing percona-postgresql-common
when attempting to install postgresql-common
: (this is with the PGDG repo disabled)
# apt-cache policy postgresql-common
postgresql-common:
Installed: 1:241-6.jammy
Candidate: 1:241-6.jammy
Version table:
*** 1:241-6.jammy 500
500 http://repo.percona.com/ppg-14/apt jammy/main amd64 Packages
100 /var/lib/dpkg/status
1:241-5.jammy 500
500 http://repo.percona.com/ppg-14/apt jammy/main amd64 Packages
1:241-4.jammy 500
500 http://repo.percona.com/ppg-14/apt jammy/main amd64 Packages
1:241-3.jammy 500
500 http://repo.percona.com/ppg-14/apt jammy/main amd64 Packages
238 500
500 http://us-east-1.ec2.archive.ubuntu.com/ubuntu jammy/main amd64 Packages
apt-show on that also shows the Percona package instead:
# apt show postgresql-common
Package: postgresql-common
Version: 1:241-6.jammy
Priority: optional
Section: database
Source: percona-postgresql-common
Maintainer: Percona Development Team <info@percona.com>
Installed-Size: 642 kB
Provides: percona-postgresql-common, postgresql-common
Depends: adduser, debconf (>= 0.5.00) | debconf-2.0, libjson-perl, lsb-base (>= 3.0-3), perl (>= 5.14), percona-postgresql-client-common | postgresql-client-common, ssl-cert (>= 1.0.11), ucf
Recommends: e2fsprogs, logrotate
Conflicts: postgresql-common
Breaks: percona-postgresql-server-dev-all (<< 204), postgresql-9.1 (<< 9.1.1-3~), postgresql-server-dev-all (<< 204), systemd (<< 204)
Replaces: percona-postgresql-server-dev-all (<< 204), postgresql-common, postgresql-server-dev-all (<< 204)
Download-Size: 188 kB
APT-Manual-Installed: no
APT-Sources: http://repo.percona.com/ppg-14/apt jammy/main amd64 Packages
<description removed>
I suspect (but can’t easily confirm) that the cause for this is that it is marked that it replaces the postgresql-common
package, which might result in percona-postgresql-common being selected instead of the postgresql-common from the other source. (The postgresql.org (PGDG) repos have the same issue)