I've tried apt-get --purge autoremove, but this is different. I want to completely wipe out the system. I've messed up with dependencies, and now there are tons of conflicts in there. Sure I can reinstall the whole OS, but that is exactly what I don't want to do for now.

Tip:

dpkg --list gives all installed packages. Can we purge this one by one and remove them?

dpkg --get-selections may be handy if you want to freeze your currently installed packages. You probably also mark them as "important", so you can save your initial setup in the beginning of the installation. And then remove all packages with a script provided in the selected answer :)

有帮助吗?

解决方案

You can do that. Just be careful not to remove essential packages, like dpkg and libc6, else your system will end up being unusable. The following script, which depends on python3-apt, should help:

#!/usr/bin/python3

import apt

cache = apt.cache.Cache()
for package in cache:
    if (package.is_installed and
        package.candidate.priority not in ("required", "important")):
        print(package.name, end=" ")
print()
许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top