2

Everytime I install PostgreSQL in Ubuntu 18.04 (even when I ask apt-get to specifically install version 11 with a sudo apt-get install postgresq-11) I get version 10 and version 11 in my system.

andre@linuxrocks:/var/lib/postgresql$ ls -la
total 48
drwxr-xr-x  5 postgres postgres  4096 jul 18 01:17 .
drwxr-xr-x 86 root     root      4096 jul  5 14:54 ..
drwxr-xr-x  3 postgres postgres  4096 abr 16 10:19 10
drwxr-xr-x  3 postgres postgres  4096 jul 13 00:37 11

The objects in database repeat themselves in these two folders.

postgres=# \! find ~ -type f -name 16563
/var/lib/postgresql/11/main/base/13132/16563
/var/lib/postgresql/10/main/base/16385/16563

I have two postgresql.conf, one in every folder, although the DBMS seems to get its configs only from the one in 11 folder.

I've detected this strange behavior after I did a ps -f -u postgres to see all PostgreSQL processes, and see that my system created duplicated processes (one from 10 folder and another from 11). So I've purged and reinstalled PostgreSQL (with sudo apt-get install postgresq-11) and now I don't have duplicated processes anymore.

andre@linuxrocks:~$ ps -f -u postgres
UID        PID  PPID  C STIME TTY          TIME CMD
postgres  1595     1  0 14:30 ?        00:00:00 /usr/lib/postgresql/11/bin/postgres -D /var/lib/postgresql/11/mai
postgres  1684  1595  0 14:30 ?        00:00:00 postgres: 11/main: logger   
postgres  1692  1595  0 14:30 ?        00:00:00 postgres: 11/main: checkpointer   
postgres  1693  1595  0 14:30 ?        00:00:00 postgres: 11/main: background writer   
postgres  1694  1595  0 14:30 ?        00:00:00 postgres: 11/main: walwriter   
postgres  1695  1595  0 14:30 ?        00:00:00 postgres: 11/main: autovacuum launcher   
postgres  1696  1595  0 14:30 ?        00:00:00 postgres: 11/main: stats collector   
postgres  1697  1595  0 14:30 ?        00:00:00 postgres: 11/main: logical replication launcher   
postgres 11074 11073  0 14:33 pts/0    00:00:00 bash
postgres 11078 11074  0 14:33 pts/0    00:00:00 /usr/lib/postgresql/11/bin/psql
postgres 11091  1595  0 14:33 ?        00:00:00 postgres: 11/main: postgres postgres [local] idle

Even so, I have the two folders and duplicated objects. Why this is happening?

1
  • Maybe askubuntu.com/a/5637/29073: basically sudo apt install aptitude (if you don't have it already), then you can aptitude why postrgresql-10. Speculating: Perhaps you have apt set to automatically install recommends and suggests; then something that postrgresql-11 installs might be causing a reverse "dependency" install of -10.
    – pbhj
    Jul 18, 2019 at 18:11

1 Answer 1

0

The short answer: It's happening because you didn't uninstall version 10 (Ubuntu 18.04) before installing version 11 from some other non-Ubuntu source.

Take a look at version 10 and 11 availability in the Ubuntu repositories:

$ rmadison postgresql-10
 postgresql-10 | 10.3-1                | bionic
 postgresql-10 | 10.5-1                | cosmic
 postgresql-10 | 10.9-0ubuntu0.18.04.1 | bionic-security
 postgresql-10 | 10.9-0ubuntu0.18.04.1 | bionic-updates
 postgresql-10 | 10.9-0ubuntu0.18.10.1 | cosmic-security
 postgresql-10 | 10.9-0ubuntu0.18.10.1 | cosmic-updates

$ rmadison postgresql-11
 postgresql-11 | 11.2-1                | disco
 postgresql-11 | 11.4-0ubuntu0.19.04.1 | disco-security
 postgresql-11 | 11.4-0ubuntu0.19.04.1 | disco-updates
 postgresql-11 | 11.4-1.1~build1       | eoan

$ snap search postgresql
Name                                 Version   Publisher      Notes    Summary
postgresql95                         9.5.13    cmd✓           -        PostgreSQL is a powerful, open source object-relational database system.
postgresql96                         9.6.9     cmd✓           -        PostgreSQL is a powerful, open source object-relational database system.
postgresql10                         10.4      cmd✓           -        PostgreSQL is a powerful, open source object-relational database system.
postgresql93                         9.3.23    cmd✓           -        PostgreSQL is a powerful, open source object-relational database system.
postgresql94                         9.4.18    cmd✓           -        PostgreSQL is a powerful, open source object-relational database system.

From this, we learn two things:

1) Version 10 and 11 have different package names. This means you can install multple versions side-by-side. This seems to be what you did. You can simply remove most your your postgresql-10 or postgresql-10-* packages. (Warning - misusing wildcards can damage your system; always run a --simulate first and read your output carefully to ensure it's removing only what you want)

2) Version 11 is not available for 18.04 from any official Ubuntu source. That means you added some non-Ubuntu source. So be doubly careful when removing version 10: We don't know what you added, from where, or what other non-Ubuntu dependencies it dragged in.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .