How to Reinstall All Debian Packages

aptdebianpackage-management

I killed by mistake a dpkg process running in the background and I would like to reinstall all packages to be sure everything is allright.

First, I tried to get a list of all packages and reinstall them

dpkg --get-selections | grep -v deinstall | awk '{print $1}' > list.log
apt-get install --reinstall $(cat list.log)

But there are messages like :

E: Couldn't configure pre-depend debconf:i386 for console-setup:i386, probably a dependency cycle.

I tried apt-get -f install, without success.

As a last resort, I reinstalled all programs which failed the checksums :

dpkg -l | grep ^ii | awk '{ print $2 }' | xargs debsums -s -a

What should I do to reinstall everything ?

Edit : Problem solved. The issue was something else (see the comments). I understand it's something to avoid with Debian though.

Best Answer

Try this, remembering that I did not test it:

dpkg --get-selections > selections
sudo dpkg --clear-selections
sudo dpkg --set-selections < selections
sudo apt-get --reinstall dselect-upgrade

Sources:

Related Question