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
.
TL;DR: Have a supported Ubuntu or other Debian-based system and install a couple of Python packages:
sudo apt install python3-apt python3-regex
For details see below.
-
Python 3.4+
-
The
aptsources
module. In Debian-based distribution you can find it in thepython3-apt
package.
- The
regex
module for improved (non-European) language support. Package name:python3-regex
.
You can download a pre-bundled ZIP file executable by your Python interpreter:
Or you can download the source code and run it in Python albeit without translations.
-
From a ZIP bundle:
sudo python3 -OEs aptsources-cleanup.zip
I advise the use of the above interpreter options
-OEs
to avoid potential issues with your Python environment but they aren't strictly necessary. -
From source code:
sudo ./aptsources-cleanup
For a (slightly more) detailed description and individual command-line options see the output of
python3 -OEs aptsources-cleanup.zip --help
or
./aptsources-cleanup --help
depending on the deployment type.