(Really) Reinstalling on Debian (Shallow Thoughts)

Akkana's Musings on Open Source, Science, and Nature.

Fri, 18 Nov 2005

(Really) Reinstalling on Debian

I found myself in a situation where a package was mostly installed, but it was missing some files, notably the startup file in /etc/init.d/packagename. No problem, right? Just reinstall the package.

Well, no. dpkg -i packagename spun and looked busy for a while, but the missing file didn't appear. Removing the package first with dpkg -r packagename, then reinstalling, didn't help either, nor did dpkg -i --force-newconfig packagename. (I didn't try dpkg -r --purge packagename because I already had invested some time into setting up the files in the package and was hoping to avoid losing that work.)

Of course, I could have extracted the .deb somewhere else and pulled the single init.d file out of it; but I was worried that I might be missing other files, and end up with a flaky package.

Well, as far as I can tell, there really isn't any way to do this "right" in Debian: there's no way to tell dpkg "Really install this package, every file in it, even if you think maybe some of the files already got installed before", or "Install any file in this package which doesn't currently exist on disk." It's amazing (I'm pretty sure RPM offered both of these options) but apparently this isn't something dpkg allows.

I found a way to trick it, though:

rm /var/lib/dpkg/info/packagename.*
dpkg -i packagename

You get a lovely warning that
dpkg: serious warning: files list file for package `packagename' missing, assuming package has no files currently installed.
and then dpkg finally goes ahead and reinstalls all the files. Whew!

Update: Aha! It is possible after all. dpkg i --force-confmiss is the option I wasn't seeing. Thanks, Yosh!

Tags: ,
[ 18:01 Nov 18, 2005    More linux | permalink to this entry ]