Skip to content

Instantly share code, notes, and snippets.

@davidfoerster
Last active September 25, 2022 19:55
Show Gist options
  • Save davidfoerster/780daa8086b924b1837a06cc486af672 to your computer and use it in GitHub Desktop.
Save davidfoerster/780daa8086b924b1837a06cc486af672 to your computer and use it in GitHub Desktop.
Migrated to https://github.com/davidfoerster/apt-remove-duplicate-source-entries
@ctorresr
Copy link

ctorresr commented Jun 3, 2016

@yashhsethiya You are probably missing python-apt package.

sudo apt-get install python-apt

@gwarah
Copy link

gwarah commented Jul 1, 2016

thanks, works fine, but runs as:

sudo python3 apt-remove-duplicate-source-entries.py

@ravingupta
Copy link

works for me... awesome

@Ammly
Copy link

Ammly commented Jul 19, 2016

Thanks, works on Ubuntu 16.04

@wwmbes
Copy link

wwmbes commented Jul 25, 2016

on Ubuntu 16.04 I get this result:
$ sudo python3 apt-remove-duplicate-source-entries.py
No duplicated entries were found.

[ But the following still happens... ]

$ sudo apt-get update
Hit:1 http://security.ubuntu.com/ubuntu xenial-security InRelease
Hit:2 http://za.archive.ubuntu.com/ubuntu xenial InRelease
Hit:3 http://ppa.launchpad.net/deluge-team/ppa/ubuntu xenial InRelease
Hit:4 http://za.archive.ubuntu.com/ubuntu xenial-updates InRelease
Hit:5 http://za.archive.ubuntu.com/ubuntu xenial-backports InRelease
Reading package lists... Done
W: Target Packages (main/binary-amd64/Packages) is configured multiple times in /etc/apt/sources.list:5 and /etc/apt/sources.list:55
W: Target Packages (main/binary-i386/Packages) is configured multiple times in /etc/apt/sources.list:5 and /etc/apt/sources.list:55
W: Target Packages (main/binary-all/Packages) is configured multiple times in /etc/apt/sources.list:5 and /etc/apt/sources.list:55
W: Target Translations (main/i18n/Translation-en_ZA) is configured multiple times in /etc/apt/sources.list:5 and /etc/apt/sources.list:55
W: Target Translations (main/i18n/Translation-en) is configured multiple times in /etc/apt/sources.list:5 and /etc/apt/sources.list:55
W: Target DEP-11 (main/dep11/Components-amd64.yml) is configured multiple times in /etc/apt/sources.list:5 and /etc/apt/sources.list:55
W: Target DEP-11-icons (main/dep11/icons-64x64.tar) is configured multiple times in /etc/apt/sources.list:5 and /etc/apt/sources.list:55
W: Target Packages (universe/binary-amd64/Packages) is configured multiple times in /etc/apt/sources.list:18 and /etc/apt/sources.list:55
W: Target Packages (universe/binary-i386/Packages) is configured multiple times in /etc/apt/sources.list:18 and /etc/apt/sources.list:55
W: Target Packages (universe/binary-all/Packages) is configured multiple times in /etc/apt/sources.list:18 and /etc/apt/sources.list:55
W: Target Translations (universe/i18n/Translation-en_ZA) is configured multiple times in /etc/apt/sources.list:18 and /etc/apt/sources.list:55
W: Target Translations (universe/i18n/Translation-en) is configured multiple times in /etc/apt/sources.list:18 and /etc/apt/sources.list:55
W: Target DEP-11 (universe/dep11/Components-amd64.yml) is configured multiple times in /etc/apt/sources.list:18 and /etc/apt/sources.list:55
W: Target DEP-11-icons (universe/dep11/icons-64x64.tar) is configured multiple times in /etc/apt/sources.list:18 and /etc/apt/sources.list:55
W: Target Packages (main/binary-amd64/Packages) is configured multiple times in /etc/apt/sources.list:5 and /etc/apt/sources.list:55
W: Target Packages (main/binary-i386/Packages) is configured multiple times in /etc/apt/sources.list:5 and /etc/apt/sources.list:55
W: Target Packages (main/binary-all/Packages) is configured multiple times in /etc/apt/sources.list:5 and /etc/apt/sources.list:55
W: Target Translations (main/i18n/Translation-en_ZA) is configured multiple times in /etc/apt/sources.list:5 and /etc/apt/sources.list:55
W: Target Translations (main/i18n/Translation-en) is configured multiple times in /etc/apt/sources.list:5 and /etc/apt/sources.list:55
W: Target DEP-11 (main/dep11/Components-amd64.yml) is configured multiple times in /etc/apt/sources.list:5 and /etc/apt/sources.list:55
W: Target DEP-11-icons (main/dep11/icons-64x64.tar) is configured multiple times in /etc/apt/sources.list:5 and /etc/apt/sources.list:55
W: Target Packages (universe/binary-amd64/Packages) is configured multiple times in /etc/apt/sources.list:18 and /etc/apt/sources.list:55
W: Target Packages (universe/binary-i386/Packages) is configured multiple times in /etc/apt/sources.list:18 and /etc/apt/sources.list:55
W: Target Packages (universe/binary-all/Packages) is configured multiple times in /etc/apt/sources.list:18 and /etc/apt/sources.list:55
W: Target Translations (universe/i18n/Translation-en_ZA) is configured multiple times in /etc/apt/sources.list:18 and /etc/apt/sources.list:55
W: Target Translations (universe/i18n/Translation-en) is configured multiple times in /etc/apt/sources.list:18 and /etc/apt/sources.list:55
W: Target DEP-11 (universe/dep11/Components-amd64.yml) is configured multiple times in /etc/apt/sources.list:18 and /etc/apt/sources.list:55
W: Target DEP-11-icons (universe/dep11/icons-64x64.tar) is configured multiple times in /etc/apt/sources.list:18 and /etc/apt/sources.list:55

@davidfoerster
Copy link
Author

davidfoerster commented Aug 1, 2016

@SnaasebKram: Could you please file an issue report and provide a link to your /etc/apt/sources.list? The comparison for duplicate entries is not perfect because I'm not exactly sure what entries Apt considers equal but a sample like yours would help tweaking that.

@davidfoerster
Copy link
Author

@yashhsethiya: You need to install the python3-apt package. The most recent release makes that clearer.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment