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












90














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




















  • 1




    Wow... You have a worse case of this than I have...
    – user364819
    Apr 22 '16 at 22:24










  • I've run at least 100 16.04 VMs (of daily-build tests, Betas and Alphas) and I've had this issue in all of them...
    – user364819
    Apr 22 '16 at 22:28






  • 2




    Possible duplicate of how to fix error W: Target Packages (main/binary-amd64/Packages) is configured multiple times in /etc/apt/sources.list:2 and /etc/apt/sources.list:5
    – muru
    Apr 22 '16 at 22:29






  • 2




    @muru This question is asking for an automated way.
    – Tim
    Apr 22 '16 at 22:35






  • 1




    Same problem here, ubuntu 16.04 Desktop I had changed repositories to Main Server, after problems arose with my normal repository channel. I usually use mirror.math.ucdavis.edu/ubuntu, and I changed back to that ucdavis repository, All fixed, is that an "automatic enough" response? good luck
    – Douglas
    Dec 1 '16 at 18:24
















90














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




















  • 1




    Wow... You have a worse case of this than I have...
    – user364819
    Apr 22 '16 at 22:24










  • I've run at least 100 16.04 VMs (of daily-build tests, Betas and Alphas) and I've had this issue in all of them...
    – user364819
    Apr 22 '16 at 22:28






  • 2




    Possible duplicate of how to fix error W: Target Packages (main/binary-amd64/Packages) is configured multiple times in /etc/apt/sources.list:2 and /etc/apt/sources.list:5
    – muru
    Apr 22 '16 at 22:29






  • 2




    @muru This question is asking for an automated way.
    – Tim
    Apr 22 '16 at 22:35






  • 1




    Same problem here, ubuntu 16.04 Desktop I had changed repositories to Main Server, after problems arose with my normal repository channel. I usually use mirror.math.ucdavis.edu/ubuntu, and I changed back to that ucdavis repository, All fixed, is that an "automatic enough" response? good luck
    – Douglas
    Dec 1 '16 at 18:24














90












90








90


39





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

19.6k1484139




19.6k1484139








  • 1




    Wow... You have a worse case of this than I have...
    – user364819
    Apr 22 '16 at 22:24










  • I've run at least 100 16.04 VMs (of daily-build tests, Betas and Alphas) and I've had this issue in all of them...
    – user364819
    Apr 22 '16 at 22:28






  • 2




    Possible duplicate of how to fix error W: Target Packages (main/binary-amd64/Packages) is configured multiple times in /etc/apt/sources.list:2 and /etc/apt/sources.list:5
    – muru
    Apr 22 '16 at 22:29






  • 2




    @muru This question is asking for an automated way.
    – Tim
    Apr 22 '16 at 22:35






  • 1




    Same problem here, ubuntu 16.04 Desktop I had changed repositories to Main Server, after problems arose with my normal repository channel. I usually use mirror.math.ucdavis.edu/ubuntu, and I changed back to that ucdavis repository, All fixed, is that an "automatic enough" response? good luck
    – Douglas
    Dec 1 '16 at 18:24














  • 1




    Wow... You have a worse case of this than I have...
    – user364819
    Apr 22 '16 at 22:24










  • I've run at least 100 16.04 VMs (of daily-build tests, Betas and Alphas) and I've had this issue in all of them...
    – user364819
    Apr 22 '16 at 22:28






  • 2




    Possible duplicate of how to fix error W: Target Packages (main/binary-amd64/Packages) is configured multiple times in /etc/apt/sources.list:2 and /etc/apt/sources.list:5
    – muru
    Apr 22 '16 at 22:29






  • 2




    @muru This question is asking for an automated way.
    – Tim
    Apr 22 '16 at 22:35






  • 1




    Same problem here, ubuntu 16.04 Desktop I had changed repositories to Main Server, after problems arose with my normal repository channel. I usually use mirror.math.ucdavis.edu/ubuntu, and I changed back to that ucdavis repository, All fixed, is that an "automatic enough" response? good luck
    – Douglas
    Dec 1 '16 at 18:24








1




1




Wow... You have a worse case of this than I have...
– user364819
Apr 22 '16 at 22:24




Wow... You have a worse case of this than I have...
– user364819
Apr 22 '16 at 22:24












I've run at least 100 16.04 VMs (of daily-build tests, Betas and Alphas) and I've had this issue in all of them...
– user364819
Apr 22 '16 at 22:28




I've run at least 100 16.04 VMs (of daily-build tests, Betas and Alphas) and I've had this issue in all of them...
– user364819
Apr 22 '16 at 22:28




2




2




Possible duplicate of how to fix error W: Target Packages (main/binary-amd64/Packages) is configured multiple times in /etc/apt/sources.list:2 and /etc/apt/sources.list:5
– muru
Apr 22 '16 at 22:29




Possible duplicate of how to fix error W: Target Packages (main/binary-amd64/Packages) is configured multiple times in /etc/apt/sources.list:2 and /etc/apt/sources.list:5
– muru
Apr 22 '16 at 22:29




2




2




@muru This question is asking for an automated way.
– Tim
Apr 22 '16 at 22:35




@muru This question is asking for an automated way.
– Tim
Apr 22 '16 at 22:35




1




1




Same problem here, ubuntu 16.04 Desktop I had changed repositories to Main Server, after problems arose with my normal repository channel. I usually use mirror.math.ucdavis.edu/ubuntu, and I changed back to that ucdavis repository, All fixed, is that an "automatic enough" response? good luck
– Douglas
Dec 1 '16 at 18:24




Same problem here, ubuntu 16.04 Desktop I had changed repositories to Main Server, after problems arose with my normal repository channel. I usually use mirror.math.ucdavis.edu/ubuntu, and I changed back to that ucdavis repository, All fixed, is that an "automatic enough" response? good luck
– Douglas
Dec 1 '16 at 18:24










4 Answers
4






active

oldest

votes


















131














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. sudo python3 -OEs aptsources-cleanup.zip


  2. Follow the instructions appearing on the screen.





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}: {1}n'
' 2. {2}: {3}n'
'I disabled the latter entry.'.format(
orig.file, orig, dupe.file, dupe),
end='nn')
dupe.disabled = True

print('n{0} 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). Please leave your comments and forks on GitHub.






share|improve this answer























  • Works fantastic, Thanks for your contribution
    – Stepan Furman
    Mar 19 '18 at 21:07






  • 1




    I don't have enough rep for an answer, so here it is. All I had to do was read the error and rm the offending "list". Example error: W: Target DEP-11-icons-small (main/dep11/icons-48x48.tar) is configured multiple times in /etc/apt/sources.list.d/brave-bionic.list:1 and /etc/apt/sources.list.d/brave-bionic.list:2. Running /etc/apt/sources.list.d/sudo rm -i brave-bionic.list.save and sudo rm -i /etc/apt/sources.list.d/brave-bionic.list fixed this issue for me
    – James L.
    Sep 5 '18 at 16:11



















55














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



















  • 4




    I was requesting an automated method.
    – Tim
    Nov 6 '16 at 10:58






  • 9




    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 good answer! Worked perfectly for me too
    – haksayng
    Nov 6 '17 at 17:02






  • 1




    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










  • @Deruijter: Could you please open a new question if you have a new or follow-up question? The comment section is not suitable or meant for new questions or extended discussion. You’re welcome to send me a comment with a notification to draw my attention to it. Thanks.
    – David Foerster
    Jun 13 '18 at 18:07



















24














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































    0














    I encountered this for 18.10. I used Synaptic to check the repositories and then deleted the ones I thought were duplicates. Result: no more error messages.






    share|improve this answer




















      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?














      4 Answers
      4






      active

      oldest

      votes








      4 Answers
      4






      active

      oldest

      votes









      active

      oldest

      votes






      active

      oldest

      votes









      131














      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. sudo python3 -OEs aptsources-cleanup.zip


      2. Follow the instructions appearing on the screen.





      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}: {1}n'
      ' 2. {2}: {3}n'
      'I disabled the latter entry.'.format(
      orig.file, orig, dupe.file, dupe),
      end='nn')
      dupe.disabled = True

      print('n{0} 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). Please leave your comments and forks on GitHub.






      share|improve this answer























      • Works fantastic, Thanks for your contribution
        – Stepan Furman
        Mar 19 '18 at 21:07






      • 1




        I don't have enough rep for an answer, so here it is. All I had to do was read the error and rm the offending "list". Example error: W: Target DEP-11-icons-small (main/dep11/icons-48x48.tar) is configured multiple times in /etc/apt/sources.list.d/brave-bionic.list:1 and /etc/apt/sources.list.d/brave-bionic.list:2. Running /etc/apt/sources.list.d/sudo rm -i brave-bionic.list.save and sudo rm -i /etc/apt/sources.list.d/brave-bionic.list fixed this issue for me
        – James L.
        Sep 5 '18 at 16:11
















      131














      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. sudo python3 -OEs aptsources-cleanup.zip


      2. Follow the instructions appearing on the screen.





      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}: {1}n'
      ' 2. {2}: {3}n'
      'I disabled the latter entry.'.format(
      orig.file, orig, dupe.file, dupe),
      end='nn')
      dupe.disabled = True

      print('n{0} 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). Please leave your comments and forks on GitHub.






      share|improve this answer























      • Works fantastic, Thanks for your contribution
        – Stepan Furman
        Mar 19 '18 at 21:07






      • 1




        I don't have enough rep for an answer, so here it is. All I had to do was read the error and rm the offending "list". Example error: W: Target DEP-11-icons-small (main/dep11/icons-48x48.tar) is configured multiple times in /etc/apt/sources.list.d/brave-bionic.list:1 and /etc/apt/sources.list.d/brave-bionic.list:2. Running /etc/apt/sources.list.d/sudo rm -i brave-bionic.list.save and sudo rm -i /etc/apt/sources.list.d/brave-bionic.list fixed this issue for me
        – James L.
        Sep 5 '18 at 16:11














      131












      131








      131






      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. sudo python3 -OEs aptsources-cleanup.zip


      2. Follow the instructions appearing on the screen.





      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}: {1}n'
      ' 2. {2}: {3}n'
      'I disabled the latter entry.'.format(
      orig.file, orig, dupe.file, dupe),
      end='nn')
      dupe.disabled = True

      print('n{0} 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). Please leave your comments and forks on GitHub.






      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. sudo python3 -OEs aptsources-cleanup.zip


      2. Follow the instructions appearing on the screen.





      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}: {1}n'
      ' 2. {2}: {3}n'
      'I disabled the latter entry.'.format(
      orig.file, orig, dupe.file, dupe),
      end='nn')
      dupe.disabled = True

      print('n{0} 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). Please leave your comments and forks on GitHub.







      share|improve this answer














      share|improve this answer



      share|improve this answer








      edited May 9 '18 at 13:31

























      answered Apr 26 '16 at 0:35









      David FoersterDavid Foerster

      27.8k1364110




      27.8k1364110












      • Works fantastic, Thanks for your contribution
        – Stepan Furman
        Mar 19 '18 at 21:07






      • 1




        I don't have enough rep for an answer, so here it is. All I had to do was read the error and rm the offending "list". Example error: W: Target DEP-11-icons-small (main/dep11/icons-48x48.tar) is configured multiple times in /etc/apt/sources.list.d/brave-bionic.list:1 and /etc/apt/sources.list.d/brave-bionic.list:2. Running /etc/apt/sources.list.d/sudo rm -i brave-bionic.list.save and sudo rm -i /etc/apt/sources.list.d/brave-bionic.list fixed this issue for me
        – James L.
        Sep 5 '18 at 16:11


















      • Works fantastic, Thanks for your contribution
        – Stepan Furman
        Mar 19 '18 at 21:07






      • 1




        I don't have enough rep for an answer, so here it is. All I had to do was read the error and rm the offending "list". Example error: W: Target DEP-11-icons-small (main/dep11/icons-48x48.tar) is configured multiple times in /etc/apt/sources.list.d/brave-bionic.list:1 and /etc/apt/sources.list.d/brave-bionic.list:2. Running /etc/apt/sources.list.d/sudo rm -i brave-bionic.list.save and sudo rm -i /etc/apt/sources.list.d/brave-bionic.list fixed this issue for me
        – James L.
        Sep 5 '18 at 16:11
















      Works fantastic, Thanks for your contribution
      – Stepan Furman
      Mar 19 '18 at 21:07




      Works fantastic, Thanks for your contribution
      – Stepan Furman
      Mar 19 '18 at 21:07




      1




      1




      I don't have enough rep for an answer, so here it is. All I had to do was read the error and rm the offending "list". Example error: W: Target DEP-11-icons-small (main/dep11/icons-48x48.tar) is configured multiple times in /etc/apt/sources.list.d/brave-bionic.list:1 and /etc/apt/sources.list.d/brave-bionic.list:2. Running /etc/apt/sources.list.d/sudo rm -i brave-bionic.list.save and sudo rm -i /etc/apt/sources.list.d/brave-bionic.list fixed this issue for me
      – James L.
      Sep 5 '18 at 16:11




      I don't have enough rep for an answer, so here it is. All I had to do was read the error and rm the offending "list". Example error: W: Target DEP-11-icons-small (main/dep11/icons-48x48.tar) is configured multiple times in /etc/apt/sources.list.d/brave-bionic.list:1 and /etc/apt/sources.list.d/brave-bionic.list:2. Running /etc/apt/sources.list.d/sudo rm -i brave-bionic.list.save and sudo rm -i /etc/apt/sources.list.d/brave-bionic.list fixed this issue for me
      – James L.
      Sep 5 '18 at 16:11













      55














      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



















      • 4




        I was requesting an automated method.
        – Tim
        Nov 6 '16 at 10:58






      • 9




        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 good answer! Worked perfectly for me too
        – haksayng
        Nov 6 '17 at 17:02






      • 1




        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










      • @Deruijter: Could you please open a new question if you have a new or follow-up question? The comment section is not suitable or meant for new questions or extended discussion. You’re welcome to send me a comment with a notification to draw my attention to it. Thanks.
        – David Foerster
        Jun 13 '18 at 18:07
















      55














      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



















      • 4




        I was requesting an automated method.
        – Tim
        Nov 6 '16 at 10:58






      • 9




        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 good answer! Worked perfectly for me too
        – haksayng
        Nov 6 '17 at 17:02






      • 1




        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










      • @Deruijter: Could you please open a new question if you have a new or follow-up question? The comment section is not suitable or meant for new questions or extended discussion. You’re welcome to send me a comment with a notification to draw my attention to it. Thanks.
        – David Foerster
        Jun 13 '18 at 18:07














      55












      55








      55






      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

      19.6k1484139




      19.6k1484139










      answered Nov 6 '16 at 10:50









      learnerlearner

      592612




      592612








      • 4




        I was requesting an automated method.
        – Tim
        Nov 6 '16 at 10:58






      • 9




        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 good answer! Worked perfectly for me too
        – haksayng
        Nov 6 '17 at 17:02






      • 1




        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










      • @Deruijter: Could you please open a new question if you have a new or follow-up question? The comment section is not suitable or meant for new questions or extended discussion. You’re welcome to send me a comment with a notification to draw my attention to it. Thanks.
        – David Foerster
        Jun 13 '18 at 18:07














      • 4




        I was requesting an automated method.
        – Tim
        Nov 6 '16 at 10:58






      • 9




        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 good answer! Worked perfectly for me too
        – haksayng
        Nov 6 '17 at 17:02






      • 1




        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










      • @Deruijter: Could you please open a new question if you have a new or follow-up question? The comment section is not suitable or meant for new questions or extended discussion. You’re welcome to send me a comment with a notification to draw my attention to it. Thanks.
        – David Foerster
        Jun 13 '18 at 18:07








      4




      4




      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




      9




      9




      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












      This is a good answer! Worked perfectly for me too
      – haksayng
      Nov 6 '17 at 17:02




      This is a good answer! Worked perfectly for me too
      – haksayng
      Nov 6 '17 at 17:02




      1




      1




      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












      @Deruijter: Could you please open a new question if you have a new or follow-up question? The comment section is not suitable or meant for new questions or extended discussion. You’re welcome to send me a comment with a notification to draw my attention to it. Thanks.
      – David Foerster
      Jun 13 '18 at 18:07




      @Deruijter: Could you please open a new question if you have a new or follow-up question? The comment section is not suitable or meant for new questions or extended discussion. You’re welcome to send me a comment with a notification to draw my attention to it. Thanks.
      – David Foerster
      Jun 13 '18 at 18:07











      24














      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




























        24














        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


























          24












          24








          24






          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

          19.6k1484139




          19.6k1484139










          answered Jun 4 '16 at 2:51









          AndrewAndrew

          95948




          95948























              0














              I encountered this for 18.10. I used Synaptic to check the repositories and then deleted the ones I thought were duplicates. Result: no more error messages.






              share|improve this answer


























                0














                I encountered this for 18.10. I used Synaptic to check the repositories and then deleted the ones I thought were duplicates. Result: no more error messages.






                share|improve this answer
























                  0












                  0








                  0






                  I encountered this for 18.10. I used Synaptic to check the repositories and then deleted the ones I thought were duplicates. Result: no more error messages.






                  share|improve this answer












                  I encountered this for 18.10. I used Synaptic to check the repositories and then deleted the ones I thought were duplicates. Result: no more error messages.







                  share|improve this answer












                  share|improve this answer



                  share|improve this answer










                  answered Dec 24 '18 at 4:39









                  rob grunerob grune

                  538149




                  538149

















                      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

                      Mouse cursor on multiple screens with different PPI

                      Agildo Ribeiro

                      Sometime when accessing a menu: “Ubuntu 16.04 has experienced an internal error”