Pages - Menu

Thursday, November 20, 2008

basic debian package maintenance

i've been looking at how to tidy my pc up a bit lately, and this is more or less what i came up with, with a bit of help from deborphan, which tells you libraries/packages that are installed but have no dependencies. install it with sudo apt-get install deborphan

firstly, run deborphan to see what lone libraries you have installed. you can also append --guess-data to try guessing data files, and --guess-all too. there are more options in the man page, such as the -e (exclude) and -A (add to exclude list) switches, useful if you have some independent packages installed that you need (like my libmotif3 for the citrix client)

if you're happy with that list, nest the program in apt-get with sudo apt-get purge `deborphan` (the backquotes will use the output of deborphan as the input for apt-get). once these packages have been removed, run deborphan again, and see if you've uncovered any deeper nested depends. if you're really keen, you can script it like so:

#!/bin/sh
while [ -n "`deborphan`" ]; do
deborphan
echo
apt-get purge `deborphan`
done

at times, apt-get will know that it doesn't need packages anymore either, and will tell you so when you run it. you can get rid of these packages with the sudo apt-get autoremove command

your system will also build up an apt cache of packages, especially as upgrades happen over time. you can clear these out with sudo apt-get autoclean, which removes packages that are out of date, or just sudo apt-get clean, which removes everything except the lockfile from the apt cache

so in summary:

sudo apt-get autoremove
deborphan
sudo apt-get purge `deborphan` till you have no packages
sudo apt-get clean

No comments: