0

I want to install PostgreSQL on my Ubuntu 16.04 machine.

After running this command:

sudo apt-get install postgresql postgresql-contrib

I get the following:

Reading package lists... Done
Building dependency tree       
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies:
 gir1.2-rb-3.0 : Depends: librhythmbox-core9 (>= 3.3) but it is not going to be installed
 gnome-control-center : Depends: libgoa-backend-1.0-1 (>= 3.10.0) but it is not going to be installed
 indicator-datetime : Depends: libecal-1.2-16 (>= 3.7.90) but it is not going to be installed
                      Depends: libedataserver-1.2-18 (>= 3.5.91) but it is not going to be installed
                      Recommends: evolution-data-server but it is not going to be installed
                      Recommends: geoclue-ubuntu-geoip but it is not going to be installed or
                                  geoclue-provider
                      Recommends: unity-control-center (>= 14.04.3) but it is not going to be installed or
                                  ubuntu-system-settings but it is not going to be installed
 libcheese7 : Depends: gstreamer1.0-plugins-good (>= 0.11.0) but it is not going to be installed
 libgphoto2-dev : Depends: libgphoto2-6 (= 2.5.3.1-1ubuntu2.2) but 2.5.9-3 is to be installed
 libgtk-3-0 : Depends: librest-0.7-0 (>= 0.7) but it is not going to be installed
 libnice10 : Depends: libgupnp-igd-1.0-4 (>= 0.2.4) but it is not going to be installed
 network-manager-gnome : Depends: network-manager (>= 0.9.8) but it is not going to be installed
 plainbox-provider-checkbox : Depends: plainbox-provider-resource-generic (>= 0.3) but it is not going to be installed
                              Recommends: gstreamer1.0-plugins-good but it is not going to be installed
 ubuntu-release-upgrader-gtk : Depends: gir1.2-webkit2-4.0 but it is not going to be installed or
                                        gir1.2-webkit-3.0 but it is not going to be installed
 ubuntu-sso-client : Depends: python-ubuntu-sso-client (= 13.10-0ubuntu11) but it is not going to be installed
 yelp : Depends: libwebkitgtk-3.0-0 (>= 1.3.10) but it is not going to be installed
        Depends: libyelp0 (= 3.10.2-0ubuntu1) but it is not going to be installed
 zenity : Depends: libwebkit2gtk-4.0-37 (>= 2.5.3) but it is not going to be installed
E: Error, pkgProblemResolver::Resolve generated breaks, this may be caused by held packages.

How should I proceed?

EDIT:

The first 220 lines of the output of apt-cache policy postgresql* (shortened because of the rule about the maximal number of characters in a code environment):

libghc-haskelldb-hdbc-postgresql-dev:
  Installed: (none)
  Candidate: 2.1.2-7build1
  Version table:
     2.1.2-7build1 0
        500 http://cz.archive.ubuntu.com/ubuntu/ xenial/universe amd64 Packages
     2.1.2-3build1 0
        500 http://rs.archive.ubuntu.com/ubuntu/ trusty/universe amd64 Packages
postgresql-prioritize:
  Installed: (none)
  Candidate: 1.0.4-1
  Version table:
     1.0.4-1 0
        500 http://rs.archive.ubuntu.com/ubuntu/ trusty/universe amd64 Packages
libghc-haskelldb-hdbc-postgresql-prof:
  Installed: (none)
  Candidate: 2.1.2-7build1
  Version table:
     2.1.2-7build1 0
        500 http://cz.archive.ubuntu.com/ubuntu/ xenial/universe amd64 Packages
     2.1.2-3build1 0
        500 http://rs.archive.ubuntu.com/ubuntu/ trusty/universe amd64 Packages
postgresql-9.3-pgfincore:
  Installed: (none)
  Candidate: 1.1.2-1
  Version table:
     1.1.2-1 0
        500 http://rs.archive.ubuntu.com/ubuntu/ trusty/universe amd64 Packages
postgresql-9.5-slony1-2:
  Installed: (none)
  Candidate: 2.2.4-3
  Version table:
     2.2.4-3 0
        500 http://cz.archive.ubuntu.com/ubuntu/ xenial/universe amd64 Packages
postgresql-9.3-pgrouting:
  Installed: (none)
  Candidate: 2.2.3-1~trusty1
  Version table:
     2.2.3-1~trusty1 0
        500 http://ppa.launchpad.net/ubuntugis/ppa/ubuntu/ trusty/main amd64 Packages
postgresql-9.3-repmgr-dbg:
  Installed: (none)
  Candidate: (none)
  Version table:
libghc-persistent-postgresql-prof:
  Installed: (none)
  Candidate: 2.2.1.2-1build1
  Version table:
     2.2.1.2-1build1 0
        500 http://cz.archive.ubuntu.com/ubuntu/ xenial/universe amd64 Packages
     1.2.1-1build5 0
        500 http://rs.archive.ubuntu.com/ubuntu/ trusty/universe amd64 Packages
postgresql-9.5-dbg:
  Installed: (none)
  Candidate: 9.5.2-1
  Version table:
     9.5.2-1 0
        500 http://cz.archive.ubuntu.com/ubuntu/ xenial/main amd64 Packages
tarantool-lts-postgresql-module:
  Installed: (none)
  Candidate: 1.5.5-18-g2998d20-1ubuntu1
  Version table:
     1.5.5-18-g2998d20-1ubuntu1 0
        500 http://cz.archive.ubuntu.com/ubuntu/ xenial/universe amd64 Packages
postgresql-comparator:
  Installed: (none)
  Candidate: 2.2.6-2
  Version table:
     2.2.6-2 0
        500 http://cz.archive.ubuntu.com/ubuntu/ xenial/universe amd64 Packages
     2.2.2-1 0
        500 http://rs.archive.ubuntu.com/ubuntu/ trusty/universe amd64 Packages
libpostgresql-ocaml:
  Installed: (none)
  Candidate: 2.0.5-2build1
  Version table:
     2.0.5-2build1 0
        500 http://cz.archive.ubuntu.com/ubuntu/ xenial/universe amd64 Packages
     2.0.5-1 0
        500 http://rs.archive.ubuntu.com/ubuntu/ trusty/universe amd64 Packages
postgresql-9.3-slony1-2:
  Installed: (none)
  Candidate: 2.1.4-1ubuntu1
  Version table:
     2.1.4-1ubuntu1 0
        500 http://rs.archive.ubuntu.com/ubuntu/ trusty/universe amd64 Packages
postgresql-9.0:
  Installed: (none)
  Candidate: (none)
  Version table:
postgresql-9.1:
  Installed: (none)
  Candidate: (none)
  Version table:
postgresql-9.2:
  Installed: (none)
  Candidate: (none)
  Version table:
postgresql-9.3:
  Installed: (none)
  Candidate: 9.3.24-0ubuntu0.14.04
  Version table:
     9.3.24-0ubuntu0.14.04 0
        500 http://rs.archive.ubuntu.com/ubuntu/ trusty-updates/main amd64 Packages
        500 http://security.ubuntu.com/ubuntu/ trusty-security/main amd64 Packages
     9.3.4-1 0
        500 http://rs.archive.ubuntu.com/ubuntu/ trusty/main amd64 Packages
postgresql-9.3-postgis-2.0-scripts:
  Installed: (none)
  Candidate: (none)
  Version table:
postgresql-9.4:
  Installed: (none)
  Candidate: (none)
  Version table:
postgresql-9.5:
  Installed: (none)
  Candidate: 9.5.2-1
  Version table:
     9.5.2-1 0
        500 http://cz.archive.ubuntu.com/ubuntu/ xenial/main amd64 Packages
postgresql-9.5-debversion:
  Installed: (none)
  Candidate: 1.0.8-1
  Version table:
     1.0.8-1 0
        500 http://cz.archive.ubuntu.com/ubuntu/ xenial/universe amd64 Packages
libapq-postgresql-dev:
  Installed: (none)
  Candidate: (none)
  Version table:
libapq-postgresql3.2.0-dbg:
  Installed: (none)
  Candidate: 3.2.0-2
  Version table:
     3.2.0-2 0
        500 http://rs.archive.ubuntu.com/ubuntu/ trusty/universe amd64 Packages
postgresql-plpython-9.3:
  Installed: (none)
  Candidate: 9.3.24-0ubuntu0.14.04
  Version table:
     9.3.24-0ubuntu0.14.04 0
        500 http://rs.archive.ubuntu.com/ubuntu/ trusty-updates/main amd64 Packages
        500 http://security.ubuntu.com/ubuntu/ trusty-security/main amd64 Packages
     9.3.4-1 0
        500 http://rs.archive.ubuntu.com/ubuntu/ trusty/main amd64 Packages
postgresql-plpython-9.5:
  Installed: (none)
  Candidate: 9.5.2-1
  Version table:
     9.5.2-1 0
        500 http://cz.archive.ubuntu.com/ubuntu/ xenial/universe amd64 Packages
postgresql-9.3-postgis:
  Installed: (none)
  Candidate: (none)
  Version table:
postgresql-9.3-orafce:
  Installed: (none)
  Candidate: 3.0.6-1
  Version table:
     3.0.6-1 0
        500 http://rs.archive.ubuntu.com/ubuntu/ trusty/universe amd64 Packages
postgresql-9.5-pllua:
  Installed: (none)
  Candidate: 1:1.0-6
  Version table:
     1:1.0-6 0
        500 http://cz.archive.ubuntu.com/ubuntu/ xenial/universe amd64 Packages
libghc-postgresql-simple-dev-0.3.4.0-e9568:
  Installed: (none)
  Candidate: (none)
  Version table:
libghc-postgresql-libpq-prof:
  Installed: 0.8.2.1-2
  Candidate: 0.9.1.1-3
  Version table:
     0.9.1.1-3 0
        500 http://cz.archive.ubuntu.com/ubuntu/ xenial/universe amd64 Packages
 *** 0.8.2.1-2 0
        500 http://rs.archive.ubuntu.com/ubuntu/ trusty/universe amd64 Packages
        100 /var/lib/dpkg/status
postgresql-plv8:
  Installed: (none)
  Candidate: (none)
  Version table:
libghc-persistent-postgresql-dev:
  Installed: (none)
  Candidate: 2.2.1.2-1build1
  Version table:
     2.2.1.2-1build1 0
        500 http://cz.archive.ubuntu.com/ubuntu/ xenial/universe amd64 Packages
     1.2.1-1build5 0
        500 http://rs.archive.ubuntu.com/ubuntu/ trusty/universe amd64 Packages
libghc-postgresql-simple-prof-0.3.4.0-e9568:
  Installed: (none)
  Candidate: (none)
  Version table:
libghc-hdbc-postgresql-dev-2.3.2.1-90dce:
  Installed: (none)
  Candidate: (none)
  Version table:
postgresql-9.0-repmgr-dbg:
  Installed: (none)
  Candidate: (none)
  Version table:
postgresql-server-dev-9.3:
  Installed: (none)
  Candidate: 9.3.24-0ubuntu0.14.04
  Version table:
     9.3.24-0ubuntu0.14.04 0
        500 http://rs.archive.ubuntu.com/ubuntu/ trusty-updates/main amd64 Packages
        500 http://security.ubuntu.com/ubuntu/ trusty-security/main amd64 Packages
     9.3.4-1 0
        500 http://rs.archive.ubuntu.com/ubuntu/ trusty/main amd64 Packages
postgresql-server-dev-9.5:
  Installed: (none)
  Candidate: 9.5.2-1
  Version table:
     9.5.2-1 0
        500 http://cz.archive.ubuntu.com/ubuntu/ xenial/universe amd64 Packages
Milos
  • 101
  • 1
    I wonder if this is a postgresql issue. It looks like your packages weren't correctly installed before you tried to install postgresql. Can you try to install something harmless (e.g. traceroute) and see if you get the same results? – Jos Aug 18 '19 at 19:54
  • I've just successfully installed traceroute. There were no problems. – Milos Aug 18 '19 at 20:14
  • I tried to install aptitude and got the same error as when I tried to install PostgreSQL, so I guess the issue is with the packages as you suggested. – Milos Aug 18 '19 at 20:43
  • OK try sudo apt install -f. If this complains about things needing configuration, do sudo dpkg --configure -a. – Jos Aug 18 '19 at 20:45
  • sudo apt install -f produces no output, and the same goes for sudo dpkg --configure -a. I tried to install postgresql again after running those commands, but the error remains the same. – Milos Aug 18 '19 at 20:47
  • What is the output of apt-cache policy postgresql*? Please edit your question and add it. – Jos Aug 18 '19 at 20:48
  • I added a part of the output to the question (could not copy all because of the space limitations). – Milos Aug 18 '19 at 20:57
  • It appears that postgresql-9.5 is the most recent version that is available to you. In your apt-get install command, replace postgresql by postgresql-9.5 and try again. I don't believe there is a similar trick for postgresql-contrib, so the final command would be sudo apt-get install postgresql-9.5 postgresql-contrib. – Jos Aug 18 '19 at 21:12
  • I tried it, but it didn't work. – Milos Aug 18 '19 at 21:18

0 Answers0