[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Reinstall all packages

on Wed, Aug 06, 2003 at 10:30:20AM +0200, Philipp Leusmann (philipp.leusmann@post.rwth-aachen.de) wrote:
> Hi,
> due to a harddisk-failure many files were corrupted. Far too many to
> reinstall them manually.
> Is there a way to reinstall all installed packages? something like 'apt-get
> intall --reinstall *'?


In my case (wiped out my root partition due to a rookie move two weeks
ago, recovered most, but not everything, from lost+found), I dumped my
package list to a file and fetched it.  This had the added benefit that
when conflicts showed up when trying to install/configure packages, I
could winnow down this file until everything worked.  As I was only
concerned with packages touching /bin /sbin /dev /etc /lib /root, I
generated the first package list with a 'dpkg -S' query, suitably
trimmed, sorted, and made unique.

    # generate package list
    dpkg --get-selections | grep ' install' > reinstall-packages

    # fetch new/updated debs.
    apt-get -duy install --reinstall $( cat reinstall-packages )

    # Install
    apt-get -uy install --reinstall $( cat reinstall-packages )

...editing out say, half of reinstall-packages if this doesn't complete
successfully, then bringing these back in.  I actually used a sed

    sed -e '1,40' reinstall-packages

...say, to attempt install on packages 1-40.  If these ran successfully,
I'd delete those lines from the file and try another set.

Wash, rinse, complete.


Karsten M. Self <kmself@ix.netcom.com>        http://kmself.home.netcom.com/
 What Part of "Gestalt" don't you understand?
   The golden rule of technical design:  complexity is the enemy.

Attachment: pgpO3UpnGXzg5.pgp
Description: PGP signature

Reply to: