Diary and notebook of whatever tech problems are irritating me at the moment.

20080713

Abusing your deb package manager

Normally all applications should be installed using your distro's package manager in order to set up dependencies correctly (like libraries). Once in a while you may encounter a problem with either a broken package database or synchronization problem due to hardware faults or naughty user behavior (like deletion of an application's files manually). The solution to a broken package problem is to first let the package manager try to fix it. On Debian or Ubuntu systems Synaptic has a menu option to fix broken packages. The console package manager "aptitude" also has a broken package filter and the command line tool apt-get has an "-f" option. But there are limits to what kind of a mess they can fix and sometimes you have to tread into the risky world of tool abuse to get the job done. One of these methods are the apt-get "force" options. For example, I wanted to reinstall the free Linux version of AVG Anti-Virus as the previous version was failing to update it's virus definition database due to a script or license key problem. I'm not worried about "theoretical" Linux malware but I do need to check Windows files for viruses prior to using them with Wine. But I'm using Ubuntu 64-bit on my AMD Phenom system and AVG only has a 32-bit version available which the package managers won't install due to the architecture mismatch. That's not as serious of a problem as it looks since most any 64-bit distro and CPU can also use 32-bit applications but the package managers take a very narrow-minded view of it. To get around it I used:

dpkg -i --force-architecture avg75fld-r51-a1243.i386.deb

But this didn't work when I first tried it. I had been doing some file management with some other manually-installed applications (i.e. not controlled by the package manager) and apparently deleted a link or two that the AVG package scripts looked for when uninstalling an old version. This may explain while it was failing to update in the first place. The failing "prerm" script caused dpkg to abort the install and there wasn't any command line option I could find to force it past the problem. I wasn't worried about breakage as I expected the new package to replace all the files of the old but I didn't want to extract the files from the deb and move them manually. The Debian/Ubuntu package management system keeps track of package status in "/var/lib/dpkg/status" and it's an easy to read text file. I searched for "avg75fld" and found this line:

Status: install ok installed

I changed the ending "installed" to "not-installed". I ran dpkg again and AVG installed without problems since dpkg stopped trying to remove the previous installation first.

I don't recommend abusing your package manager out of habit as it will lead to more problems in the future. Since a package manager has very significant control over your system and often is what sets distros apart from one another, you should learn how it operates and try to work with it instead of against it. For Ubuntu and Debian systems see Debian FAQ and Ubuntu documentation.

A word of warning - although Ubuntu is based on Debian the packages in their repositories are not the same so don't mix them. A stand-alone deb package shouldn't be a problem as long as no other packages depend on it. Several projects not in the repositores like Webmin and Lost Labyrinth are distributed this way.

About Me

Omnifarious Implementer = I do just about everything. With my usual occupations this means anything an electrical engineer does not feel like doing including PCB design, electronic troubleshooting and repair, part sourcing, inventory control, enclosure machining, label design, PC support, network administration, plant maintenance, janitorial, etc. Non-occupational includes residential plumbing, heating, electrical, farming, automotive and small engine repair. There is plenty more but you get the idea.