Hi Christoph, Thank you for your reply, it's got me a lot further.
On 2020-09-07 15:18 BST, Christoph Berg wrote: > it works on a fresh machine for me, so it is likely some particularity > of the system at your end. Oh no. Lucky me. > To see more details, can you put > > set -x > > at the beginning of /var/lib/dpkg/info/postgresql-common.postinst and > then try one of these: > > apt-get install -f I added 'set -x' on line 2 i.e. immediately following the shebang line. Then running 'apt -f install': #+BEGIN_QUOTE Setting up postgresql-common (200+deb10u3) ... + set -e + [ postgresql-common ] + . /usr/share/debconf/confmodule + [ ! ] + PERL_DL_NONLAZY=1 + export PERL_DL_NONLAZY + [ ] + exec /usr/share/debconf/frontend /var/lib/dpkg/info/postgresql-common.postinst configure debconf: unable to initialize frontend: Dialog debconf: (Dialog frontend will not work on a dumb terminal, an emacs shell buffer, or without a controlling terminal.) debconf: falling back to frontend: Readline + set -e + [ postgresql-common ] + . /usr/share/debconf/confmodule + [ ! 1 ] + [ -z ] + exec + [ ] + exec + DEBCONF_REDIR=1 + export DEBCONF_REDIR + SSL_ROOT=/etc/postgresql-common/root.crt + [ configure = configure ] + [ postgresql-common ] + quiet=--quiet + getent passwd postgres + getent group postgres + id -Gn postgres + grep -qw postgres + id -u postgres + [ 111 -eq 0 ] + id -g postgres + [ 121 -eq 0 ] + mkdir -p /var/lib/postgresql + su -s /bin/sh postgres -c test -O /var/lib/postgresql && test -G /var/lib/postgresql + chown postgres:postgres /etc/postgresql + mkdir -p /var/log/postgresql + chmod 1775 /var/log/postgresql + chown root:postgres /var/log/postgresql + [ -d /var/run/postgresql ] + [ -e /etc/postgresql-common/root.crt ] + [ -z ] + getent group ssl-cert + adduser --quiet postgres ssl-cert + [ ] + /usr/share/postgresql-common/pg_checksystem + setup_createclusterconf + [ postgresql-common ] + db_get postgresql-common/ssl + _db_cmd GET postgresql-common/ssl + _db_internal_IFS= + IFS= + printf %s\n GET postgresql-common/ssl + IFS= + read -r _db_internal_line + IFS= + RET=true + return 0 + SSL=on + CCTEMPLATE=/usr/share/postgresql-common/createcluster.conf + mktemp --tmpdir postgresql-common.XXXXXX + CCTMP=/tmp/postgresql-common.6BZ4dK + trap rm -f /tmp/postgresql-common.6BZ4dK 0 2 3 15 + sed -e s/^ssl =.*/ssl = on/ /usr/share/postgresql-common/createcluster.conf + chmod 644 /tmp/postgresql-common.6BZ4dK + CCCONFIG=/etc/postgresql-common/createcluster.conf + ucf --debconf-ok /tmp/postgresql-common.6BZ4dK /etc/postgresql-common/createcluster.conf + rm -f /tmp/postgresql-common.6BZ4dK dpkg: error processing package postgresql-common (--configure): installed postgresql-common package post-installation script subprocess returned error exit status 1 dpkg: dependency problems prevent configuration of postgresql-11: postgresql-11 depends on postgresql-common (>= 194~); however: Package postgresql-common is not configured yet. dpkg: error processing package postgresql-11 (--configure): dependency problems - leaving unconfigured Setting up sysstat (12.0.3-2) ... debconf: unable to initialize frontend: Dialog debconf: (Dialog frontend will not work on a dumb terminal, an emacs shell buffer, or without a controlling terminal.) debconf: falling back to frontend: Readline dpkg: error processing package sysstat (--configure): installed sysstat package post-installation script subprocess returned error exit status 1 Errors were encountered while processing: postgresql-common postgresql-11 sysstat E: Sub-process /usr/bin/dpkg returned an error code (1) #+END_QUOTE The following is my possibly mistaken interpretation. The relevant part of /var/lib/dpkg/info/postgresql-common.postinst is (with line numbers added): #+BEGIN_QUOTE 8 setup_createclusterconf () 9 { 10 [ "$DPKG_MAINTSCRIPT_PACKAGE" ] || return 0 11 db_get postgresql-common/ssl 12 case $RET in 13 true) SSL=on ;; 14 false) SSL=off ;; 15 *) return ;; 16 esac 17 18 CCTEMPLATE="/usr/share/postgresql-common/createcluster.conf" 19 CCTMP=`mktemp --tmpdir postgresql-common.XXXXXX` 20 trap "rm -f $CCTMP" 0 2 3 15 21 sed -e "s/^ssl =.*/ssl = $SSL/" $CCTEMPLATE > $CCTMP 22 chmod 644 $CCTMP 23 CCCONFIG="/etc/postgresql-common/createcluster.conf" 24 ucf --debconf-ok $CCTMP $CCCONFIG 25 ucfr postgresql-common $CCCONFIG 26 rm -f $CCTMP 27 } #+END_QUOTE The failing line is 24 and that invokes the 'trap' on line 20. Replicating line 24, after putting a copy of createcluster.conf into /tmp and setting VERBOSE and DEBUG in /etc/ucf.conf: #+BEGIN_QUOTE # ucf --debconf-ok /tmp/postgresql-common.RtydjD /etc/postgresql-common/createcluster.conf ucf: The Source directory is /tmp ucf: The State directory is /var/lib/ucf The hash file exists egrep [[:space:]]\/etc\/postgresql\-common\/createcluster\.conf$ /var/lib/ucf/hashfile #+END_QUOTE The egrep call fails. /var/lib/ucf/hashfile contains #+BEGIN_QUOTE 76992d926cdc020e0c3e6602c10efc96 /etc/apt/listchanges.conf c299c32b8fe145ad9082df4f95f68ae9 /etc/default/grub 2f1ad364c25bfd8dcee21c2d6ea97a3a /etc/papersize #+END_QUOTE i.e. it has nothing about postgresql. I don't know whether something was supposed to add such lines and didn't. Or whether the absence is something ucf expects and should cope with. Guessing on the latter, my suspicion is on line 568 of /usr/bin/ucf: #+BEGIN_QUOTE lastsum=$(egrep "[[:space:]]${safe_dest_file}$" "$statedir/hashfile" | \ awk '{print $1;}' ) #+END_QUOTE I changed that line to make it fail-proof and added some chit-chat: #+BEGIN_QUOTE echo "********************* looking for lastsum..." lastsum=$(egrep "[[:space:]]${safe_dest_file}$" "$statedir/hashfile" | \ awk '{print $1;}' ) || true echo "********************* lastsum is '$lastsum'." #+END_QUOTE and reran the install: #+BEGIN_QUOTE # apt-get -f install Reading package lists... Done Building dependency tree Reading state information... Done The following package was automatically installed and is no longer required: libgnutls-dane0 Use 'sudo apt autoremove' to remove it. 0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded. 3 not fully installed or removed. After this operation, 0 B of additional disk space will be used. Setting up postgresql-common (200+deb10u3) ... debconf: unable to initialize frontend: Dialog debconf: (Dialog frontend will not work on a dumb terminal, an emacs shell buffer, or without a controlling terminal.) debconf: falling back to frontend: Readline ********************* looking for lastsum... ********************* lastsum is ''. Creating config file /etc/postgresql-common/createcluster.conf with new version ********************* looking for lastsum... ********************* lastsum is ''. Building PostgreSQL dictionaries from installed myspell/hunspell packages... en_us Removing obsolete dictionary files: Created symlink /etc/systemd/system/multi-user.target.wants/postgresql.service → /lib/systemd/system/postgresql.service. Setting up postgresql-11 (11.7-0+deb10u1) ... debconf: unable to initialize frontend: Dialog debconf: (Dialog frontend will not work on a dumb terminal, an emacs shell buffer, or without a controlling terminal.) debconf: falling back to frontend: Readline Creating new PostgreSQL cluster 11/main ... /usr/lib/postgresql/11/bin/initdb -D /var/lib/postgresql/11/main --auth-local peer --auth-host md5 The files belonging to this database system will be owned by user "postgres". This user must also own the server process. The database cluster will be initialized with locale "en_GB.UTF-8". The default database encoding has accordingly been set to "UTF8". The default text search configuration will be set to "english". Data page checksums are disabled. fixing permissions on existing directory /var/lib/postgresql/11/main ... ok creating subdirectories ... ok selecting default max_connections ... 100 selecting default shared_buffers ... 128MB selecting default timezone ... Europe/London selecting dynamic shared memory implementation ... posix creating configuration files ... ok running bootstrap script ... ok performing post-bootstrap initialization ... ok syncing data to disk ... ok Success. You can now start the database server using: pg_ctlcluster 11 main start Ver Cluster Port Status Owner Data directory Log file 11 main 5432 down postgres /var/lib/postgresql/11/main /var/log/postgresql/postgresql-11-main.log update-alternatives: using /usr/share/postgresql/11/man/man1/postmaster.1.gz to provide /usr/share/man/man1/postmaster.1.gz (postmaster.1.gz) in auto mode Setting up sysstat (12.0.3-2) ... debconf: unable to initialize frontend: Dialog debconf: (Dialog frontend will not work on a dumb terminal, an emacs shell buffer, or without a controlling terminal.) debconf: falling back to frontend: Readline ********************* looking for lastsum... ********************* lastsum is ''. Creating config file /etc/default/sysstat with new version update-alternatives: using /usr/bin/sar.sysstat to provide /usr/bin/sar (sar) in auto mode Created symlink /etc/systemd/system/multi-user.target.wants/sysstat.service → /lib/systemd/system/sysstat.service. [master d22fb33] committing changes in /etc made by "apt-get -f install" 41 files changed, 965 insertions(+), 1 deletion(-) create mode 120000 alternatives/initdb.1.gz create mode 120000 alternatives/oid2name.1.gz create mode 120000 alternatives/pg_archivecleanup.1.gz create mode 120000 alternatives/pg_controldata.1.gz create mode 120000 alternatives/pg_ctl.1.gz create mode 120000 alternatives/pg_resetwal.1.gz create mode 120000 alternatives/pg_rewind.1.gz create mode 120000 alternatives/pg_standby.1.gz create mode 120000 alternatives/pg_test_fsync.1.gz create mode 120000 alternatives/pg_test_timing.1.gz create mode 120000 alternatives/pg_upgrade.1.gz create mode 120000 alternatives/pg_verify_checksums.1.gz create mode 120000 alternatives/pg_waldump.1.gz create mode 120000 alternatives/pgbench.1.gz create mode 120000 alternatives/postgres.1.gz create mode 120000 alternatives/postmaster.1.gz create mode 120000 alternatives/sar create mode 120000 alternatives/sar.1.gz create mode 120000 alternatives/vacuumlo.1.gz create mode 100644 default/sysstat create mode 100644 postgresql-common/createcluster.conf create mode 100644 postgresql/11/main/environment create mode 100644 postgresql/11/main/pg_ctl.conf create mode 100644 postgresql/11/main/pg_hba.conf create mode 100644 postgresql/11/main/pg_ident.conf create mode 100644 postgresql/11/main/postgresql.conf create mode 100644 postgresql/11/main/start.conf create mode 120000 rc0.d/K01postgresql create mode 120000 rc1.d/K01postgresql create mode 120000 rc2.d/S01postgresql create mode 120000 rc2.d/S01sysstat create mode 120000 rc3.d/S01postgresql create mode 120000 rc3.d/S01sysstat create mode 120000 rc4.d/S01postgresql create mode 120000 rc4.d/S01sysstat create mode 120000 rc5.d/S01postgresql create mode 120000 rc5.d/S01sysstat create mode 120000 rc6.d/K01postgresql create mode 120000 systemd/system/multi-user.target.wants/postgresql.service create mode 120000 systemd/system/multi-user.target.wants/sysstat.service # systemctl status postgresql ● postgresql.service - PostgreSQL RDBMS Loaded: loaded (/lib/systemd/system/postgresql.service; enabled; vendor preset: enabled) Active: active (exited) since Mon 2020-09-07 15:10:50 BST; 20s ago Main PID: 5856 (code=exited, status=0/SUCCESS) Tasks: 0 (limit: 4915) Memory: 0B CGroup: /system.slice/postgresql.service Sep 07 15:10:50 argon systemd[1]: Starting PostgreSQL RDBMS... Sep 07 15:10:50 argon systemd[1]: Started PostgreSQL RDBMS. #+END_QUOTE That went a lot better. It also fixed the same trouble (I think) with sysstat. Lines for postgresql-common and sysstat are now present in /var/lib/ucf/hashfile. So I agree this doesn't look like a postgresql-specific problem. The peculiar thing is, after seeing the problem the first time I did freshly re-install Debian on my computer in case I had somehow acquired corruption or some such, yet for *my* fresh install, the problem occurred again, hence this bug report. If you have any thoughts on what my machine's peculiarity might be, I would love to hear. Is it worth reassigning this bug to ucf perhaps? Thanks again. -- Nick