I wanted to install PostGIS on my server which already have a PostgreSQL installed. I followed this PostGIS installation manual.

I inputted this script:

sudo sh -c 'echo "deb http://apt.postgresql.org/pub/repos/apt trusty-pgdg main" >> /etc/apt/sources.list'
wget --quiet -O - http://apt.postgresql.org/pub/repos/apt/ACCC4CF8.asc | sudo apt-key add -

The console echoed OK. So I proceed to updating the sources list using sudo apt-get update. That is when a warning prompt caught my attention.

W: Duplicate sources.list entry http://apt.postgresql.org/pub/repos/apt/ trusty-pgdg/main amd64 Packages (/var/lib/apt/lists/apt.postgresql.org_pub_repos_apt_dists_trusty-pgdg_main_binary-amd64_Packages)
W: Duplicate sources.list entry http://apt.postgresql.org/pub/repos/apt/ trusty-pgdg/main i386 Packages (/var/lib/apt/lists/apt.postgresql.org_pub_repos_apt_dists_trusty-pgdg_main_binary-i386_Packages)
W: You may want to run apt-get update to correct these problems

I opened /etc/apt/sources.list and check for duplicate deb http://apt.postgresql.org/pub/repos/apt/ trusty-pgdg main but I only see one. How come it tells me there is duplicate?

  • Take a look at the files in the /etc/apt/sources.list.d/ directory. The duplicate may be in there. – Aaron Nov 2 '14 at 12:32

I had the same problem. Rerunning apt-get update, as recommended in the error, simply results in the same error. Checking the contents of /etc/apt/sources.list.d/postgresql.list did show duplicates. Manually editing this file to remove duplicates fixed this error for me.


I solved this problem like this. At first you should find the file which is including text "wily-pgdg"

It may be /etc/apt/sources.list.d/pgdg.list :

deb http://apt.postgresql.org/pub/repos/apt/ wily-pgdg main

deb http://apt.postgresql.org/pub/repos/apt/ wily-pgdg main

It seems like there is the mistake. Making it look like:

deb http://apt.postgresql.org/pub/repos/apt/ wily-pgdg main

deb-src http://apt.postgresql.org/pub/repos/apt/ wily-pgdg main

worked for me. (add the -src).

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.