Someone installed postgresql in our server and causing an update issue. I am trying to remove this package but failed after many attempts. For examples:
$ sudo apt autoremove
Reading package lists... Done
Building dependency tree
Reading state information... Done
0 upgraded, 0 newly installed, 0 to remove and 5 not upgraded.
1 not fully installed or removed.
After this operation, 0 B of additional disk space will be used.
Setting up postgresql-client-11 (11.7-0ubuntu0.19.10.1) ...
/var/lib/dpkg/info/postgresql-client-11.postinst: 7: .: Can't open /usr/share/postgresql-common/maintscripts-functions
dpkg: error processing package postgresql-client-11 (--configure):
installed postgresql-client-11 package post-installation script subprocess returned error exit status 127
Errors were encountered while processing:
postgresql-client-11
E: Sub-process /usr/bin/dpkg returned an error code (1)
What else can I do to fix this?
I can see lots of postgresql in the server:
$ sudo ls -l /var/lib/dpkg/info | grep -i postgresql
-rw-r--r-- 1 root root 0 Nov 19 2020 postgresql-12.list
-rwxr-xr-x 1 root root 2641 May 13 2020 postgresql-12.postrm
-rw-r--r-- 1 root root 11579 Nov 22 2020 postgresql-client-11.list
-rw-r--r-- 1 root root 18400 Feb 13 2020 postgresql-client-11.md5sums
-rwxr-xr-x 1 root root 193 Feb 13 2020 postgresql-client-11.postinst
-rwxr-xr-x 1 root root 185 Feb 13 2020 postgresql-client-11.prerm
-rw-r--r-- 1 root root 79 May 14 2020 postgresql-client-common.conffiles
-rw-r--r-- 1 root root 1268 Nov 19 2020 postgresql-client-common.list
-rw-r--r-- 1 root root 843 May 14 2020 postgresql-client-common.md5sums
-rwxr-xr-x 1 root root 177 May 14 2020 postgresql-client-common.postrm
How can I remove these nasty packages?