.deb Administration

Squeeze is frozen; by few days will be time to upgrade your debian distribution ..It's time to check your environment, in order to prevent bad things to happen upon changes: so let's take some considerations about .deb packages installed on your system. As for me, i have to admit that in more than one occasion i've played with packages from backports and from testing (being this server running a stable version): so, what one could check to be sure all things are fine ? Let's see ..

First tip is about 'removed' packages: if you're using apt to maintain and manage your software, probably you've often given the following command:

apt-get remove <package_name>

This command will actually remove but it will keep configuration files on the system. A simple way to see this fact, is giving another command, using dpkg:

dpkg -l | grep <package_name>

This way you're listing all the packages in the system, filtering a specified one: you'll notice that you're pack is still there, marked as 'rc' (currently installed packages will be 'ii' instead). But there is another way to uninstall a package with apt: using the 'purge' argument, like this:

apt-get purge <package_name>

Doing this way, apt will delete the package AND it's configuration files: it will be like you'd never installed it. But, there are always some problems around; let's suppose now that has some which depends on it... apt will kindly inform you that you can easily uninstall all of them giving the

apt-get autoremove

command. "Fine!" Isn't it ? Yep, that's very cool, but yet another time, that command will skip deleting the configuration files (you can prove it yourself using dpkg again). The simple story is: how am i supposed to get rid of all the unwanted stuff still sitting on my box ? I found several ways around the Internet, but think this one is the most valid, wheter you're using apt or aptitude to maintain the software ... we'll use dpkg and no one is complaining.

dpkg -l | awk '/^rc/ {print $2}' | xargs dpkg -P

This command will list the packs, apply a filter to the 'rc' ones, displaying them one for line, and finally pass them as an argument to dpkg -p (which stands for purge). All done, configurations files are gone.

Now a second tip: did you install some non 'standard', 'external' pack into your box ? Did you ever ask yourself how to get a friendly list of the aliens ? Check out this tool:

apt-get install apt-show-versions

The cool part will be left in the Administrator's hands. :-)

For example:

apt-show-versions  | grep "newer than"

This command will search the packages not installed from "regular" sources.

With apt-get you can also downgrade (not officialy supported, but you know what you're doing)

apt-cache show package # and retrive the version of the official package
apt-get install package=version
# example

apt-get install libgnutls26=2.8.6-1 libgcrypt11=1.4.5-2 libgpg-error0=1.6-1
Lettura elenco dei pacchetti... Fatto
Generazione albero delle dipendenze       
Lettura informazioni sullo stato... Fatto
I seguenti pacchetti saranno RIMOSSI:
   bitlbee bitlbee-dev bitlbee-plugin-otr
I seguenti pacchetti saranno RETROCESSI:
   libgcrypt11 libgnutls26 libgpg-error0

To find out the packages installed from other repositories (typical example debian-multimedia):

aptitude search '~S ~i ~O"Unofficial Multimedia Packages"'

Or even by maintainer name:

aptitude search '~i ?maintainer(marillat)'