Say I have a Debian machine where I would like to free up space on '/' by removing useless packages. To find good candidates of packages to review, I would like to focus my attention on the largest ones first.
It seems that the standard solution to do this is to list all installed packages by their installed size. However, this solution has a lot of drawbacks, because it ignores dependencies and ignores whether a package was automatically or manually installed:
- If a package is large but many manually installed packages depend on it, then maybe it is not a good candidate to consider for removal (e.g., removing libicu52 is a bad idea even though it's large)
- If a package depends on another package, then removing the second one will also save up the space obtained by removing the first one (e.g., removing libwine also removes wine)
- If a package A depends on another package B and a third package C was only automatically installed as a dependency to B, then removing A will remove B and C will be auto-removed, which should be accounted for (e.g., removing wesnoth-1.10-data removes wesnoth-1.10, which means that wesnoth-1.10-music would be removed).
It seems that a right tool for this job should only propose manually installed packages for removal, and should sort them by the space that would be reclaimed by removing them and then running autoremove (removing automatically installed packages that are no longer necessary).
Of course you could simulate this by a variant of this solution, but it is both slow and ugly. Hence my question: is there a standard tool that looks at the dependency graph of packages and computes this information? (I am considering to write a script for this, but I'd like to make sure it doesn't exist yet.)