Postgresql 13 update issue

I just tried to update my Postgresql installation on from 13 on an Ubuntu 20.04.3 LTS node and it fails due to the postgresql-common package post installation script.

Any help on this would be appreciated.

The following NEW packages will be installed:
  postgresql-client-common postgresql-common
The following packages will be upgraded:
  libpq5 percona-patroni percona-pg-stat-monitor13 percona-pgbackrest percona-postgresql-13 percona-postgresql-13-pgaudit percona-postgresql-13-repack percona-postgresql-client-13 percona-postgresql-client-common
  percona-postgresql-common
10 upgraded, 2 newly installed, 0 to remove and 0 not upgraded.
Need to get 0 B/17.7 MB of archives.
After this operation, 23.6 kB of additional disk space will be used.
Do you want to continue? [Y/n] Y
Preconfiguring packages ...
dpkg: percona-postgresql-common: dependency problems, but removing anyway as you requested:
 percona-postgresql-13 depends on percona-postgresql-common (>= 182~).
 percona-pgbackrest depends on postgresql-common | percona-postgresql-common; however:
  Package postgresql-common is not installed.
  Package percona-postgresql-common which provides postgresql-common is to be removed.
  Package percona-postgresql-common is to be removed.
  Package percona-postgresql-common which provides percona-postgresql-common is to be removed.
 percona-postgresql-13 depends on percona-postgresql-common (>= 182~).
 percona-pgbackrest depends on postgresql-common | percona-postgresql-common; however:
  Package postgresql-common is not installed.
  Package percona-postgresql-common which provides postgresql-common is to be removed.
  Package percona-postgresql-common is to be removed.
  Package percona-postgresql-common which provides percona-postgresql-common is to be removed.
 percona-pgbackrest depends on postgresql-common | percona-postgresql-common; however:
  Package postgresql-common is not installed.
  Package percona-postgresql-common which provides postgresql-common is to be removed.
  Package percona-postgresql-common is to be removed.
  Package percona-postgresql-common which provides percona-postgresql-common is to be removed.

(Reading database ... 114499 files and directories currently installed.)
Removing percona-postgresql-common (226-3.focal) ...
dpkg: warning: while removing percona-postgresql-common, unable to remove directory '/var/lib/postgresql': Device or resource busy - directory may be a mount point?
Removing 'diversion of /usr/bin/pg_config to /usr/bin/pg_config.libpq-dev by percona-postgresql-common'
Selecting previously unselected package postgresql-common.
(Reading database ... 114385 files and directories currently installed.)
Preparing to unpack .../postgresql-common_1%3a230-1.focal_all.deb ...
Adding 'diversion of /usr/bin/pg_config to /usr/bin/pg_config.libpq-dev by postgresql-common'
Unpacking postgresql-common (1:230-1.focal) ...
Setting up postgresql-common (1:230-1.focal) ...
ucfr: Attempt from package postgresql-common  to take /etc/postgresql-common/createcluster.conf away from package percona-postgresql-common
ucfr: Aborting.
dpkg: error processing package postgresql-common (--configure):
 installed postgresql-common package post-installation script subprocess returned error exit status 4
Errors were encountered while processing:
 postgresql-common
E: Sub-process /usr/bin/dpkg returned an error code (1)


$ sudo apt --fix-broken install
Reading package lists... Done
Building dependency tree
Reading state information... Done
Correcting dependencies... Done
The following additional packages will be installed:
  percona-postgresql-common
The following NEW packages will be installed:
  percona-postgresql-common
0 upgraded, 1 newly installed, 0 to remove and 9 not upgraded.
1 not fully installed or removed.
Need to get 0 B/5,884 B of archives.
After this operation, 11.3 kB of additional disk space will be used.
Do you want to continue? [Y/n] Y
Setting up postgresql-common (1:230-1.focal) ...
ucfr: Attempt from package postgresql-common  to take /etc/postgresql-common/createcluster.conf away from package percona-postgresql-common
ucfr: Aborting.
dpkg: error processing package postgresql-common (--configure):
 installed postgresql-common package post-installation script subprocess returned error exit status 4
Errors were encountered while processing:
 postgresql-common
E: Sub-process /usr/bin/dpkg returned an error code (1)

1 Like
$ sudo dpkg -l |grep postgres
ii  percona-postgresql-13                2:13-3.2.focal                        amd64        The World's Most Advanced Open Source Relational Database
ii  percona-postgresql-13-pgaudit        1:1.5.0-5.focal                       amd64        PostgreSQL Audit Extension
ii  percona-postgresql-13-repack         1:1.4.6-6.focal                       amd64        reorganize tables in PostgreSQL databases with minimal locks
ii  percona-postgresql-client-13         2:13-3.2.focal                        amd64        front-end programs for PostgreSQL 13
ii  percona-postgresql-client-common     226-3.focal                           all          manager for multiple PostgreSQL client versions
ic  percona-postgresql-common            226-3.focal                           all          PostgreSQL database-cluster manager
iF  postgresql-common                    1:230-1.focal                         all          PostgreSQL database-cluster manager
1 Like

Hi @johnpitton
Thanks for your report. I have created jira issue for it
https://jira.percona.com/browse/DISTPG-358

1 Like

Hi @johnpitton
the issue is fixed and you can proceed with update

1 Like

Here’s what I see for postgres packages before I upgrade:

$ sudo dpkg -l |grep -i post
ii  libpq5:amd64                         2:13-3.2.focal                        amd64        PostgreSQL C client library
ii  percona-patroni                      1:2.1.0-1.focal                       all          PostgreSQL High Availability with ZooKeeper, etcd, Consul, or Kubernetes
ii  percona-pgbackrest                   1:2.34-1.focal                        amd64        Reliable PostgreSQL Backup & Restore
ii  percona-postgresql-13                2:13-3.2.focal                        amd64        The World's Most Advanced Open Source Relational Database
ii  percona-postgresql-13-pgaudit        1:1.5.0-5.focal                       amd64        PostgreSQL Audit Extension
ii  percona-postgresql-13-repack         1:1.4.6-6.focal                       amd64        reorganize tables in PostgreSQL databases with minimal locks
ii  percona-postgresql-client-13         2:13-3.2.focal                        amd64        front-end programs for PostgreSQL 13
ii  percona-postgresql-client-common     226-3.focal                           all          manager for multiple PostgreSQL client versions
ii  percona-postgresql-common            226-3.focal                           all          PostgreSQL database-cluster manager
ii  pgloader                             3.6.1-1                               amd64        extract, transform and load data into PostgreSQL
ii  python3-psycopg2                     1:2.8.6-4.focal                       amd64        Python 3 module for PostgreSQL
$

And here’s what I see afterwards:

$ sudo apt-get update && sudo apt-get dist-upgrade && sudo apt-get autoremove && sudo apt-get autoclean && sudo snap refresh
Hit:1 http://pkg.scaleft.com/deb linux InRelease
Get:2 https://download.docker.com/linux/ubuntu focal InRelease [57.7 kB]
Hit:3 https://repo.zabbix.com/zabbix/5.4/ubuntu focal InRelease
Hit:4 http://us.archive.ubuntu.com/ubuntu focal InRelease
Hit:5 http://us.archive.ubuntu.com/ubuntu focal-updates InRelease
Hit:6 http://repo.percona.com/ppg-13/apt focal InRelease
Hit:7 http://ppa.launchpad.net/vbernat/haproxy-2.4/ubuntu focal InRelease
Hit:8 http://us.archive.ubuntu.com/ubuntu focal-backports InRelease
Hit:9 http://repo.percona.com/prel/apt focal InRelease
Hit:10 http://us.archive.ubuntu.com/ubuntu focal-security InRelease
Fetched 57.7 kB in 2s (35.4 kB/s)
Reading package lists... Done
Reading package lists... Done
Building dependency tree
Reading state information... Done
Calculating upgrade... Done
The following NEW packages will be installed:
  postgresql-common
The following packages have been kept back:
  percona-postgresql-client-13
The following packages will be upgraded:
  haproxy libpq5 percona-patroni percona-pg-stat-monitor13 percona-pgbackrest percona-postgresql-13 percona-postgresql-13-pgaudit percona-postgresql-13-repack percona-postgresql-common zabbix-agent2
10 upgraded, 1 newly installed, 0 to remove and 1 not upgraded.
Need to get 15.4 MB/22.1 MB of archives.
After this operation, 0 B of additional disk space will be used.
Do you want to continue? [Y/n] Y
Get:1 http://repo.percona.com/ppg-13/apt focal/main amd64 postgresql-common all 1:230-2.focal [158 kB]
Get:2 http://repo.percona.com/ppg-13/apt focal/main amd64 percona-postgresql-common all 1:230-2.focal [5,884 B]
Get:3 http://repo.percona.com/ppg-13/apt focal/main amd64 libpq5 amd64 2:13.5-2.focal [175 kB]
Get:4 http://repo.percona.com/ppg-13/apt focal/main amd64 percona-postgresql-13 amd64 2:13.5-2.focal [15.1 MB]
Fetched 15.4 MB in 1s (11.7 MB/s)
Preconfiguring packages ...
(Reading database ... 112880 files and directories currently installed.)
Preparing to unpack .../haproxy_2.4.9-1ppa1~focal_amd64.deb ...
Unpacking haproxy (2.4.9-1ppa1~focal) over (2.4.8-1ppa1~focal) ...
dpkg: percona-postgresql-common: dependency problems, but removing anyway as you requested:
 percona-postgresql-13 depends on percona-postgresql-common (>= 182~).
 percona-pgbackrest depends on postgresql-common | percona-postgresql-common; however:
  Package postgresql-common is not installed.
  Package percona-postgresql-common which provides postgresql-common is to be removed.
  Package percona-postgresql-common is to be removed.
  Package percona-postgresql-common which provides percona-postgresql-common is to be removed.
 percona-postgresql-13 depends on percona-postgresql-common (>= 182~).
 percona-pgbackrest depends on postgresql-common | percona-postgresql-common; however:
  Package postgresql-common is not installed.
  Package percona-postgresql-common which provides postgresql-common is to be removed.
  Package percona-postgresql-common is to be removed.
  Package percona-postgresql-common which provides percona-postgresql-common is to be removed.
 percona-pgbackrest depends on postgresql-common | percona-postgresql-common; however:
  Package postgresql-common is not installed.
  Package percona-postgresql-common which provides postgresql-common is to be removed.
  Package percona-postgresql-common is to be removed.
  Package percona-postgresql-common which provides percona-postgresql-common is to be removed.

(Reading database ... 112880 files and directories currently installed.)
Removing percona-postgresql-common (226-3.focal) ...
dpkg: warning: while removing percona-postgresql-common, unable to remove directory '/var/lib/postgresql': Device or resource busy - directory may be a mount point?
Removing 'diversion of /usr/bin/pg_config to /usr/bin/pg_config.libpq-dev by percona-postgresql-common'
Selecting previously unselected package postgresql-common.
(Reading database ... 112766 files and directories currently installed.)
Preparing to unpack .../postgresql-common_1%3a230-2.focal_all.deb ...
Adding 'diversion of /usr/bin/pg_config to /usr/bin/pg_config.libpq-dev by postgresql-common'
Unpacking postgresql-common (1:230-2.focal) ...
Setting up postgresql-common (1:230-2.focal) ...
Building PostgreSQL dictionaries from installed myspell/hunspell packages...
Removing obsolete dictionary files:
Selecting previously unselected package percona-postgresql-common.
(Reading database ... 112883 files and directories currently installed.)
Preparing to unpack .../0-percona-postgresql-common_1%3a230-2.focal_all.deb ...
Unpacking percona-postgresql-common (1:230-2.focal) ...
Preparing to unpack .../1-libpq5_2%3a13.5-2.focal_amd64.deb ...
Unpacking libpq5:amd64 (2:13.5-2.focal) over (2:13-3.2.focal) ...
Preparing to unpack .../2-percona-patroni_1%3a2.1.1-1.focal_all.deb ...
Unpacking percona-patroni (1:2.1.1-1.focal) over (1:2.1.0-1.focal) ...
Preparing to unpack .../3-percona-postgresql-13-repack_1%3a1.4.7-1.focal_amd64.deb ...
Unpacking percona-postgresql-13-repack (1:1.4.7-1.focal) over (1:1.4.6-6.focal) ...
Preparing to unpack .../4-percona-postgresql-13-pgaudit_1%3a1.5.0-6.focal_amd64.deb ...
Unpacking percona-postgresql-13-pgaudit (1:1.5.0-6.focal) over (1:1.5.0-5.focal) ...
Preparing to unpack .../5-percona-postgresql-13_2%3a13.5-2.focal_amd64.deb ...
Unpacking percona-postgresql-13 (2:13.5-2.focal) over (2:13-3.2.focal) ...
Preparing to unpack .../6-percona-pg-stat-monitor13_1%3a1.0.0-1.focal_amd64.deb ...
Unpacking percona-pg-stat-monitor13 (1:1.0.0-1.focal) over (1:0.9.2-1.focal) ...
Preparing to unpack .../7-percona-pgbackrest_1%3a2.36-1.focal_amd64.deb ...
Unpacking percona-pgbackrest (1:2.36-1.focal) over (1:2.34-1.focal) ...
Preparing to unpack .../8-zabbix-agent2_1%3a5.4.8-1+ubuntu20.04_amd64.deb ...
Unpacking zabbix-agent2 (1:5.4.8-1+ubuntu20.04) over (1:5.4.7-1+ubuntu20.04) ...
Setting up libpq5:amd64 (2:13.5-2.focal) ...
Setting up haproxy (2.4.9-1ppa1~focal) ...
Installing new version of config file /etc/logrotate.d/haproxy ...
Setting up percona-postgresql-common (1:230-2.focal) ...
Setting up percona-patroni (1:2.1.1-1.focal) ...
Setting up zabbix-agent2 (1:5.4.8-1+ubuntu20.04) ...
Setting up percona-pgbackrest (1:2.36-1.focal) ...
Setting up percona-postgresql-13 (2:13.5-2.focal) ...
Setting up percona-postgresql-13-pgaudit (1:1.5.0-6.focal) ...
Setting up percona-pg-stat-monitor13 (1:1.0.0-1.focal) ...
Setting up percona-postgresql-13-repack (1:1.4.7-1.focal) ...
update-alternatives: using /usr/lib/postgresql/13/bin/pg_repack to provide /usr/bin/pg_repack (pg_repack) in auto mode
Processing triggers for rsyslog (8.2001.0-1ubuntu1.1) ...
Processing triggers for systemd (245.4-4ubuntu3.13) ...
Processing triggers for man-db (2.9.1-1) ...
Processing triggers for postgresql-common (1:230-2.focal) ...
Building PostgreSQL dictionaries from installed myspell/hunspell packages...
Removing obsolete dictionary files:
Processing triggers for libc-bin (2.31-0ubuntu9.2) ...
Reading package lists... Done
Building dependency tree
Reading state information... Done
0 upgraded, 0 newly installed, 0 to remove and 2 not upgraded.
Reading package lists... Done
Building dependency tree
Reading state information... Done
All snaps up to date.
$ sudo dpkg -l |grep -i post
ii  libpq5:amd64                         2:13.5-2.focal                        amd64        PostgreSQL C client library
ii  percona-patroni                      1:2.1.1-1.focal                       all          PostgreSQL High Availability with ZooKeeper, etcd, Consul, or Kubernetes
ii  percona-pgbackrest                   1:2.36-1.focal                        amd64        Reliable PostgreSQL Backup & Restore
ii  percona-postgresql-13                2:13.5-2.focal                        amd64        The World's Most Advanced Open Source Relational Database
ii  percona-postgresql-13-pgaudit        1:1.5.0-6.focal                       amd64        PostgreSQL Audit Extension
ii  percona-postgresql-13-repack         1:1.4.7-1.focal                       amd64        reorganize tables in PostgreSQL databases with minimal locks
ii  percona-postgresql-client-13         2:13-3.2.focal                        amd64        front-end programs for PostgreSQL 13
ii  percona-postgresql-client-common     226-3.focal                           all          manager for multiple PostgreSQL client versions
ii  percona-postgresql-common            1:230-2.focal                         all          Virtual package to satisfy dependencies
ii  pgloader                             3.6.1-1                               amd64        extract, transform and load data into PostgreSQL
ii  postgresql-common                    1:230-2.focal                         all          PostgreSQL database-cluster manager
ii  python3-psycopg2                     1:2.8.6-4.focal                       amd64        Python 3 module for PostgreSQL
$

Should postgresql-common pkg also get installed as it shows?
Other than that additional package it looks like there are no errors and the postgresql.service appears to be operational.

1 Like

Update:
One correction, which is pretty significant, the postgresql.service is not operational and the postgres logs show the server isn’t starting anymore.

pg_ctl: could not start server
Examine the log output.
2021-12-02 21:40:49.871 UTC [5621] FATAL:  could not access file "pg_stat_monitor": No such file or directory
2021-12-02 21:40:49.871 UTC [5621] LOG:  database system is shut down
pg_ctl: could not start server
Examine the log output.
Dec 02 21:40:49 proteuspgprod01 systemd[1]: postgresql@13-main.service: Can't open PID file /run/postgresql/13-main.pid (yet?) after start: Operation not permitted
Dec 02 21:40:49 proteuspgprod01 systemd[1]: postgresql@13-main.service: Failed with result 'protocol'.
Dec 02 21:40:49 proteuspgprod01 systemd[1]: Failed to start PostgreSQL Cluster 13-main.
1 Like

It is strange as it works well for me

vagrant@ubuntu-focal:~$ sudo systemctl status postgresql.service 
â—Ź postgresql.service - PostgreSQL RDBMS
     Loaded: loaded (/lib/systemd/system/postgresql.service; disabled; vendor preset: enabled)
     Active: active (exited) since Thu 2021-12-02 21:54:32 UTC; 24s ago
   Main PID: 4593 (code=exited, status=0/SUCCESS)
      Tasks: 0 (limit: 1136)
     Memory: 0B
     CGroup: /system.slice/postgresql.service

Dec 02 21:54:32 ubuntu-focal systemd[1]: Starting PostgreSQL RDBMS...
Dec 02 21:54:32 ubuntu-focal systemd[1]: Finished PostgreSQL RDBMS.

Additionally

postgres@ubuntu-focal:~$ psql
psql (13.5 (Ubuntu 2:13.5-2.focal))
Type "help" for help.

postgres=# \q
postgres@ubuntu-focal:~$ logout
1 Like

As for youe logs seems the main issue is:
Can't open PID file /run/postgresql/13-main.pid (yet?) after start: Operation not permitted
So please check if file exists and it’s permissions

1 Like

I don’t see it.
I wonder if the issue has to do with this which happens during the update process:

The following NEW packages will be installed:
  postgresql-common
1 Like