< Previous | Contents | Next >
Reinstalling Packages with apt --reinstall and aptitude reinstall
When you mistakenly damage your system by removing or modifying certain files, the easiest way to restore them is to reinstall the affected package. Unfortunately, the packaging system finds that the package is already installed and politely refuses to reinstall it. To avoid this, use the --reinstall option of the apt and apt-get commands. The following command reinstalls postfix even if it is already present:
# apt --reinstall install postfix
# apt --reinstall install postfix
The aptitude command line is slightly different but achieves the same result with aptitude reinstall postfix. The dpkg command does not prevent re-installation, but it is rarely called directly.
Do Not Use apt Using apt --reinstall to restore packages modified during an attack will certainly
--reinstall to Recover not recover the system as it was.
from an Attack After an attack, you can’t rely on anything: dpkg and apt might have been replaced by malicious programs, not reinstalling the files as you would like them to. The attacker might also have altered or created files outside the control of dpkg.
Do Not Use apt Using apt --reinstall to restore packages modified during an attack will certainly
--reinstall to Recover not recover the system as it was.
from an Attack After an attack, you can’t rely on anything: dpkg and apt might have been replaced by malicious programs, not reinstalling the files as you would like them to. The attacker might also have altered or created files outside the control of dpkg.
Remember that you can specify a specific distribution with apt as well, which means you can roll back to an older version of a package (if for instance you know that it works well), provided that it is still available in one of the sources referenced by the sources.list file:
# apt install w3af/kali-rolling
# apt install w3af/kali-rolling