dpkg is a tool used to install packages into a Debian, Ubuntu, Mint, Kali or
deb based distribution. Generally package managers works without problem. But in some situations there may be some errors about package installation. One of the most popular
dpkg error is
sub process usr bin dpkg returned an error code 1 . In this tutorial we will look different ways to solve this error.
Reconfigure Package Database
One of the first way is configuring package database. Package database holds installed package related information. If an package installation is interrupted this database may become corrupt. We need to repair and reconfigure this package database with the following command.
$ sudo dpkg --configure -a
Some package installation may be interrupted and can not complete the installation because of the existing cache. We need to install forcefully which can be implemented like below.
$ sudo apt-get install -f
Remove Error Causing Package
Some times some similar job packages can be overlapped. In this situation we should need to remove the package which is all ready installed. We can get this package name from error messages. In this example we assume the package name is
$ sudo apt-get remove --purge getdeb-repository
Overwrite Other Packages File
Another solution to this error is forcing overwrite to the package which creates problem.
$ sudo dpkg -i --force-overwrite /var/cache/apt/archives/libogremain-1.7.3_1.7.3-ogredev-natty3_i386.deb
Auto Remove Unneeded Packages
We can remove unneeded packages with the
autoremove command like below. This is safe command which will clean cache for unused packages.
$ sudo apt autoremove