When I run apt update
on my Ubuntu laptop it prints a stream of errors about W: target packages/repos/DEP-11 being ‘configured multiple times’.
These errors do not prevent apt from working (so it’s not an issue in that sense) but the lengthy printout looks messy, is annoying to see, and clearly (since I’m being told about it) is something I should fix.
But how?
![](http://tipsbeginners.com/wp-content/uploads/2023/08/configured-multiple-times-error-ubuntu-840x572.jpg)
I mean, I didn’t intentionally configure the (in my case Google Chrome) repo multiple times so I can’t just “undo” what I did. And I’ve been using Ubuntu long enough to know that idly editing apt
is an no-no.
Thankfully, someone’s made a simple tool that automates the process of removing these duplicate entries from apt sources list file(s).
Apt Sources Cleanup Tool for Ubuntu
The tool in question is called aptsources-cleanup. It’s an open-source Python script that “detects and interactively deactivates duplicate Apt source entries and deletes sources list files without valid enabled source entries in /etc/sources.list
and /etc/sources.list.d/*.list
“.
The most recent release of this tool is from 2021 BUT it worked fine on my Ubuntu 23.04 install.
It’s not GUI tool (but since the apt errors it fixes are only seen from a CLI I can’t imagine that’ll put anyone off). It does require python3-apt
and python3-regex
to work, but both of these are available to install on Ubuntu directly from the standard repos.
To use download the .pyz
app bundle from the project GitHub, give it permission to run, and run it as root from a terminal emulator — obviously never run things you download from the internet as root without giving them a good looking at first (which I did, and I felt okay to continue).
I will stress that you MUST pay attention to the on-screen prompts. These will ask you to confirm actions (and if you don’t, nothing will be done/fixed).
But that’s it basically.
So if you’re being ticked off by “target packages configured multiple times in /etc/apt-sources.list” errors you may want to considering using this tool for a solution.