Okay, Debian gurus... a challenge.

Randy Edwards redwards at golgotha.net
Fri Jan 9 18:03:47 EST 2004


    To be frank, I'm not sure if apt-get has such a switch.  But I can give 
some strategies of how to tackle this.

> anyone give me the apt-get-command-from-hell that would examine all the 
> packages currently installed, and either
> a) re-install their /usr/lib files, or, failing that,

    I don't think that will be possible...

> b) re-install all their non-config files, or, failing _that_,

    ...nor that...

> c) re-install _all_ their files (I have a backup of all config data,
>   so it's not like I'd be starting from scratch).

    But this is a lock.  Don't worry about your configuration data -- 
remember, this is Debian. :-)  If you've modified config files, dpkg will 
detect the modifications when it runs and will prompt you whether you want 
to install the new config file, keep the old config file, do a shell, or do 
a diff of the two config files.  Thus, your config data should be safe.

    Hopefully someone will chime in and educate us both about a magic switch 
which will do what you want.  But if not, here's a couple of ideas that 
might be helpful.

    Visit /var/lib/dpkg/info.  Do a grep on the *.list files in that 
directory searching for /usr/lib.  The list files (in the format of 
PackageName.list) will tell you each PackageName that put files into 
/usr/lib.  That should allow you to just download only the packages that put 
files into /usr/lib.  Once downloaded, then you can just put those package 
names into a file and do a series of "apt-get install --reinstall 
PackageName" to install them, and, of course, answer prompts about the 
modified config files.

    If you want to reinstall everything and avoid the grep method above, 
then run a man on dpkg and look at its get and set selections option.  While 
this isn't ideal for the situation you're in, IMHO, anyone running Debian 
should do a "get-selection" and redirect it into a file just in case of 
something bizarre happening.

    Doh!!  I typed all of that for nothing. :-)

    I forget sometimes that I run the www.DebianHelp.org site.  I just did a 
search on that and what do you know, another user had the same problem.  Do 
a couple of searches on the site, or visit this link 
<http://www.debianhelp.org/modules.php?op=modload&name=News&file=article&sid=2096> 
but this snippet of untested code looks promising:

apt-get install --reinstall `ls /var/lib/dpkg/info | grep '.list$' | sed -e 
's/.list$//g'`

    With those tips, you should be ready to really screw things up. :-)

-- 
  Regards, | "Every gun that is made, every warship launched, every rocket
  .        | fired signifies, in the final sense, a theft from those who
  Randy    | hunger and are not fed, those who are cold and are not
           | clothed." -- US President Dwight D. Eisenhower





More information about the gnhlug-discuss mailing list