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
Install Forcefully
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 getdeb-repository
.
$ 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
Thanks for your solution. I have implemented altos of solution many time but didn’t work. Your solution worked in one try. Great job
Hi Mohammad,
Thanks for your appreciation.
Have a nice day.
(base) dell@dell-Inspiron-7570:~$ sudo dpkg –configure -a
Setting up runit (2.1.2-3ubuntu1) …
start: Unable to connect to Upstart: Failed to connect to socket /com/ubuntu/upstart: Connection refused
dpkg: error processing package runit (–configure):
subprocess installed post-installation script returned error exit status 1
dpkg: dependency problems prevent configuration of git-daemon-run:
git-daemon-run depends on runit; however:
Package runit is not configured yet.
dpkg: error processing package git-daemon-run (–configure):
dependency problems – leaving unconfigured
Errors were encountered while processing:
runit
git-daemon-run
(base) dell@dell-Inspiron-7570:~$ sudo apt-get install -f
Reading package lists… Done
Building dependency tree
Reading state information… Done
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
2 not fully installed or removed.
After this operation, 0 B of additional disk space will be used.
Setting up runit (2.1.2-3ubuntu1) …
start: Unable to connect to Upstart: Failed to connect to socket /com/ubuntu/upstart: Connection refused
dpkg: error processing package runit (–configure):
subprocess installed post-installation script returned error exit status 1
dpkg: dependency problems prevent configuration of git-daemon-run:
git-daemon-run depends on runit; however:
Package runit is not configured yet.
dpkg: error processing package git-daemon-run (–configure):
dependency problems – leaving unconfigured
No apport report written because the error message indicates its a followup error from a previous failure.
Errors were encountered while processing:
runit
git-daemon-run
E: Sub-process /usr/bin/dpkg returned an error code (1)
(base) dell@dell-Inspiron-7570:~$ sudo apt-get remove –purge getdeb-repository
Reading package lists… Done
Building dependency tree
Reading state information… Done
E: Unable to locate package getdeb-repository
(base) dell@dell-Inspiron-7570:~$ sudo dpkg -i –force-overwrite /var/cache/apt/archives/libogremain-1.7.3_1.7.3-ogredev-natty3_i386.deb
dpkg: error processing archive /var/cache/apt/archives/libogremain-1.7.3_1.7.3-ogredev-natty3_i386.deb (–install):
cannot access archive: No such file or directory
Errors were encountered while processing:
/var/cache/apt/archives/libogremain-1.7.3_1.7.3-ogredev-natty3_i386.deb
(base) dell@dell-Inspiron-7570:~$ sudo apt autoremove
Reading package lists… Done
Building dependency tree
Reading state information… Done
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
2 not fully installed or removed.
After this operation, 0 B of additional disk space will be used.
Setting up runit (2.1.2-3ubuntu1) …
start: Unable to connect to Upstart: Failed to connect to socket /com/ubuntu/upstart: Connection refused
dpkg: error processing package runit (–configure):
subprocess installed post-installation script returned error exit status 1
dpkg: dependency problems prevent configuration of git-daemon-run:
git-daemon-run depends on runit; however:
Package runit is not configured yet.
dpkg: error processing package git-daemon-run (–configure):
dependency problems – leaving unconfigured
No apport report written because the error message indicates its a followup error from a previous failure.
Errors were encountered while processing:
runit
git-daemon-run
E: Sub-process /usr/bin/dpkg returned an error code (1)
.
.
.
// still its not solved what is the solution ?//
try running “sudo apt-get update && upgrade -y”
then try “sudo apt autoremove”
then rerun the command and see if that helps if it doesn’t please get back to me.
Thank you. It helped me solve the problem as well… In addition, I had to run the update manager again to fix the problem after running sudo dpkg –configure -a on the terminal.