I'm having difficulty installing Postgres 9.6 on my Raspberry Pi running Debian 8 (Jessie). I've tried two paths:

  1. According to these instructions:

    • Add a pgdg.list file to /etc/apt/sources.list.d containing deb http://apt.postgresql.org/pub/repos/apt/ jessie-pgdg main
    • wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add -
    • sudo apt-get update, here I get an error:

      W: Failed to fetch http://apt.postgresql.org/pub/repos/apt/dists/jessie-pgdg/InRelease
      Unable to find expected entry 'main/binary-armhf/Packages' in Release file (Wrong sources.list entry or malformed file)

      E: Some index files failed to download. They have been ignored, or old ones used instead.

    • The error makes sense because there are no armhf packages in http://apt.postgresql.org/pub/repos/apt/dists/jessie-pgdg/InRelease
    • So running sudo apt-get upgrade and sudo apt-get install postgresql-9.6 results in a package not found error.
  2. This Stack Overflow question:

    • Start by removing the pgdg.list from the previous example.
    • Create a backports.list file in /etc/apt/sources.list.d containing deb http://ftp.debian.org/debian jessie-backports main
    • sudo apt-get update & sudo apt-get upgrade - both succeed w/o errors.
    • sudo apt-get install postgresql-9.6 which gives me this error:

      The following packages have unmet dependencies: postgresql-9.6 : Depends: postgresql-common (>= 171~) but it is not going to be installed Depends: ssl-cert but it is not installable Recommends: postgresql-contrib-9.6 but it is not going to be installed Recommends: sysstat but it is not installable E: Unable to correct problems, you have held broken packages.

It looks like the backports repository is the better one to use, but should I have to manually install Postgres's package deps (postgresql-common,postgresql-contrib-9.6 etc)? Why does the recommended way with the offical PGDG repository tell me it's missing binary-armhf packages? What is the proper repo and method of install for this? Thanks in advance for the help.

migrated from stackoverflow.com May 22 '17 at 19:28

This question came from our site for professional and enthusiast programmers.


I had the same problem. But I resolved it using:

http://ftp.debian.org/debian jessie-backports main

Then I ran:

sudo apt install postgresql-common/jessie-backports
sudo apt install postgresql-client-9.6/jessie-backports
sudo apt install postgresql-9.6/jessie-backports

Since there is no postgresql-9.6 for jessie in armhf backport installation is suggested: This one solved for me:

  1. Runsudo nano /etc/apt/sources.list.d/backports.list, then add

     deb http://ftp.debian.org/debian jessie-backports main
  2. sudo apt-get update

  3. sudo apt-get -t jessie-backports install postgresql-9.6

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy