I had to work with some kali packages, so i added the last kali repository to my file /etc/apt/sources.list . Everything went fine, and I installed some packages and worked with some.

But during the installation of some packages, I have noticed that some already install packages in my Ubuntu were updated to the one who are in the kali repositories. That was fine at the moment, but now when I try to install some packages for Ubuntu, I get the error Unable to correct problems , defective packets are in mode " keep state ".

I guess that he problem came from the fact that some Ubuntu packages were update the versions that were in kali repository.

So, how can I kinda unupgrade all my installed packets to the version which are in the Ubuntu repository.

PS : I have already removed kali repository. And I'm using Ubuntu 15.10 with Linux version > 4.

  • I recommend you to backup and reinstall.
    – xangua
    Mar 4, 2016 at 16:35

2 Answers 2


Determine the first date that you added the Kali repository, and inspect /var/log/apt/history.log for packages installed on and after that date. These are the packages that may have come from the Kali repository, and that you should reinstall.

It should be a simple matter of editing to transform this list of packages (remove the version information info, 1-entry-per-line, etc), then feed this cleaned up list of packages to sudo apt-get install --reinstall. You may have to feed the list of packages to |xargs sudo apt-get install --reinstall (see man xargs) if there are too many.

  • I see, i looked to that log file, and the first entrance is from 2 mars. Too bad, but thanks anyway. There is noway to tell ubuntu to install versions that you find in the repositories now ??!!
    – Sidahmed
    Mar 5, 2016 at 14:29
  • Then look at /var/log/apt/history.log*. These gzipped files contain logs back to the Beginning Of Time
    – waltinator
    Mar 5, 2016 at 15:04
  • Ah, très très bien, j'ai trouvé les fichiers compressés des logs précédents, et il contient les noms des paquets que j'ai installé précédemment. Merci infiniment.
    – Sidahmed
    Mar 6, 2016 at 8:47

I found the solution to downgrade packages to the official Ubuntu repositories : 

We have to install the package ppa-purge with sudo apt-get install ppa-purge, who will remove an external repository, and downgrade all packages to the available versions in the official repository.

So sudo ppa-purge ppa:user/ppa-name will remove the repository and automatically downgrade the packages.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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