| Article Index |
|---|
| 1. Package Managers |
| 2. Uninstall Software |
| 2.1. Try the Easy Way |
| 2.2. The Hard Way |
'dpkg' is a package manager utilized by a number of Linux distributions (Debian, Ubuntu, Mint, ...). This article will show you how to remove packages that are generating error messages while uninstalling them.
1. Package Managers
Package managers care about all installed software packages in your Linux systems. Utilizing package managers is a key requirement to...
- keep track of installed software
- be able to upgrade and patch installed software
- completely uninstall software.
2. Uninstall Software
For removing software from Linux systems you just have to tell dpkg what software package to uninstall. Dependency checking and removal of all related files is performed by this package manager.
# commands to remove a package $ dpkg --remove my-package-name $ dpkg --purge my-package-name
If there are some problems with the uninstall scipts related to the software package to be removed you will receive some error messages and the software will not be removed. Here is an example of an error message:
[...] E: Sub-process /usr/bin/dpkg returned an error code (1)
Because of various tasks performed by dpkg automatically, you could get into the situation where removal and installation of other software packages is not possible any more. This includes the upgrade of software packages installed to your system.
In this case there are some approaches available to uninstall the problematic software component.
2.1. Try the Easy Way
If there are problems removing installed software packages you may try to reinstall or reconfigure the software package in question. If this step succeeds you are ready to retry to deinstallation of the package. The following list of commands illustrates a variety ways to reinstall / reconfigure named packages - in this example the package is named 'my-package'.
# reinstall by utilizing apt-get $ apt-get -f install my-package # ... or try 'dpkg' if there is a deb-file available $ dpkg -i --force-all --no-triggers /path/to/my-package.deb # try to remove the package $ dpkg --remove --force-remove-reinstreq my-package # try to purge the package $ dpkg -P --force-all my-package
2.2. The Hard Way
If the previous commands do not work, there are some other options:
- uninstall the files and directories manually
- remove the software package from the list of installed software
This article will describe the latter option. But keep in mind, that you should know what you are doing and the following work-around is classed as technique for professionals, only.
Open the file /var/lib/dpkg/status and find the package description of the package of your interest. Then delete the whole dataset and store the status file. Now 'dpkg' does not know anything about the previously installed package. Please bear in mind that this 'solution' is just a work-around to get your system running, again. It does not remove any files from your file system.
Related articles:




