Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

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.

share|improve this question
I recently had a crash while trying to install a package. When I rebooted and tried to reinstall that package, I received the message, "E: dpkg was interrupted, you must manually run 'dpkg --configure -a' to correct the problem.". Running that command removed said package and it configuration files. I was then able to install the package from scratch. Try giving that command a go. –  embedded.kyle Jun 12 '13 at 12:32
It didn't do anything, so I guess nothing is broken. I will try later to check if my driver issues are solved. –  alex_reader Jun 12 '13 at 13:01

2 Answers 2

up vote 4 down vote accepted

Try this, remembering that I do not tested it and prepending sudo whn needed:

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


share|improve this answer
My problem was completely different : I was not booting the correct kernel (!). I will accept your answer as it seems to do what I wanted (but untested also). –  alex_reader Jun 12 '13 at 17:44
This won't work, and will completely break the system. Line 3 will uninstall apt, so it won't be possible to reinstall everything, afterwards. –  rkjnsn Nov 4 '13 at 17:41
@rkjnsn: I updated the answer, check if it works. –  Lucas Malor Nov 6 '13 at 9:17
Trying to do this nothing is being reinstalled, although the selections file is populated: pi@prodpi ~ $ sudo apt-get --reinstall dselect-upgrade Reading package lists... Done Building dependency tree Reading state information... Done 0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded. any idea? –  andig Jun 9 '14 at 8:42

When using RPM, in the event you cause a corruption in the package database, there is an option to rebuild this database, thus preventing you from having to go through basically a reinstall. As one user here pointed out this is done in Debian by dpkg --configure -a.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.