Accueil / Blog / Métier / Archives / Ubuntu/Mint/Debian systems: finding and re-installing removed packages

Ubuntu/Mint/Debian systems: finding and re-installing removed packages

Par Gaël Pegliasco publié 15/03/2013

Sometimes it is really not your day.

In the TV Series 'Mordicus has failed again spending too much time restoring his sytem" I have recently installed a badly designed .deb package which has automatically removed more than 250 packages on my system...

I've clicked on "Yes" install it a bit too fast, without having noticed the advertisment 268 packages will be removed if you say Yes.

Then, I thought, hum... I think I still have my USB Key formatted with the last Mint installation to re-install all this.
Then I thought, it will be stupid to re-install all the sytem, a better way should exist. Looking at Google my friend, and it goes.

Debian based distributions are robust, entering the following lines in a console will save the list of removed packages.

awk '$3 == "remove" { print $1, $2, $3, $4}' /var/log/dpkg.log | tee removed.txt

Then, edit the file removed.txt to keep only lines corresponding to the packages recently removed (check on the removed date) and enter the following command:

for i in $(awk '{print $4}') removed.txt); do sudo apt-get install $i; done

And just one hour lost. Could have been worst...

Finally, was near to be a good day.