Clean up orphaned software

Warning: !! PROCEED AT YOUR OWN RISK !!

This sections cover things that are high risk because there is a possibility they can make your system unusable, or are considered unnecessary by many because the risks outweigh any rewards.

Why clean up Orphaned Software?

As you use your system, and you install and uninstall software, you’ll eventually end up with orphaned, or unused software/packages/libraries. You don’t need to remove them, but if you don’t need them, why keep them? When security is a priority, anything not explicitly needed is a potential security threat. You want to keep your server as trimmed and lean as possible.

Notes

• Each distribution manages software/packages/libraries differently so how you find and remove orphaned packages will be different. So far I only have steps for Debian based systems.

Debian Based Systems

On Debian based systems, you can use deborphan to find orphaned packages.

What’s the risk?

Keep in mind, deborphan finds packages that have no package dependencies. That does not mean they are not used. You could very well have a package you use every day that has no dependencies that you wouldn’t want to remove. And, if deborphan gets anything wrong, then removing critical packages may break your system.

Steps - Clean up Orphaned Software

1. Install deborphan.

 sudo apt install deborphan

2. Run deborphan as root to see a list of orphaned packages:

 sudo deborphan

libxapian30
libpipeline1

3. Assuming you want to remove all of the packages deborphan finds, you can pass it’s output to apt to remove them:

 sudo apt --autoremove purge \$(deborphan)