Right now, when I run apt update on my Ubuntu laptop a stream of errors about W: target packages/repos/DEP-11 being ‘configured multiple times’ appear.

These errors don’t prevent apt from working (so it’s not an issue in that sense) but the lengthy printout is messy, annoying to look at, and clearly (since I’m being told about it) something I should fix.

But how?

’tis annoying being told this, tbh

I didn’t intentionally add the (in my case Google Chrome) repo it’s complaining about 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 equally vexed by this issue has created a simple tool to automate removing 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.