💾 Archived View for gemini.ctrl-c.club › ~lettuce › remove-old-packages.gmi captured on 2024-05-10 at 11:26:04. Gemini links have been rewritten to link to archived content
⬅️ Previous capture (2023-09-28)
-=-=-=-=-=-=-
2023-09-22
This is a short Linux tutorial of incantations you can use to remove dependency packages for programs that you've uninstalled. As far as I know, this is not done automatically on any distros I've used. I tend to run this periodically, most especially after removing software from the command line. Most obviously, you'd do this to reduce your disk usage.
So here's how I remove old unused dependencies after I remove a package or program from my computer.
In general, autoremove means to remove no-longer needed dependencies. clean on Debian-based systems means to remove the deb dependency file listing and packages. If you are planning on reinstalling the software in the future, it's faster for your package manager to re-use the dependencies locally than re-download them. Personally, I don't need that.
sudo apt autoremove && sudo apt clean
I use the vpm package to easily install and remove software on Void Linux and this is what I do:
sudo vpm cleanup && sudo vpm autoremove
For straight up xbps without vpm I'd do the following:
xbps-remove -oO
This should be equivalent to the vpm commands above.
In addition to Void's repos I use flatpak for software not found in my distro's repo. To remove unused dependencies you run:
sudo flatpak uninstall --unused
This is Void-specific for me. After testing an updated kernel to make sure it's stable (have never had a problem on Void linux) I run the following to see which old kernel(s) I have installed:
vkpurge list
I usually leave one old kernel around just in case I ever have issue and need to use a previous kernel.
To remove an old kernel you run:
sudo vkpurge remove <kernel-number>
To remove old unused dependencies of a project:
npm prune
Like everything else with Python there is no single way to remove unused dependencies that I can see.
Annoyingly, it looks the most recommended way I've found is to install a new package, pip3-autoremove.
I'm not much of a python user and not a fan of its fractured dev enviornment so you'll want to look further into other solutions yourself.
See what luarocks packages you have installed:
luarocks list
Remove an individual rock:
luarocks remove --local <rockname>
Removing all installed rocks requires you specify the 'tree' explicitly:
luarocks purge --tree=~/.luarocks
---
If you have a comment you can email lettuce at the ctrl-c.club domain and please put comment and the post name and your handle.