Monday, February 14, 2022

apt doesn't auto purge unused packages

problem: apt doesn't auto purge unused packages

By default, at least on my Debian systems apt and aptitude don't automatically purge unused packages. 

I'm sure you've come to purge a package and some other packages are proposed to be automatically removed but not automatically purged... 

The difference between remove and purge? "remove" removes the main package files but often the configuration is left intact. "purge" removes everything it can related to a given package including configuration.

Note that /var data and similar data created by running package executables/daemons is often not removed during package removal or purge because this data is written outside of the visibility or control of dpkg.

impact: cruft build up on the system.

solution: run aptitude with some apt options

⚠⚠⚠ DISCLAIMER ⚠⚠⚠ this approach can be destructive. Make sure you really want to purge the unused  packages!
aptitude -o Aptitude::Delete-Unused=1 -o Aptitude::Purge-Unused=1 purge usrmerge

No comments: