How can I fix apt error “W: Target Packages … is configured multiple times”?How to fix error W: Target Packages (main/binary-amd64/Packages) is configured multiple times in my sources.list file?how to fix update problem on ubuntu 16.04“the package cache file is corrupted” errorW: Target Packages is configured multiple timesTarget Packages (main/binary-amd64/Packages) is configured multiple times with Ubuntu 16.04Can't update from 17.10 to 18.04 because a repository doesn't have a Release fileTarget is configured multiple times errors when trying to updateupdate problem in Ubuntu 18.04Ubuntu16.04 LTS: failed to download package files. Check your internet connectionHow to Fix W: Target Translations (main/i18n/Translation-en) is configured multiple timesCan't install software from Software CenterApt-get failed to fetch from Ubuntu server with error code 404“Unable to connect” error with apt-get: possible proxy?Why is medibuntu.org still offered as a package source if it has been shutdown since 2010?Getting tons of warnings “skipped acquire” when doing apt updateGetting apt warnings when updating Ubuntu

Why has no one requested the tape of the Trump/Ukraine call?

Why telnet is considered to be a protocol? Isn't it just a simple TCP send/echo program?

Raised concerns about a security vulnerability to various managers, for more than a year, with no results. Should I mention it to external auditors?

Is "montäglich" commonly used?

Is it a mistake to use a password that has previously been used (by anyone ever)?

Days in indexed month

Can the treble clef be used instead of the bass clef in piano music?

Names of all the spacecrafts on the art by Philippe “Manchu" Bouchet

Can I use pavers as a cheap solution to stop rain water erosion?

Sort and Table a Sentence by Word Lengths

Is there a heavy usage of the word "bonfire" in English?

What is the correct way to use a Symfony bundle?

What latex template to use when you do not know the journal you are going to submit

Looking for a reference in Greek

How to break a equation with a single "summation symbol (sum) " common?

Was it possible for a message from Paris to reach London within 48 hours in 1782?

What is the name of this landform?

Why are there so many binary systems?

Why is the core ChaCha primitive not good for use in a CRCF? Why create BLAKE?

What is the "two-drive trick" that can read Amiga disks on a PC?

Casual way to say: ''See you tomorrow at (some time)''

Bash script that shows changing real time values from commands

Are we sinners because we sin or do we sin because we are sinners?

Insets around a clock



How can I fix apt error “W: Target Packages … is configured multiple times”?


How to fix error W: Target Packages (main/binary-amd64/Packages) is configured multiple times in my sources.list file?how to fix update problem on ubuntu 16.04“the package cache file is corrupted” errorW: Target Packages is configured multiple timesTarget Packages (main/binary-amd64/Packages) is configured multiple times with Ubuntu 16.04Can't update from 17.10 to 18.04 because a repository doesn't have a Release fileTarget is configured multiple times errors when trying to updateupdate problem in Ubuntu 18.04Ubuntu16.04 LTS: failed to download package files. Check your internet connectionHow to Fix W: Target Translations (main/i18n/Translation-en) is configured multiple timesCan't install software from Software CenterApt-get failed to fetch from Ubuntu server with error code 404“Unable to connect” error with apt-get: possible proxy?Why is medibuntu.org still offered as a package source if it has been shutdown since 2010?Getting tons of warnings “skipped acquire” when doing apt updateGetting apt warnings when updating Ubuntu






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty
margin-bottom:0;









130


















I just installed Ubuntu Gnome 16.04. I told it to save my documents - which worked. Some software had to be reinstalled. Now when I run sudo apt-get update I see this:



W: Target Packages (main/binary-amd64/Packages) is configured multiple times in /etc/apt/sources.list:33 and /etc/apt/sources.list:87
W: Target Packages (main/binary-i386/Packages) is configured multiple times in /etc/apt/sources.list:33 and /etc/apt/sources.list:87
W: Target Packages (main/binary-all/Packages) is configured multiple times in /etc/apt/sources.list:33 and /etc/apt/sources.list:87
W: Target Translations (main/i18n/Translation-en_GB) is configured multiple times in /etc/apt/sources.list:33 and /etc/apt/sources.list:87
W: Target Translations (main/i18n/Translation-en) is configured multiple times in /etc/apt/sources.list:33 and /etc/apt/sources.list:87
W: Target DEP-11 (main/dep11/Components-amd64.yml) is configured multiple times in /etc/apt/sources.list:33 and /etc/apt/sources.list:87
W: Target DEP-11-icons (main/dep11/icons-64x64.tar) is configured multiple times in /etc/apt/sources.list:33 and /etc/apt/sources.list:87
W: Target Packages (restricted/binary-amd64/Packages) is configured multiple times in /etc/apt/sources.list:33 and /etc/apt/sources.list:87
W: Target Packages (restricted/binary-i386/Packages) is configured multiple times in /etc/apt/sources.list:33 and /etc/apt/sources.list:87
W: Target Packages (restricted/binary-all/Packages) is configured multiple times in /etc/apt/sources.list:33 and /etc/apt/sources.list:87
W: Target Translations (restricted/i18n/Translation-en_GB) is configured multiple times in /etc/apt/sources.list:33 and /etc/apt/sources.list:87
W: Target Translations (restricted/i18n/Translation-en) is configured multiple times in /etc/apt/sources.list:33 and /etc/apt/sources.list:87
W: Target DEP-11 (restricted/dep11/Components-amd64.yml) is configured multiple times in /etc/apt/sources.list:33 and /etc/apt/sources.list:87
W: Target DEP-11-icons (restricted/dep11/icons-64x64.tar) is configured multiple times in /etc/apt/sources.list:33 and /etc/apt/sources.list:87
W: Target Packages (multiverse/binary-amd64/Packages) is configured multiple times in /etc/apt/sources.list:33 and /etc/apt/sources.list:87
W: Target Packages (multiverse/binary-i386/Packages) is configured multiple times in /etc/apt/sources.list:33 and /etc/apt/sources.list:87
W: Target Packages (multiverse/binary-all/Packages) is configured multiple times in /etc/apt/sources.list:33 and /etc/apt/sources.list:87
W: Target Translations (multiverse/i18n/Translation-en_GB) is configured multiple times in /etc/apt/sources.list:33 and /etc/apt/sources.list:87
W: Target Translations (multiverse/i18n/Translation-en) is configured multiple times in /etc/apt/sources.list:33 and /etc/apt/sources.list:87
W: Target DEP-11 (multiverse/dep11/Components-amd64.yml) is configured multiple times in /etc/apt/sources.list:33 and /etc/apt/sources.list:87
W: Target DEP-11-icons (multiverse/dep11/icons-64x64.tar) is configured multiple times in /etc/apt/sources.list:33 and /etc/apt/sources.list:87
W: The repository 'http://extras.ubuntu.com/ubuntu xenial Release' does not have a Release file.
N: Data from such a repository can't be authenticated and is therefore potentially dangerous to use.
N: See apt-secure(8) manpage for repository creation and user configuration details.
W: http://dl.google.com/linux/chrome/deb/dists/stable/Release.gpg: Signature by key 4CCA1EAF950CEE4AB83976DCA040830F7FAC5991 uses weak digest algorithm (SHA1)
W: http://repo.sinew.in/dists/stable/InRelease: Signature by key B6DA722E2E65721AF54B93966F7565879798C2FC uses weak digest algorithm (SHA1)
E: Failed to fetch http://extras.ubuntu.com/ubuntu/dists/xenial/main/source/Sources 404 Not Found [IP: 91.189.92.152 80]
E: Failed to fetch http://extras.ubuntu.com/ubuntu/dists/xenial/main/binary-amd64/Packages 404 Not Found [IP: 91.189.92.152 80]
E: Failed to fetch http://extras.ubuntu.com/ubuntu/dists/xenial/main/binary-i386/Packages 404 Not Found [IP: 91.189.92.152 80]
E: Some index files failed to download. They have been ignored, or old ones used instead.
W: Target Packages (main/binary-amd64/Packages) is configured multiple times in /etc/apt/sources.list:33 and /etc/apt/sources.list:87
W: Target Packages (main/binary-i386/Packages) is configured multiple times in /etc/apt/sources.list:33 and /etc/apt/sources.list:87
W: Target Packages (main/binary-all/Packages) is configured multiple times in /etc/apt/sources.list:33 and /etc/apt/sources.list:87
W: Target Translations (main/i18n/Translation-en_GB) is configured multiple times in /etc/apt/sources.list:33 and /etc/apt/sources.list:87
W: Target Translations (main/i18n/Translation-en) is configured multiple times in /etc/apt/sources.list:33 and /etc/apt/sources.list:87
W: Target DEP-11 (main/dep11/Components-amd64.yml) is configured multiple times in /etc/apt/sources.list:33 and /etc/apt/sources.list:87
W: Target DEP-11-icons (main/dep11/icons-64x64.tar) is configured multiple times in /etc/apt/sources.list:33 and /etc/apt/sources.list:87
W: Target Packages (restricted/binary-amd64/Packages) is configured multiple times in /etc/apt/sources.list:33 and /etc/apt/sources.list:87
W: Target Packages (restricted/binary-i386/Packages) is configured multiple times in /etc/apt/sources.list:33 and /etc/apt/sources.list:87
W: Target Packages (restricted/binary-all/Packages) is configured multiple times in /etc/apt/sources.list:33 and /etc/apt/sources.list:87
W: Target Translations (restricted/i18n/Translation-en_GB) is configured multiple times in /etc/apt/sources.list:33 and /etc/apt/sources.list:87
W: Target Translations (restricted/i18n/Translation-en) is configured multiple times in /etc/apt/sources.list:33 and /etc/apt/sources.list:87
W: Target DEP-11 (restricted/dep11/Components-amd64.yml) is configured multiple times in /etc/apt/sources.list:33 and /etc/apt/sources.list:87
W: Target DEP-11-icons (restricted/dep11/icons-64x64.tar) is configured multiple times in /etc/apt/sources.list:33 and /etc/apt/sources.list:87
W: Target Packages (multiverse/binary-amd64/Packages) is configured multiple times in /etc/apt/sources.list:33 and /etc/apt/sources.list:87
W: Target Packages (multiverse/binary-i386/Packages) is configured multiple times in /etc/apt/sources.list:33 and /etc/apt/sources.list:87
W: Target Packages (multiverse/binary-all/Packages) is configured multiple times in /etc/apt/sources.list:33 and /etc/apt/sources.list:87
W: Target Translations (multiverse/i18n/Translation-en_GB) is configured multiple times in /etc/apt/sources.list:33 and /etc/apt/sources.list:87
W: Target Translations (multiverse/i18n/Translation-en) is configured multiple times in /etc/apt/sources.list:33 and /etc/apt/sources.list:87
W: Target DEP-11 (multiverse/dep11/Components-amd64.yml) is configured multiple times in /etc/apt/sources.list:33 and /etc/apt/sources.list:87
W: Target DEP-11-icons (multiverse/dep11/icons-64x64.tar) is configured multiple times in /etc/apt/sources.list:33 and /etc/apt/sources.list:87


Is there an automated way to fix this?










share|improve this question

































    130


















    I just installed Ubuntu Gnome 16.04. I told it to save my documents - which worked. Some software had to be reinstalled. Now when I run sudo apt-get update I see this:



    W: Target Packages (main/binary-amd64/Packages) is configured multiple times in /etc/apt/sources.list:33 and /etc/apt/sources.list:87
    W: Target Packages (main/binary-i386/Packages) is configured multiple times in /etc/apt/sources.list:33 and /etc/apt/sources.list:87
    W: Target Packages (main/binary-all/Packages) is configured multiple times in /etc/apt/sources.list:33 and /etc/apt/sources.list:87
    W: Target Translations (main/i18n/Translation-en_GB) is configured multiple times in /etc/apt/sources.list:33 and /etc/apt/sources.list:87
    W: Target Translations (main/i18n/Translation-en) is configured multiple times in /etc/apt/sources.list:33 and /etc/apt/sources.list:87
    W: Target DEP-11 (main/dep11/Components-amd64.yml) is configured multiple times in /etc/apt/sources.list:33 and /etc/apt/sources.list:87
    W: Target DEP-11-icons (main/dep11/icons-64x64.tar) is configured multiple times in /etc/apt/sources.list:33 and /etc/apt/sources.list:87
    W: Target Packages (restricted/binary-amd64/Packages) is configured multiple times in /etc/apt/sources.list:33 and /etc/apt/sources.list:87
    W: Target Packages (restricted/binary-i386/Packages) is configured multiple times in /etc/apt/sources.list:33 and /etc/apt/sources.list:87
    W: Target Packages (restricted/binary-all/Packages) is configured multiple times in /etc/apt/sources.list:33 and /etc/apt/sources.list:87
    W: Target Translations (restricted/i18n/Translation-en_GB) is configured multiple times in /etc/apt/sources.list:33 and /etc/apt/sources.list:87
    W: Target Translations (restricted/i18n/Translation-en) is configured multiple times in /etc/apt/sources.list:33 and /etc/apt/sources.list:87
    W: Target DEP-11 (restricted/dep11/Components-amd64.yml) is configured multiple times in /etc/apt/sources.list:33 and /etc/apt/sources.list:87
    W: Target DEP-11-icons (restricted/dep11/icons-64x64.tar) is configured multiple times in /etc/apt/sources.list:33 and /etc/apt/sources.list:87
    W: Target Packages (multiverse/binary-amd64/Packages) is configured multiple times in /etc/apt/sources.list:33 and /etc/apt/sources.list:87
    W: Target Packages (multiverse/binary-i386/Packages) is configured multiple times in /etc/apt/sources.list:33 and /etc/apt/sources.list:87
    W: Target Packages (multiverse/binary-all/Packages) is configured multiple times in /etc/apt/sources.list:33 and /etc/apt/sources.list:87
    W: Target Translations (multiverse/i18n/Translation-en_GB) is configured multiple times in /etc/apt/sources.list:33 and /etc/apt/sources.list:87
    W: Target Translations (multiverse/i18n/Translation-en) is configured multiple times in /etc/apt/sources.list:33 and /etc/apt/sources.list:87
    W: Target DEP-11 (multiverse/dep11/Components-amd64.yml) is configured multiple times in /etc/apt/sources.list:33 and /etc/apt/sources.list:87
    W: Target DEP-11-icons (multiverse/dep11/icons-64x64.tar) is configured multiple times in /etc/apt/sources.list:33 and /etc/apt/sources.list:87
    W: The repository 'http://extras.ubuntu.com/ubuntu xenial Release' does not have a Release file.
    N: Data from such a repository can't be authenticated and is therefore potentially dangerous to use.
    N: See apt-secure(8) manpage for repository creation and user configuration details.
    W: http://dl.google.com/linux/chrome/deb/dists/stable/Release.gpg: Signature by key 4CCA1EAF950CEE4AB83976DCA040830F7FAC5991 uses weak digest algorithm (SHA1)
    W: http://repo.sinew.in/dists/stable/InRelease: Signature by key B6DA722E2E65721AF54B93966F7565879798C2FC uses weak digest algorithm (SHA1)
    E: Failed to fetch http://extras.ubuntu.com/ubuntu/dists/xenial/main/source/Sources 404 Not Found [IP: 91.189.92.152 80]
    E: Failed to fetch http://extras.ubuntu.com/ubuntu/dists/xenial/main/binary-amd64/Packages 404 Not Found [IP: 91.189.92.152 80]
    E: Failed to fetch http://extras.ubuntu.com/ubuntu/dists/xenial/main/binary-i386/Packages 404 Not Found [IP: 91.189.92.152 80]
    E: Some index files failed to download. They have been ignored, or old ones used instead.
    W: Target Packages (main/binary-amd64/Packages) is configured multiple times in /etc/apt/sources.list:33 and /etc/apt/sources.list:87
    W: Target Packages (main/binary-i386/Packages) is configured multiple times in /etc/apt/sources.list:33 and /etc/apt/sources.list:87
    W: Target Packages (main/binary-all/Packages) is configured multiple times in /etc/apt/sources.list:33 and /etc/apt/sources.list:87
    W: Target Translations (main/i18n/Translation-en_GB) is configured multiple times in /etc/apt/sources.list:33 and /etc/apt/sources.list:87
    W: Target Translations (main/i18n/Translation-en) is configured multiple times in /etc/apt/sources.list:33 and /etc/apt/sources.list:87
    W: Target DEP-11 (main/dep11/Components-amd64.yml) is configured multiple times in /etc/apt/sources.list:33 and /etc/apt/sources.list:87
    W: Target DEP-11-icons (main/dep11/icons-64x64.tar) is configured multiple times in /etc/apt/sources.list:33 and /etc/apt/sources.list:87
    W: Target Packages (restricted/binary-amd64/Packages) is configured multiple times in /etc/apt/sources.list:33 and /etc/apt/sources.list:87
    W: Target Packages (restricted/binary-i386/Packages) is configured multiple times in /etc/apt/sources.list:33 and /etc/apt/sources.list:87
    W: Target Packages (restricted/binary-all/Packages) is configured multiple times in /etc/apt/sources.list:33 and /etc/apt/sources.list:87
    W: Target Translations (restricted/i18n/Translation-en_GB) is configured multiple times in /etc/apt/sources.list:33 and /etc/apt/sources.list:87
    W: Target Translations (restricted/i18n/Translation-en) is configured multiple times in /etc/apt/sources.list:33 and /etc/apt/sources.list:87
    W: Target DEP-11 (restricted/dep11/Components-amd64.yml) is configured multiple times in /etc/apt/sources.list:33 and /etc/apt/sources.list:87
    W: Target DEP-11-icons (restricted/dep11/icons-64x64.tar) is configured multiple times in /etc/apt/sources.list:33 and /etc/apt/sources.list:87
    W: Target Packages (multiverse/binary-amd64/Packages) is configured multiple times in /etc/apt/sources.list:33 and /etc/apt/sources.list:87
    W: Target Packages (multiverse/binary-i386/Packages) is configured multiple times in /etc/apt/sources.list:33 and /etc/apt/sources.list:87
    W: Target Packages (multiverse/binary-all/Packages) is configured multiple times in /etc/apt/sources.list:33 and /etc/apt/sources.list:87
    W: Target Translations (multiverse/i18n/Translation-en_GB) is configured multiple times in /etc/apt/sources.list:33 and /etc/apt/sources.list:87
    W: Target Translations (multiverse/i18n/Translation-en) is configured multiple times in /etc/apt/sources.list:33 and /etc/apt/sources.list:87
    W: Target DEP-11 (multiverse/dep11/Components-amd64.yml) is configured multiple times in /etc/apt/sources.list:33 and /etc/apt/sources.list:87
    W: Target DEP-11-icons (multiverse/dep11/icons-64x64.tar) is configured multiple times in /etc/apt/sources.list:33 and /etc/apt/sources.list:87


    Is there an automated way to fix this?










    share|improve this question





























      130













      130









      130


      52






      I just installed Ubuntu Gnome 16.04. I told it to save my documents - which worked. Some software had to be reinstalled. Now when I run sudo apt-get update I see this:



      W: Target Packages (main/binary-amd64/Packages) is configured multiple times in /etc/apt/sources.list:33 and /etc/apt/sources.list:87
      W: Target Packages (main/binary-i386/Packages) is configured multiple times in /etc/apt/sources.list:33 and /etc/apt/sources.list:87
      W: Target Packages (main/binary-all/Packages) is configured multiple times in /etc/apt/sources.list:33 and /etc/apt/sources.list:87
      W: Target Translations (main/i18n/Translation-en_GB) is configured multiple times in /etc/apt/sources.list:33 and /etc/apt/sources.list:87
      W: Target Translations (main/i18n/Translation-en) is configured multiple times in /etc/apt/sources.list:33 and /etc/apt/sources.list:87
      W: Target DEP-11 (main/dep11/Components-amd64.yml) is configured multiple times in /etc/apt/sources.list:33 and /etc/apt/sources.list:87
      W: Target DEP-11-icons (main/dep11/icons-64x64.tar) is configured multiple times in /etc/apt/sources.list:33 and /etc/apt/sources.list:87
      W: Target Packages (restricted/binary-amd64/Packages) is configured multiple times in /etc/apt/sources.list:33 and /etc/apt/sources.list:87
      W: Target Packages (restricted/binary-i386/Packages) is configured multiple times in /etc/apt/sources.list:33 and /etc/apt/sources.list:87
      W: Target Packages (restricted/binary-all/Packages) is configured multiple times in /etc/apt/sources.list:33 and /etc/apt/sources.list:87
      W: Target Translations (restricted/i18n/Translation-en_GB) is configured multiple times in /etc/apt/sources.list:33 and /etc/apt/sources.list:87
      W: Target Translations (restricted/i18n/Translation-en) is configured multiple times in /etc/apt/sources.list:33 and /etc/apt/sources.list:87
      W: Target DEP-11 (restricted/dep11/Components-amd64.yml) is configured multiple times in /etc/apt/sources.list:33 and /etc/apt/sources.list:87
      W: Target DEP-11-icons (restricted/dep11/icons-64x64.tar) is configured multiple times in /etc/apt/sources.list:33 and /etc/apt/sources.list:87
      W: Target Packages (multiverse/binary-amd64/Packages) is configured multiple times in /etc/apt/sources.list:33 and /etc/apt/sources.list:87
      W: Target Packages (multiverse/binary-i386/Packages) is configured multiple times in /etc/apt/sources.list:33 and /etc/apt/sources.list:87
      W: Target Packages (multiverse/binary-all/Packages) is configured multiple times in /etc/apt/sources.list:33 and /etc/apt/sources.list:87
      W: Target Translations (multiverse/i18n/Translation-en_GB) is configured multiple times in /etc/apt/sources.list:33 and /etc/apt/sources.list:87
      W: Target Translations (multiverse/i18n/Translation-en) is configured multiple times in /etc/apt/sources.list:33 and /etc/apt/sources.list:87
      W: Target DEP-11 (multiverse/dep11/Components-amd64.yml) is configured multiple times in /etc/apt/sources.list:33 and /etc/apt/sources.list:87
      W: Target DEP-11-icons (multiverse/dep11/icons-64x64.tar) is configured multiple times in /etc/apt/sources.list:33 and /etc/apt/sources.list:87
      W: The repository 'http://extras.ubuntu.com/ubuntu xenial Release' does not have a Release file.
      N: Data from such a repository can't be authenticated and is therefore potentially dangerous to use.
      N: See apt-secure(8) manpage for repository creation and user configuration details.
      W: http://dl.google.com/linux/chrome/deb/dists/stable/Release.gpg: Signature by key 4CCA1EAF950CEE4AB83976DCA040830F7FAC5991 uses weak digest algorithm (SHA1)
      W: http://repo.sinew.in/dists/stable/InRelease: Signature by key B6DA722E2E65721AF54B93966F7565879798C2FC uses weak digest algorithm (SHA1)
      E: Failed to fetch http://extras.ubuntu.com/ubuntu/dists/xenial/main/source/Sources 404 Not Found [IP: 91.189.92.152 80]
      E: Failed to fetch http://extras.ubuntu.com/ubuntu/dists/xenial/main/binary-amd64/Packages 404 Not Found [IP: 91.189.92.152 80]
      E: Failed to fetch http://extras.ubuntu.com/ubuntu/dists/xenial/main/binary-i386/Packages 404 Not Found [IP: 91.189.92.152 80]
      E: Some index files failed to download. They have been ignored, or old ones used instead.
      W: Target Packages (main/binary-amd64/Packages) is configured multiple times in /etc/apt/sources.list:33 and /etc/apt/sources.list:87
      W: Target Packages (main/binary-i386/Packages) is configured multiple times in /etc/apt/sources.list:33 and /etc/apt/sources.list:87
      W: Target Packages (main/binary-all/Packages) is configured multiple times in /etc/apt/sources.list:33 and /etc/apt/sources.list:87
      W: Target Translations (main/i18n/Translation-en_GB) is configured multiple times in /etc/apt/sources.list:33 and /etc/apt/sources.list:87
      W: Target Translations (main/i18n/Translation-en) is configured multiple times in /etc/apt/sources.list:33 and /etc/apt/sources.list:87
      W: Target DEP-11 (main/dep11/Components-amd64.yml) is configured multiple times in /etc/apt/sources.list:33 and /etc/apt/sources.list:87
      W: Target DEP-11-icons (main/dep11/icons-64x64.tar) is configured multiple times in /etc/apt/sources.list:33 and /etc/apt/sources.list:87
      W: Target Packages (restricted/binary-amd64/Packages) is configured multiple times in /etc/apt/sources.list:33 and /etc/apt/sources.list:87
      W: Target Packages (restricted/binary-i386/Packages) is configured multiple times in /etc/apt/sources.list:33 and /etc/apt/sources.list:87
      W: Target Packages (restricted/binary-all/Packages) is configured multiple times in /etc/apt/sources.list:33 and /etc/apt/sources.list:87
      W: Target Translations (restricted/i18n/Translation-en_GB) is configured multiple times in /etc/apt/sources.list:33 and /etc/apt/sources.list:87
      W: Target Translations (restricted/i18n/Translation-en) is configured multiple times in /etc/apt/sources.list:33 and /etc/apt/sources.list:87
      W: Target DEP-11 (restricted/dep11/Components-amd64.yml) is configured multiple times in /etc/apt/sources.list:33 and /etc/apt/sources.list:87
      W: Target DEP-11-icons (restricted/dep11/icons-64x64.tar) is configured multiple times in /etc/apt/sources.list:33 and /etc/apt/sources.list:87
      W: Target Packages (multiverse/binary-amd64/Packages) is configured multiple times in /etc/apt/sources.list:33 and /etc/apt/sources.list:87
      W: Target Packages (multiverse/binary-i386/Packages) is configured multiple times in /etc/apt/sources.list:33 and /etc/apt/sources.list:87
      W: Target Packages (multiverse/binary-all/Packages) is configured multiple times in /etc/apt/sources.list:33 and /etc/apt/sources.list:87
      W: Target Translations (multiverse/i18n/Translation-en_GB) is configured multiple times in /etc/apt/sources.list:33 and /etc/apt/sources.list:87
      W: Target Translations (multiverse/i18n/Translation-en) is configured multiple times in /etc/apt/sources.list:33 and /etc/apt/sources.list:87
      W: Target DEP-11 (multiverse/dep11/Components-amd64.yml) is configured multiple times in /etc/apt/sources.list:33 and /etc/apt/sources.list:87
      W: Target DEP-11-icons (multiverse/dep11/icons-64x64.tar) is configured multiple times in /etc/apt/sources.list:33 and /etc/apt/sources.list:87


      Is there an automated way to fix this?










      share|improve this question
















      I just installed Ubuntu Gnome 16.04. I told it to save my documents - which worked. Some software had to be reinstalled. Now when I run sudo apt-get update I see this:



      W: Target Packages (main/binary-amd64/Packages) is configured multiple times in /etc/apt/sources.list:33 and /etc/apt/sources.list:87
      W: Target Packages (main/binary-i386/Packages) is configured multiple times in /etc/apt/sources.list:33 and /etc/apt/sources.list:87
      W: Target Packages (main/binary-all/Packages) is configured multiple times in /etc/apt/sources.list:33 and /etc/apt/sources.list:87
      W: Target Translations (main/i18n/Translation-en_GB) is configured multiple times in /etc/apt/sources.list:33 and /etc/apt/sources.list:87
      W: Target Translations (main/i18n/Translation-en) is configured multiple times in /etc/apt/sources.list:33 and /etc/apt/sources.list:87
      W: Target DEP-11 (main/dep11/Components-amd64.yml) is configured multiple times in /etc/apt/sources.list:33 and /etc/apt/sources.list:87
      W: Target DEP-11-icons (main/dep11/icons-64x64.tar) is configured multiple times in /etc/apt/sources.list:33 and /etc/apt/sources.list:87
      W: Target Packages (restricted/binary-amd64/Packages) is configured multiple times in /etc/apt/sources.list:33 and /etc/apt/sources.list:87
      W: Target Packages (restricted/binary-i386/Packages) is configured multiple times in /etc/apt/sources.list:33 and /etc/apt/sources.list:87
      W: Target Packages (restricted/binary-all/Packages) is configured multiple times in /etc/apt/sources.list:33 and /etc/apt/sources.list:87
      W: Target Translations (restricted/i18n/Translation-en_GB) is configured multiple times in /etc/apt/sources.list:33 and /etc/apt/sources.list:87
      W: Target Translations (restricted/i18n/Translation-en) is configured multiple times in /etc/apt/sources.list:33 and /etc/apt/sources.list:87
      W: Target DEP-11 (restricted/dep11/Components-amd64.yml) is configured multiple times in /etc/apt/sources.list:33 and /etc/apt/sources.list:87
      W: Target DEP-11-icons (restricted/dep11/icons-64x64.tar) is configured multiple times in /etc/apt/sources.list:33 and /etc/apt/sources.list:87
      W: Target Packages (multiverse/binary-amd64/Packages) is configured multiple times in /etc/apt/sources.list:33 and /etc/apt/sources.list:87
      W: Target Packages (multiverse/binary-i386/Packages) is configured multiple times in /etc/apt/sources.list:33 and /etc/apt/sources.list:87
      W: Target Packages (multiverse/binary-all/Packages) is configured multiple times in /etc/apt/sources.list:33 and /etc/apt/sources.list:87
      W: Target Translations (multiverse/i18n/Translation-en_GB) is configured multiple times in /etc/apt/sources.list:33 and /etc/apt/sources.list:87
      W: Target Translations (multiverse/i18n/Translation-en) is configured multiple times in /etc/apt/sources.list:33 and /etc/apt/sources.list:87
      W: Target DEP-11 (multiverse/dep11/Components-amd64.yml) is configured multiple times in /etc/apt/sources.list:33 and /etc/apt/sources.list:87
      W: Target DEP-11-icons (multiverse/dep11/icons-64x64.tar) is configured multiple times in /etc/apt/sources.list:33 and /etc/apt/sources.list:87
      W: The repository 'http://extras.ubuntu.com/ubuntu xenial Release' does not have a Release file.
      N: Data from such a repository can't be authenticated and is therefore potentially dangerous to use.
      N: See apt-secure(8) manpage for repository creation and user configuration details.
      W: http://dl.google.com/linux/chrome/deb/dists/stable/Release.gpg: Signature by key 4CCA1EAF950CEE4AB83976DCA040830F7FAC5991 uses weak digest algorithm (SHA1)
      W: http://repo.sinew.in/dists/stable/InRelease: Signature by key B6DA722E2E65721AF54B93966F7565879798C2FC uses weak digest algorithm (SHA1)
      E: Failed to fetch http://extras.ubuntu.com/ubuntu/dists/xenial/main/source/Sources 404 Not Found [IP: 91.189.92.152 80]
      E: Failed to fetch http://extras.ubuntu.com/ubuntu/dists/xenial/main/binary-amd64/Packages 404 Not Found [IP: 91.189.92.152 80]
      E: Failed to fetch http://extras.ubuntu.com/ubuntu/dists/xenial/main/binary-i386/Packages 404 Not Found [IP: 91.189.92.152 80]
      E: Some index files failed to download. They have been ignored, or old ones used instead.
      W: Target Packages (main/binary-amd64/Packages) is configured multiple times in /etc/apt/sources.list:33 and /etc/apt/sources.list:87
      W: Target Packages (main/binary-i386/Packages) is configured multiple times in /etc/apt/sources.list:33 and /etc/apt/sources.list:87
      W: Target Packages (main/binary-all/Packages) is configured multiple times in /etc/apt/sources.list:33 and /etc/apt/sources.list:87
      W: Target Translations (main/i18n/Translation-en_GB) is configured multiple times in /etc/apt/sources.list:33 and /etc/apt/sources.list:87
      W: Target Translations (main/i18n/Translation-en) is configured multiple times in /etc/apt/sources.list:33 and /etc/apt/sources.list:87
      W: Target DEP-11 (main/dep11/Components-amd64.yml) is configured multiple times in /etc/apt/sources.list:33 and /etc/apt/sources.list:87
      W: Target DEP-11-icons (main/dep11/icons-64x64.tar) is configured multiple times in /etc/apt/sources.list:33 and /etc/apt/sources.list:87
      W: Target Packages (restricted/binary-amd64/Packages) is configured multiple times in /etc/apt/sources.list:33 and /etc/apt/sources.list:87
      W: Target Packages (restricted/binary-i386/Packages) is configured multiple times in /etc/apt/sources.list:33 and /etc/apt/sources.list:87
      W: Target Packages (restricted/binary-all/Packages) is configured multiple times in /etc/apt/sources.list:33 and /etc/apt/sources.list:87
      W: Target Translations (restricted/i18n/Translation-en_GB) is configured multiple times in /etc/apt/sources.list:33 and /etc/apt/sources.list:87
      W: Target Translations (restricted/i18n/Translation-en) is configured multiple times in /etc/apt/sources.list:33 and /etc/apt/sources.list:87
      W: Target DEP-11 (restricted/dep11/Components-amd64.yml) is configured multiple times in /etc/apt/sources.list:33 and /etc/apt/sources.list:87
      W: Target DEP-11-icons (restricted/dep11/icons-64x64.tar) is configured multiple times in /etc/apt/sources.list:33 and /etc/apt/sources.list:87
      W: Target Packages (multiverse/binary-amd64/Packages) is configured multiple times in /etc/apt/sources.list:33 and /etc/apt/sources.list:87
      W: Target Packages (multiverse/binary-i386/Packages) is configured multiple times in /etc/apt/sources.list:33 and /etc/apt/sources.list:87
      W: Target Packages (multiverse/binary-all/Packages) is configured multiple times in /etc/apt/sources.list:33 and /etc/apt/sources.list:87
      W: Target Translations (multiverse/i18n/Translation-en_GB) is configured multiple times in /etc/apt/sources.list:33 and /etc/apt/sources.list:87
      W: Target Translations (multiverse/i18n/Translation-en) is configured multiple times in /etc/apt/sources.list:33 and /etc/apt/sources.list:87
      W: Target DEP-11 (multiverse/dep11/Components-amd64.yml) is configured multiple times in /etc/apt/sources.list:33 and /etc/apt/sources.list:87
      W: Target DEP-11-icons (multiverse/dep11/icons-64x64.tar) is configured multiple times in /etc/apt/sources.list:33 and /etc/apt/sources.list:87


      Is there an automated way to fix this?







      apt






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Jan 29 '18 at 5:04









      muru

      1




      1










      asked Apr 22 '16 at 22:20









      TimTim

      25k17 gold badges92 silver badges148 bronze badges




      25k17 gold badges92 silver badges148 bronze badges























          5 Answers
          5






          active

          oldest

          votes


















          164



















          Recent, up-to-date solution



          I wrote a Python script to automate this task. You can find the most recent version here.



          Installation:




          1. Install the prerequisites:



            sudo apt install python3-apt


          2. Download the ZIP bundle (aptsources-cleanup.zip) from the latest release.


          Usage:




          1. From the download location of the ZIP bundle (see step 2 above) run:



            sudo python3 -OEs aptsources-cleanup.zip


          2. Follow the instructions appearing on the screen.


          If you wish to report an issue, leave a comment, or fork the source code, please do so on GitHub.




          Historical, outdated solution



          This is an older, shorter and simpler version more suitable to inline quotation:



          #!/usr/bin/env python3
          """
          Detects and interactively deactivates duplicate Apt source entries.

          Usage: sudo python3 apt-remove-duplicate-source-entries.py
          """

          from __future__ import print_function
          import aptsources.sourceslist

          EMPTY_COMPONENT_LIST = (None,)

          def get_duplicates(sourceslist):
          """
          Detects and returns duplicate Apt source entries.
          """

          sentry_map = dict()
          duplicates = list()
          for se in sourceslist.list:
          if not se.invalid and not se.disabled:
          for c in (se.comps or EMPTY_COMPONENT_LIST):
          key = (se.type, se.uri, se.dist, c)
          previous_se = sentry_map.setdefault(key, se)
          if previous_se is not se:
          duplicates.append((se, previous_se))
          break

          return duplicates


          if __name__ == '__main__':
          try:
          input = raw_input
          except NameError:
          pass

          sourceslist = aptsources.sourceslist.SourcesList(False)
          duplicates = get_duplicates(sourceslist)

          if duplicates:
          for dupe, orig in duplicates:
          print(
          'Overlapping source entries:n'
          ' 1. 0: 1n'
          ' 2. 2: 3n'
          'I disabled the latter entry.'.format(
          orig.file, orig, dupe.file, dupe),
          end='nn')
          dupe.disabled = True

          print('n0 source entries were disabled:'.format(len(duplicates)),
          *[dupe for dupe, orig in duplicates], sep='n ', end='nn')
          if input('Do you want to save these changes? (y/N) ').upper() == 'Y':
          sourceslist.save()

          else:
          print('No duplicated entries were found.')


          It takes no parameter and works on all /etc/apt/sources.list* with the help of the python3-apt package. Lines don't have to be exact duplicates (even after normalization) but its enough if type, URI, suite and at least one component overlap.



          I'm not sure the equality test is correct in all corner cases (e. g. various “option” strings).






          share|improve this answer




























          • From terminal you can download it by command wget "github.com/davidfoerster/aptsources-cleanup/releases/download/…"

            – Sami
            Jan 22 at 8:56











          • @Sami: At the moment yes, but it won’t point to the latest release any more when I make another release.

            – David Foerster
            Jan 22 at 13:34











          • ubuntu 18.04 user: works like a charm. thanks man.

            – Ali
            Jun 9 at 11:11











          • osboxes@osboxes:/etc/apt/sources.list.d$ sudo python3 -OEs aptsources-cleanup.zip python3: can't open file 'aptsources-cleanup.zip': [Errno 2] No such file or directory

            – Toolkit
            Jul 30 at 4:33











          • @Toolkit: I revised the usage instructions. Please read them and try again. Sorry for the lack of clarity.

            – David Foerster
            Jul 30 at 23:55


















          82



















          For me (16.04 LTS) going to



          System settings >> Software and Updates >> Other Software and removing each duplicate entry from the list worked fine.






          share|improve this answer























          • 6





            I was requesting an automated method.

            – Tim
            Nov 6 '16 at 10:58






          • 17





            this is a better solution than read foreign python3 script before executing it... worked perfectly

            – Max
            Aug 28 '17 at 12:06






          • 2





            Can you delete "duplicates" which have a different type? For example I have http://ppa.launchpad.net/ubuntu-toolchain-r/test/ubuntu xenial main and http://ppa.launchpad.net/ubuntu-toolchain-r/test/ubuntu xenial main (source code). Is it save to remove the (source code) one (this one isn't checked either, as opposed to the other one)?

            – Deruijter
            Mar 1 '18 at 10:02






          • 1





            @Tim true but that's probably not why most people come to this question

            – Joel Berkeley
            Jan 23 at 10:19







          • 2





            @Deruijter The one that says "source code" is not considered a duplicate of the other one. However, you don't need the one that says "source code" unless you would like to download the source code for some packages to compile them on your own.

            – mchid
            Jul 4 at 8:27



















          31



















          Reset your repositories like this



          1. sudo rm /etc/apt/sources.list

          2. sudo software-properties-gtk

          3. Pick your options

          4. Save

          (P.S. I had the same problem today after updating Ubuntu 15.10 to Ubuntu 16.04.)






          share|improve this answer




























          • Beware that you only should do this after you check & make sure that you actually have software-properties-gtk installed on your system. Don't ask me what made me to write this.

            – Miloš Đakonović
            Aug 15 at 8:15


















          5



















          Since the errors tell you where the problem is, and that all the problems are due to a single duplicated line, you can easily fix this manually with a text editor like vim, nano, etc. One benefit of this is that you can see exactly what the problem is and what you're doing to fix it.



          In your case, with sudo or as root, open /etc/apt/sources.list in a text editor. Delete either line 33 or line 87. You can visually check that they're duplicates first.



          If you like vim...



          $ sudo vim /etc/apt/sources.list
          33 [Shift]+g # to goto line 33
          87 [Shift]+g # to goto line 87, don't need a duplicate of line 33
          dd # to delete the line you're on
          :wq # to write the file and quit


          Or, to get out if you make a mistake...



          :q! # to quit without saving any changes





          share|improve this answer

































            4



















            For Ubuntu-based systems with Linux mint, go to Software Sources > Maintenance > Remove Duplicate packages






            share|improve this answer


























            • doing that I get no duplicate found, but still see the same error

              – cipricus
              Aug 27 at 12:31










            protected by Thomas Ward Dec 1 '16 at 23:31



            Thank you for your interest in this question.
            Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count).



            Would you like to answer one of these unanswered questions instead?














            5 Answers
            5






            active

            oldest

            votes








            5 Answers
            5






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes









            164



















            Recent, up-to-date solution



            I wrote a Python script to automate this task. You can find the most recent version here.



            Installation:




            1. Install the prerequisites:



              sudo apt install python3-apt


            2. Download the ZIP bundle (aptsources-cleanup.zip) from the latest release.


            Usage:




            1. From the download location of the ZIP bundle (see step 2 above) run:



              sudo python3 -OEs aptsources-cleanup.zip


            2. Follow the instructions appearing on the screen.


            If you wish to report an issue, leave a comment, or fork the source code, please do so on GitHub.




            Historical, outdated solution



            This is an older, shorter and simpler version more suitable to inline quotation:



            #!/usr/bin/env python3
            """
            Detects and interactively deactivates duplicate Apt source entries.

            Usage: sudo python3 apt-remove-duplicate-source-entries.py
            """

            from __future__ import print_function
            import aptsources.sourceslist

            EMPTY_COMPONENT_LIST = (None,)

            def get_duplicates(sourceslist):
            """
            Detects and returns duplicate Apt source entries.
            """

            sentry_map = dict()
            duplicates = list()
            for se in sourceslist.list:
            if not se.invalid and not se.disabled:
            for c in (se.comps or EMPTY_COMPONENT_LIST):
            key = (se.type, se.uri, se.dist, c)
            previous_se = sentry_map.setdefault(key, se)
            if previous_se is not se:
            duplicates.append((se, previous_se))
            break

            return duplicates


            if __name__ == '__main__':
            try:
            input = raw_input
            except NameError:
            pass

            sourceslist = aptsources.sourceslist.SourcesList(False)
            duplicates = get_duplicates(sourceslist)

            if duplicates:
            for dupe, orig in duplicates:
            print(
            'Overlapping source entries:n'
            ' 1. 0: 1n'
            ' 2. 2: 3n'
            'I disabled the latter entry.'.format(
            orig.file, orig, dupe.file, dupe),
            end='nn')
            dupe.disabled = True

            print('n0 source entries were disabled:'.format(len(duplicates)),
            *[dupe for dupe, orig in duplicates], sep='n ', end='nn')
            if input('Do you want to save these changes? (y/N) ').upper() == 'Y':
            sourceslist.save()

            else:
            print('No duplicated entries were found.')


            It takes no parameter and works on all /etc/apt/sources.list* with the help of the python3-apt package. Lines don't have to be exact duplicates (even after normalization) but its enough if type, URI, suite and at least one component overlap.



            I'm not sure the equality test is correct in all corner cases (e. g. various “option” strings).






            share|improve this answer




























            • From terminal you can download it by command wget "github.com/davidfoerster/aptsources-cleanup/releases/download/…"

              – Sami
              Jan 22 at 8:56











            • @Sami: At the moment yes, but it won’t point to the latest release any more when I make another release.

              – David Foerster
              Jan 22 at 13:34











            • ubuntu 18.04 user: works like a charm. thanks man.

              – Ali
              Jun 9 at 11:11











            • osboxes@osboxes:/etc/apt/sources.list.d$ sudo python3 -OEs aptsources-cleanup.zip python3: can't open file 'aptsources-cleanup.zip': [Errno 2] No such file or directory

              – Toolkit
              Jul 30 at 4:33











            • @Toolkit: I revised the usage instructions. Please read them and try again. Sorry for the lack of clarity.

              – David Foerster
              Jul 30 at 23:55















            164



















            Recent, up-to-date solution



            I wrote a Python script to automate this task. You can find the most recent version here.



            Installation:




            1. Install the prerequisites:



              sudo apt install python3-apt


            2. Download the ZIP bundle (aptsources-cleanup.zip) from the latest release.


            Usage:




            1. From the download location of the ZIP bundle (see step 2 above) run:



              sudo python3 -OEs aptsources-cleanup.zip


            2. Follow the instructions appearing on the screen.


            If you wish to report an issue, leave a comment, or fork the source code, please do so on GitHub.




            Historical, outdated solution



            This is an older, shorter and simpler version more suitable to inline quotation:



            #!/usr/bin/env python3
            """
            Detects and interactively deactivates duplicate Apt source entries.

            Usage: sudo python3 apt-remove-duplicate-source-entries.py
            """

            from __future__ import print_function
            import aptsources.sourceslist

            EMPTY_COMPONENT_LIST = (None,)

            def get_duplicates(sourceslist):
            """
            Detects and returns duplicate Apt source entries.
            """

            sentry_map = dict()
            duplicates = list()
            for se in sourceslist.list:
            if not se.invalid and not se.disabled:
            for c in (se.comps or EMPTY_COMPONENT_LIST):
            key = (se.type, se.uri, se.dist, c)
            previous_se = sentry_map.setdefault(key, se)
            if previous_se is not se:
            duplicates.append((se, previous_se))
            break

            return duplicates


            if __name__ == '__main__':
            try:
            input = raw_input
            except NameError:
            pass

            sourceslist = aptsources.sourceslist.SourcesList(False)
            duplicates = get_duplicates(sourceslist)

            if duplicates:
            for dupe, orig in duplicates:
            print(
            'Overlapping source entries:n'
            ' 1. 0: 1n'
            ' 2. 2: 3n'
            'I disabled the latter entry.'.format(
            orig.file, orig, dupe.file, dupe),
            end='nn')
            dupe.disabled = True

            print('n0 source entries were disabled:'.format(len(duplicates)),
            *[dupe for dupe, orig in duplicates], sep='n ', end='nn')
            if input('Do you want to save these changes? (y/N) ').upper() == 'Y':
            sourceslist.save()

            else:
            print('No duplicated entries were found.')


            It takes no parameter and works on all /etc/apt/sources.list* with the help of the python3-apt package. Lines don't have to be exact duplicates (even after normalization) but its enough if type, URI, suite and at least one component overlap.



            I'm not sure the equality test is correct in all corner cases (e. g. various “option” strings).






            share|improve this answer




























            • From terminal you can download it by command wget "github.com/davidfoerster/aptsources-cleanup/releases/download/…"

              – Sami
              Jan 22 at 8:56











            • @Sami: At the moment yes, but it won’t point to the latest release any more when I make another release.

              – David Foerster
              Jan 22 at 13:34











            • ubuntu 18.04 user: works like a charm. thanks man.

              – Ali
              Jun 9 at 11:11











            • osboxes@osboxes:/etc/apt/sources.list.d$ sudo python3 -OEs aptsources-cleanup.zip python3: can't open file 'aptsources-cleanup.zip': [Errno 2] No such file or directory

              – Toolkit
              Jul 30 at 4:33











            • @Toolkit: I revised the usage instructions. Please read them and try again. Sorry for the lack of clarity.

              – David Foerster
              Jul 30 at 23:55













            164















            164











            164









            Recent, up-to-date solution



            I wrote a Python script to automate this task. You can find the most recent version here.



            Installation:




            1. Install the prerequisites:



              sudo apt install python3-apt


            2. Download the ZIP bundle (aptsources-cleanup.zip) from the latest release.


            Usage:




            1. From the download location of the ZIP bundle (see step 2 above) run:



              sudo python3 -OEs aptsources-cleanup.zip


            2. Follow the instructions appearing on the screen.


            If you wish to report an issue, leave a comment, or fork the source code, please do so on GitHub.




            Historical, outdated solution



            This is an older, shorter and simpler version more suitable to inline quotation:



            #!/usr/bin/env python3
            """
            Detects and interactively deactivates duplicate Apt source entries.

            Usage: sudo python3 apt-remove-duplicate-source-entries.py
            """

            from __future__ import print_function
            import aptsources.sourceslist

            EMPTY_COMPONENT_LIST = (None,)

            def get_duplicates(sourceslist):
            """
            Detects and returns duplicate Apt source entries.
            """

            sentry_map = dict()
            duplicates = list()
            for se in sourceslist.list:
            if not se.invalid and not se.disabled:
            for c in (se.comps or EMPTY_COMPONENT_LIST):
            key = (se.type, se.uri, se.dist, c)
            previous_se = sentry_map.setdefault(key, se)
            if previous_se is not se:
            duplicates.append((se, previous_se))
            break

            return duplicates


            if __name__ == '__main__':
            try:
            input = raw_input
            except NameError:
            pass

            sourceslist = aptsources.sourceslist.SourcesList(False)
            duplicates = get_duplicates(sourceslist)

            if duplicates:
            for dupe, orig in duplicates:
            print(
            'Overlapping source entries:n'
            ' 1. 0: 1n'
            ' 2. 2: 3n'
            'I disabled the latter entry.'.format(
            orig.file, orig, dupe.file, dupe),
            end='nn')
            dupe.disabled = True

            print('n0 source entries were disabled:'.format(len(duplicates)),
            *[dupe for dupe, orig in duplicates], sep='n ', end='nn')
            if input('Do you want to save these changes? (y/N) ').upper() == 'Y':
            sourceslist.save()

            else:
            print('No duplicated entries were found.')


            It takes no parameter and works on all /etc/apt/sources.list* with the help of the python3-apt package. Lines don't have to be exact duplicates (even after normalization) but its enough if type, URI, suite and at least one component overlap.



            I'm not sure the equality test is correct in all corner cases (e. g. various “option” strings).






            share|improve this answer
















            Recent, up-to-date solution



            I wrote a Python script to automate this task. You can find the most recent version here.



            Installation:




            1. Install the prerequisites:



              sudo apt install python3-apt


            2. Download the ZIP bundle (aptsources-cleanup.zip) from the latest release.


            Usage:




            1. From the download location of the ZIP bundle (see step 2 above) run:



              sudo python3 -OEs aptsources-cleanup.zip


            2. Follow the instructions appearing on the screen.


            If you wish to report an issue, leave a comment, or fork the source code, please do so on GitHub.




            Historical, outdated solution



            This is an older, shorter and simpler version more suitable to inline quotation:



            #!/usr/bin/env python3
            """
            Detects and interactively deactivates duplicate Apt source entries.

            Usage: sudo python3 apt-remove-duplicate-source-entries.py
            """

            from __future__ import print_function
            import aptsources.sourceslist

            EMPTY_COMPONENT_LIST = (None,)

            def get_duplicates(sourceslist):
            """
            Detects and returns duplicate Apt source entries.
            """

            sentry_map = dict()
            duplicates = list()
            for se in sourceslist.list:
            if not se.invalid and not se.disabled:
            for c in (se.comps or EMPTY_COMPONENT_LIST):
            key = (se.type, se.uri, se.dist, c)
            previous_se = sentry_map.setdefault(key, se)
            if previous_se is not se:
            duplicates.append((se, previous_se))
            break

            return duplicates


            if __name__ == '__main__':
            try:
            input = raw_input
            except NameError:
            pass

            sourceslist = aptsources.sourceslist.SourcesList(False)
            duplicates = get_duplicates(sourceslist)

            if duplicates:
            for dupe, orig in duplicates:
            print(
            'Overlapping source entries:n'
            ' 1. 0: 1n'
            ' 2. 2: 3n'
            'I disabled the latter entry.'.format(
            orig.file, orig, dupe.file, dupe),
            end='nn')
            dupe.disabled = True

            print('n0 source entries were disabled:'.format(len(duplicates)),
            *[dupe for dupe, orig in duplicates], sep='n ', end='nn')
            if input('Do you want to save these changes? (y/N) ').upper() == 'Y':
            sourceslist.save()

            else:
            print('No duplicated entries were found.')


            It takes no parameter and works on all /etc/apt/sources.list* with the help of the python3-apt package. Lines don't have to be exact duplicates (even after normalization) but its enough if type, URI, suite and at least one component overlap.



            I'm not sure the equality test is correct in all corner cases (e. g. various “option” strings).







            share|improve this answer















            share|improve this answer




            share|improve this answer








            edited Oct 15 at 6:48

























            answered Apr 26 '16 at 0:35









            David FoersterDavid Foerster

            29.8k13 gold badges70 silver badges117 bronze badges




            29.8k13 gold badges70 silver badges117 bronze badges















            • From terminal you can download it by command wget "github.com/davidfoerster/aptsources-cleanup/releases/download/…"

              – Sami
              Jan 22 at 8:56











            • @Sami: At the moment yes, but it won’t point to the latest release any more when I make another release.

              – David Foerster
              Jan 22 at 13:34











            • ubuntu 18.04 user: works like a charm. thanks man.

              – Ali
              Jun 9 at 11:11











            • osboxes@osboxes:/etc/apt/sources.list.d$ sudo python3 -OEs aptsources-cleanup.zip python3: can't open file 'aptsources-cleanup.zip': [Errno 2] No such file or directory

              – Toolkit
              Jul 30 at 4:33











            • @Toolkit: I revised the usage instructions. Please read them and try again. Sorry for the lack of clarity.

              – David Foerster
              Jul 30 at 23:55

















            • From terminal you can download it by command wget "github.com/davidfoerster/aptsources-cleanup/releases/download/…"

              – Sami
              Jan 22 at 8:56











            • @Sami: At the moment yes, but it won’t point to the latest release any more when I make another release.

              – David Foerster
              Jan 22 at 13:34











            • ubuntu 18.04 user: works like a charm. thanks man.

              – Ali
              Jun 9 at 11:11











            • osboxes@osboxes:/etc/apt/sources.list.d$ sudo python3 -OEs aptsources-cleanup.zip python3: can't open file 'aptsources-cleanup.zip': [Errno 2] No such file or directory

              – Toolkit
              Jul 30 at 4:33











            • @Toolkit: I revised the usage instructions. Please read them and try again. Sorry for the lack of clarity.

              – David Foerster
              Jul 30 at 23:55
















            From terminal you can download it by command wget "github.com/davidfoerster/aptsources-cleanup/releases/download/…"

            – Sami
            Jan 22 at 8:56





            From terminal you can download it by command wget "github.com/davidfoerster/aptsources-cleanup/releases/download/…"

            – Sami
            Jan 22 at 8:56













            @Sami: At the moment yes, but it won’t point to the latest release any more when I make another release.

            – David Foerster
            Jan 22 at 13:34





            @Sami: At the moment yes, but it won’t point to the latest release any more when I make another release.

            – David Foerster
            Jan 22 at 13:34













            ubuntu 18.04 user: works like a charm. thanks man.

            – Ali
            Jun 9 at 11:11





            ubuntu 18.04 user: works like a charm. thanks man.

            – Ali
            Jun 9 at 11:11













            osboxes@osboxes:/etc/apt/sources.list.d$ sudo python3 -OEs aptsources-cleanup.zip python3: can't open file 'aptsources-cleanup.zip': [Errno 2] No such file or directory

            – Toolkit
            Jul 30 at 4:33





            osboxes@osboxes:/etc/apt/sources.list.d$ sudo python3 -OEs aptsources-cleanup.zip python3: can't open file 'aptsources-cleanup.zip': [Errno 2] No such file or directory

            – Toolkit
            Jul 30 at 4:33













            @Toolkit: I revised the usage instructions. Please read them and try again. Sorry for the lack of clarity.

            – David Foerster
            Jul 30 at 23:55





            @Toolkit: I revised the usage instructions. Please read them and try again. Sorry for the lack of clarity.

            – David Foerster
            Jul 30 at 23:55













            82



















            For me (16.04 LTS) going to



            System settings >> Software and Updates >> Other Software and removing each duplicate entry from the list worked fine.






            share|improve this answer























            • 6





              I was requesting an automated method.

              – Tim
              Nov 6 '16 at 10:58






            • 17





              this is a better solution than read foreign python3 script before executing it... worked perfectly

              – Max
              Aug 28 '17 at 12:06






            • 2





              Can you delete "duplicates" which have a different type? For example I have http://ppa.launchpad.net/ubuntu-toolchain-r/test/ubuntu xenial main and http://ppa.launchpad.net/ubuntu-toolchain-r/test/ubuntu xenial main (source code). Is it save to remove the (source code) one (this one isn't checked either, as opposed to the other one)?

              – Deruijter
              Mar 1 '18 at 10:02






            • 1





              @Tim true but that's probably not why most people come to this question

              – Joel Berkeley
              Jan 23 at 10:19







            • 2





              @Deruijter The one that says "source code" is not considered a duplicate of the other one. However, you don't need the one that says "source code" unless you would like to download the source code for some packages to compile them on your own.

              – mchid
              Jul 4 at 8:27
















            82



















            For me (16.04 LTS) going to



            System settings >> Software and Updates >> Other Software and removing each duplicate entry from the list worked fine.






            share|improve this answer























            • 6





              I was requesting an automated method.

              – Tim
              Nov 6 '16 at 10:58






            • 17





              this is a better solution than read foreign python3 script before executing it... worked perfectly

              – Max
              Aug 28 '17 at 12:06






            • 2





              Can you delete "duplicates" which have a different type? For example I have http://ppa.launchpad.net/ubuntu-toolchain-r/test/ubuntu xenial main and http://ppa.launchpad.net/ubuntu-toolchain-r/test/ubuntu xenial main (source code). Is it save to remove the (source code) one (this one isn't checked either, as opposed to the other one)?

              – Deruijter
              Mar 1 '18 at 10:02






            • 1





              @Tim true but that's probably not why most people come to this question

              – Joel Berkeley
              Jan 23 at 10:19







            • 2





              @Deruijter The one that says "source code" is not considered a duplicate of the other one. However, you don't need the one that says "source code" unless you would like to download the source code for some packages to compile them on your own.

              – mchid
              Jul 4 at 8:27














            82















            82











            82









            For me (16.04 LTS) going to



            System settings >> Software and Updates >> Other Software and removing each duplicate entry from the list worked fine.






            share|improve this answer
















            For me (16.04 LTS) going to



            System settings >> Software and Updates >> Other Software and removing each duplicate entry from the list worked fine.







            share|improve this answer















            share|improve this answer




            share|improve this answer








            edited Nov 24 '17 at 18:42









            Tim

            25k17 gold badges92 silver badges148 bronze badges




            25k17 gold badges92 silver badges148 bronze badges










            answered Nov 6 '16 at 10:50









            learnerlearner

            9577 silver badges13 bronze badges




            9577 silver badges13 bronze badges










            • 6





              I was requesting an automated method.

              – Tim
              Nov 6 '16 at 10:58






            • 17





              this is a better solution than read foreign python3 script before executing it... worked perfectly

              – Max
              Aug 28 '17 at 12:06






            • 2





              Can you delete "duplicates" which have a different type? For example I have http://ppa.launchpad.net/ubuntu-toolchain-r/test/ubuntu xenial main and http://ppa.launchpad.net/ubuntu-toolchain-r/test/ubuntu xenial main (source code). Is it save to remove the (source code) one (this one isn't checked either, as opposed to the other one)?

              – Deruijter
              Mar 1 '18 at 10:02






            • 1





              @Tim true but that's probably not why most people come to this question

              – Joel Berkeley
              Jan 23 at 10:19







            • 2





              @Deruijter The one that says "source code" is not considered a duplicate of the other one. However, you don't need the one that says "source code" unless you would like to download the source code for some packages to compile them on your own.

              – mchid
              Jul 4 at 8:27













            • 6





              I was requesting an automated method.

              – Tim
              Nov 6 '16 at 10:58






            • 17





              this is a better solution than read foreign python3 script before executing it... worked perfectly

              – Max
              Aug 28 '17 at 12:06






            • 2





              Can you delete "duplicates" which have a different type? For example I have http://ppa.launchpad.net/ubuntu-toolchain-r/test/ubuntu xenial main and http://ppa.launchpad.net/ubuntu-toolchain-r/test/ubuntu xenial main (source code). Is it save to remove the (source code) one (this one isn't checked either, as opposed to the other one)?

              – Deruijter
              Mar 1 '18 at 10:02






            • 1





              @Tim true but that's probably not why most people come to this question

              – Joel Berkeley
              Jan 23 at 10:19







            • 2





              @Deruijter The one that says "source code" is not considered a duplicate of the other one. However, you don't need the one that says "source code" unless you would like to download the source code for some packages to compile them on your own.

              – mchid
              Jul 4 at 8:27








            6




            6





            I was requesting an automated method.

            – Tim
            Nov 6 '16 at 10:58





            I was requesting an automated method.

            – Tim
            Nov 6 '16 at 10:58




            17




            17





            this is a better solution than read foreign python3 script before executing it... worked perfectly

            – Max
            Aug 28 '17 at 12:06





            this is a better solution than read foreign python3 script before executing it... worked perfectly

            – Max
            Aug 28 '17 at 12:06




            2




            2





            Can you delete "duplicates" which have a different type? For example I have http://ppa.launchpad.net/ubuntu-toolchain-r/test/ubuntu xenial main and http://ppa.launchpad.net/ubuntu-toolchain-r/test/ubuntu xenial main (source code). Is it save to remove the (source code) one (this one isn't checked either, as opposed to the other one)?

            – Deruijter
            Mar 1 '18 at 10:02





            Can you delete "duplicates" which have a different type? For example I have http://ppa.launchpad.net/ubuntu-toolchain-r/test/ubuntu xenial main and http://ppa.launchpad.net/ubuntu-toolchain-r/test/ubuntu xenial main (source code). Is it save to remove the (source code) one (this one isn't checked either, as opposed to the other one)?

            – Deruijter
            Mar 1 '18 at 10:02




            1




            1





            @Tim true but that's probably not why most people come to this question

            – Joel Berkeley
            Jan 23 at 10:19






            @Tim true but that's probably not why most people come to this question

            – Joel Berkeley
            Jan 23 at 10:19





            2




            2





            @Deruijter The one that says "source code" is not considered a duplicate of the other one. However, you don't need the one that says "source code" unless you would like to download the source code for some packages to compile them on your own.

            – mchid
            Jul 4 at 8:27






            @Deruijter The one that says "source code" is not considered a duplicate of the other one. However, you don't need the one that says "source code" unless you would like to download the source code for some packages to compile them on your own.

            – mchid
            Jul 4 at 8:27












            31



















            Reset your repositories like this



            1. sudo rm /etc/apt/sources.list

            2. sudo software-properties-gtk

            3. Pick your options

            4. Save

            (P.S. I had the same problem today after updating Ubuntu 15.10 to Ubuntu 16.04.)






            share|improve this answer




























            • Beware that you only should do this after you check & make sure that you actually have software-properties-gtk installed on your system. Don't ask me what made me to write this.

              – Miloš Đakonović
              Aug 15 at 8:15















            31



















            Reset your repositories like this



            1. sudo rm /etc/apt/sources.list

            2. sudo software-properties-gtk

            3. Pick your options

            4. Save

            (P.S. I had the same problem today after updating Ubuntu 15.10 to Ubuntu 16.04.)






            share|improve this answer




























            • Beware that you only should do this after you check & make sure that you actually have software-properties-gtk installed on your system. Don't ask me what made me to write this.

              – Miloš Đakonović
              Aug 15 at 8:15













            31















            31











            31









            Reset your repositories like this



            1. sudo rm /etc/apt/sources.list

            2. sudo software-properties-gtk

            3. Pick your options

            4. Save

            (P.S. I had the same problem today after updating Ubuntu 15.10 to Ubuntu 16.04.)






            share|improve this answer
















            Reset your repositories like this



            1. sudo rm /etc/apt/sources.list

            2. sudo software-properties-gtk

            3. Pick your options

            4. Save

            (P.S. I had the same problem today after updating Ubuntu 15.10 to Ubuntu 16.04.)







            share|improve this answer















            share|improve this answer




            share|improve this answer








            edited Nov 24 '17 at 18:42









            Tim

            25k17 gold badges92 silver badges148 bronze badges




            25k17 gold badges92 silver badges148 bronze badges










            answered Jun 4 '16 at 2:51









            AndrewAndrew

            1,1347 silver badges8 bronze badges




            1,1347 silver badges8 bronze badges















            • Beware that you only should do this after you check & make sure that you actually have software-properties-gtk installed on your system. Don't ask me what made me to write this.

              – Miloš Đakonović
              Aug 15 at 8:15

















            • Beware that you only should do this after you check & make sure that you actually have software-properties-gtk installed on your system. Don't ask me what made me to write this.

              – Miloš Đakonović
              Aug 15 at 8:15
















            Beware that you only should do this after you check & make sure that you actually have software-properties-gtk installed on your system. Don't ask me what made me to write this.

            – Miloš Đakonović
            Aug 15 at 8:15





            Beware that you only should do this after you check & make sure that you actually have software-properties-gtk installed on your system. Don't ask me what made me to write this.

            – Miloš Đakonović
            Aug 15 at 8:15











            5



















            Since the errors tell you where the problem is, and that all the problems are due to a single duplicated line, you can easily fix this manually with a text editor like vim, nano, etc. One benefit of this is that you can see exactly what the problem is and what you're doing to fix it.



            In your case, with sudo or as root, open /etc/apt/sources.list in a text editor. Delete either line 33 or line 87. You can visually check that they're duplicates first.



            If you like vim...



            $ sudo vim /etc/apt/sources.list
            33 [Shift]+g # to goto line 33
            87 [Shift]+g # to goto line 87, don't need a duplicate of line 33
            dd # to delete the line you're on
            :wq # to write the file and quit


            Or, to get out if you make a mistake...



            :q! # to quit without saving any changes





            share|improve this answer






























              5



















              Since the errors tell you where the problem is, and that all the problems are due to a single duplicated line, you can easily fix this manually with a text editor like vim, nano, etc. One benefit of this is that you can see exactly what the problem is and what you're doing to fix it.



              In your case, with sudo or as root, open /etc/apt/sources.list in a text editor. Delete either line 33 or line 87. You can visually check that they're duplicates first.



              If you like vim...



              $ sudo vim /etc/apt/sources.list
              33 [Shift]+g # to goto line 33
              87 [Shift]+g # to goto line 87, don't need a duplicate of line 33
              dd # to delete the line you're on
              :wq # to write the file and quit


              Or, to get out if you make a mistake...



              :q! # to quit without saving any changes





              share|improve this answer




























                5















                5











                5









                Since the errors tell you where the problem is, and that all the problems are due to a single duplicated line, you can easily fix this manually with a text editor like vim, nano, etc. One benefit of this is that you can see exactly what the problem is and what you're doing to fix it.



                In your case, with sudo or as root, open /etc/apt/sources.list in a text editor. Delete either line 33 or line 87. You can visually check that they're duplicates first.



                If you like vim...



                $ sudo vim /etc/apt/sources.list
                33 [Shift]+g # to goto line 33
                87 [Shift]+g # to goto line 87, don't need a duplicate of line 33
                dd # to delete the line you're on
                :wq # to write the file and quit


                Or, to get out if you make a mistake...



                :q! # to quit without saving any changes





                share|improve this answer














                Since the errors tell you where the problem is, and that all the problems are due to a single duplicated line, you can easily fix this manually with a text editor like vim, nano, etc. One benefit of this is that you can see exactly what the problem is and what you're doing to fix it.



                In your case, with sudo or as root, open /etc/apt/sources.list in a text editor. Delete either line 33 or line 87. You can visually check that they're duplicates first.



                If you like vim...



                $ sudo vim /etc/apt/sources.list
                33 [Shift]+g # to goto line 33
                87 [Shift]+g # to goto line 87, don't need a duplicate of line 33
                dd # to delete the line you're on
                :wq # to write the file and quit


                Or, to get out if you make a mistake...



                :q! # to quit without saving any changes






                share|improve this answer













                share|improve this answer




                share|improve this answer










                answered Jan 14 at 16:08









                mightypilemightypile

                5651 gold badge8 silver badges11 bronze badges




                5651 gold badge8 silver badges11 bronze badges
























                    4



















                    For Ubuntu-based systems with Linux mint, go to Software Sources > Maintenance > Remove Duplicate packages






                    share|improve this answer


























                    • doing that I get no duplicate found, but still see the same error

                      – cipricus
                      Aug 27 at 12:31















                    4



















                    For Ubuntu-based systems with Linux mint, go to Software Sources > Maintenance > Remove Duplicate packages






                    share|improve this answer


























                    • doing that I get no duplicate found, but still see the same error

                      – cipricus
                      Aug 27 at 12:31













                    4















                    4











                    4









                    For Ubuntu-based systems with Linux mint, go to Software Sources > Maintenance > Remove Duplicate packages






                    share|improve this answer














                    For Ubuntu-based systems with Linux mint, go to Software Sources > Maintenance > Remove Duplicate packages







                    share|improve this answer













                    share|improve this answer




                    share|improve this answer










                    answered Jan 30 at 10:37









                    Mario Olivio FloresMario Olivio Flores

                    2982 silver badges6 bronze badges




                    2982 silver badges6 bronze badges















                    • doing that I get no duplicate found, but still see the same error

                      – cipricus
                      Aug 27 at 12:31

















                    • doing that I get no duplicate found, but still see the same error

                      – cipricus
                      Aug 27 at 12:31
















                    doing that I get no duplicate found, but still see the same error

                    – cipricus
                    Aug 27 at 12:31





                    doing that I get no duplicate found, but still see the same error

                    – cipricus
                    Aug 27 at 12:31





                    protected by Thomas Ward Dec 1 '16 at 23:31



                    Thank you for your interest in this question.
                    Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count).



                    Would you like to answer one of these unanswered questions instead?



                    Popular posts from this blog

                    Distance measures on a map of a game The 2019 Stack Overflow Developer Survey Results Are Inmin distance in a graphShortest distance path on contour plotHow to plot a tilted map?Finding points outside of a diskDelaunay link distanceAnnulus from GeoDisks: drawing a ring on a mapNegative Correlation DistanceFind distance along a path (GPS coordinates)Finding position at given distance in a GeoPathMathematics behind distance estimation using camera

                    How to get a smooth, uniform ParametricPlot of a 2D Region?How to plot a complicated Region?How to exclude a region from ParametricPlotHow discretize a region placing vertices on a specific non-uniform gridHow to transform a Plot or a ParametricPlot into a RegionHow can I get a smooth plot of a bounded region?Smooth ParametricPlot3D with RegionFunction?Smooth border of a region ParametricPlotSmooth region boundarySmooth region plot from list of pointsGet minimum y of a certain x in a region

                    Genealogie vun de Merowenger Vum Merowech bis zum Chilperich I. | Navigatiounsmenü