Reinstalling with apt-get

I suspected that some files in /usr and /var/cache/apt/archive contained errors, because e2fsck found errors and modified some files.

So, how to automatically install new fresh files without any admin intervention?1

Here's my receipe

1. First configure dpkg to not bother you with a question if you want to keep your customized conffiles, see automatically installing security updates.

////// Contents of file /etc/apt/apt.conf.d/50automatic-security-installs // Do default handling of changed conffiles (should be keep user changes) // If default is set to do nothing, then keep user changes Dpkg::Options {"—force-confold";}

2. Delete potentially broken debs in /var/cache/apt/archive. # apt-get clean

3. Reinstall the already installed packages

# for i in `COLUMNS=120 dpkg -l grep "^ii" - mawk '{print $2}'`; do nice -n 19 apt-get -y —reinstall install $i ; done

1. Note that if there are error in files needed by apt-get, dpkg or any file used in the preinst och postinst script of the packages that is to be installed this process will fail at some point. I met with that when the file /usr/lib/perl/5.8/re.pm was messed up. I simply copied a good version of that file from another system.

comments powered by Disqus


Back to the index

Blog roll

R-bloggers, Debian Weekly
Valid XHTML 1.0 Strict [Valid RSS] Valid CSS! Emacs Muse Last modified: 2006-12-05