In Linux, a Debian package is the compressed archive file that stores the essential files such as libraries, executable files, documentation belonging to the specific programs. Debian has the .deb extensions in the file name. In installing any dpkg in Linux, users may face the error “sub-process /usr/bin/dpkg”.
In this post, we will demonstrate the reason and solutions for the problem mentioned above. The write-up’s content is:
- Reason: Broken Packages
- Solution 1: Re-Configure the Database Package
- Solution 2: Remove the Causing Package
- Solution 3: Force Install the Package
- Solution 4: Trash the Post Files of Causing Package
Let’s start this guide.
Reason: Broken Packages
Sometimes, package installation is interrupted, which may lead to this error. The reason for this problem is because the packages are broken. This issue mostly occurs in Ubuntu and Debian-based distributions, which stops you from running the system update command. The solutions, for this reason, are discussed below.
Solution 1: Re-Configure the Database Package
In most cases, database files get corrupted due to the misconfiguration of any package. So configure the broken packages using the following command:
$ sudo dpkg --configure -a
If this will not resolve the problem, then go for solution 2.
Solution 2: Remove the Causing Package
Delete the package that is creating the problem. To remove that package, run the following command with your package name:
$ sudo apt remove [Package_Name]
After removing the packages, run the update command to update the packages:
$ sudo apt update
Now, check if the problem is resolved or not. If not, then go for another solution 3.
Solution 3: Force Install the Package
Another possible solution to fix the error is to install the interrupted packages, if any, forcefully. As we mentioned, package installation interruption is the cause of this error. So, try to install the package if any forcefully:
$ sudo apt install -f
After this, check if the error is resolved. If not, then solution 4 is also available.
Solution 4: Trash the Post Files of Causing Package
The fourth solution that you can perform is just to remove the package post files. Just look at the error and check the package creating the problem. (the package name would be mentioned in the last 3 lines of the error). Remove the post files of that package using the following command:
$ sudo mv /var/lib/dpkg/info/[Your Causing Package].* /tmp
After that, run the update command:
$ sudo apt update
The error will be resolved.
That’s all from this guide.
The reason for the sub-process “/usr/bin/dpkg” returning an error code (1) is the broken packages. To resolve it, there are four solutions, reconfigure the database files using the “sudo dpkg –configure -a” command, remove the error-causing package using the “sudo apt remove <package-name>” command, install the Interrupted package forcibly by executing “sudo install -f” command or remove the post files of the causing package by running the “sudo mv /var/lib/dpkg/info/ .*/tmp” command. This post has demonstrated the reason and all the solutions for the error mentioned above.